/* WH Gestión — estilos v2 (estética: tarjetas claras, sidebar oscuro, acento rojo Wood House) */
* { box-sizing: border-box; margin: 0; padding: 0; }
/* ---------- Tipografía ----------
   IBM Plex Sans, autoalojada. NO se enlaza a Google Fonts a propósito: eso metería una
   dependencia externa y mandaría la IP de cada usuario a un tercero en cada carga.

   Es una fuente VARIABLE: un solo archivo de 44 KB cubre del peso 100 al 700, por eso el
   @font-face declara un rango en vez de un número. Se descargó del subconjunto latino, que
   incluye ñ, las vocales acentuadas y los signos ¿ ¡. Licencia OFL (IBM, código abierto).

   La monoespaciada no es decoración: se reserva para cifras que se comparan entre filas
   —fechas, horas, contadores—, donde una anchura fija se lee mucho más rápido.

   Para volver a la fuente del sistema basta con cambiar --sans por
   'Segoe UI', system-ui, sans-serif y borrar assets/fonts/. */
@font-face {
  font-family: 'Plex Sans';
  src: url('fonts/plex-sans.woff2') format('woff2');
  font-weight: 100 700;      /* rango: es una fuente variable */
  font-style: normal;
  font-display: swap;        /* se ve texto desde el primer instante, aunque sea con la del sistema */
}
@font-face {
  font-family: 'Plex Mono';
  src: url('fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --sans: 'Plex Sans', 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --mono: 'Plex Mono', 'Cascadia Mono', Consolas, ui-monospace, monospace;
}

:root {
  --bg: #f4f5f8; --panel: #ffffff; --line: #e9ebf0; --text: #1d2129; --muted: #8a8f98;
  --primary: #e02b35; --primary-2: #c2232c; --primary-soft: #fdeaeb;
  --accent: #00c875; --danger: #df2f4a; --warn: #fdab3d;

  /* El rojo de Wood House es la marca, pero en cualquier interfaz el rojo también
     significa PELIGRO. Cuando los botones y las alertas son del mismo rojo, el ojo no
     distingue "pulsa aquí" de "esto va mal", y lo urgente deja de saltar.
     Por eso se separan tres papeles:
       --primary  identidad: logo, ítem activo del menú, enlaces, detalles de marca.
       --action   lo que se pulsa: botones primarios, filtro seleccionado.
       --urgente  lo que reclama atención AHORA: una conversación sin responder.
     Para volver al estado anterior basta con poner --action: var(--primary). */
  --action: #262d38; --action-2: #131920; --urgente: #b3312c; --urgente-soft: #fdf0ef;
  --side: #111318; --side-text: #b9bdc7; --radius: 14px;
  --shadow: 0 1px 3px rgba(20,22,30,.06), 0 8px 24px rgba(20,22,30,.05);
  font-size: 15px;
}
body { font-family: var(--sans); background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }

/* Iconos SVG monocromos */
.ic { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; flex-shrink: 0; }
.ic-sm { width: 15px; height: 15px; }

#app { display: flex; height: 100vh; overflow: hidden; }

/* ---------- Sidebar ---------- */
#sidebar { width: 236px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; height: 100vh; flex-shrink: 0; }
.side-head { display: flex; gap: 11px; align-items: center; padding: 18px 16px 14px; }
.side-logo-img { width: 36px; height: 36px; border-radius: 50%; display: block; }
.side-title { font-weight: 700; color: #fff; font-size: 15.5px; }
.side-sub { font-size: 11.5px; opacity: .55; }
#nav-boards { flex: 1; overflow-y: auto; padding: 8px 10px; }
.nav-sep { font-size: 10px; letter-spacing: 1.2px; opacity: .45; margin: 16px 10px 5px; }
.nav-item { display: flex; align-items: center; gap: 10px; color: var(--side-text); padding: 9px 11px; border-radius: 9px; margin: 2px 0; font-size: 13.5px; }
.nav-item .ic { opacity: .75; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; font-weight: 600; }
.nav-item.active .ic { opacity: 1; }
.nav-item .count { margin-left: auto; font-size: 11px; opacity: .5; }
.badge { background: var(--primary); color: #fff; border-radius: 10px; font-size: 10.5px; padding: 1px 7px; margin-left: auto; font-weight: 700; }
.side-foot { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.07); font-size: 13px; }
.side-user { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: #e8e9ec; }
.side-link { display: block; color: var(--side-text); opacity: .65; padding: 3px 0; font-size: 12.5px; }
.side-link:hover { opacity: 1; }

.avatar { width: 28px; height: 28px; border-radius: 50%; background: #3a3f4b; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; flex-shrink: 0; }
.avatar.small { width: 23px; height: 23px; font-size: 10.5px; background: #c9ccd4; color: #3a3f4b; }

/* ---------- Main ---------- */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
#content { padding: 18px 24px; display: flex; flex-direction: column; flex: 1; min-height: 0; overflow-y: auto; }
#content.board-mode { overflow-y: hidden; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

.board-head { margin-bottom: 10px; flex-shrink: 0; }
.board-head h1 { font-size: 21px; display: flex; align-items: center; gap: 10px; }
.board-head h1 .ic { width: 24px; height: 24px; color: var(--muted); }
.board-head .desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.board-toolbar { display: flex; gap: 8px; align-items: center; margin: 10px 0 12px; flex-wrap: wrap; flex-shrink: 0; }
.view-tab { padding: 7px 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.view-tab.active { border-color: var(--primary); color: var(--primary); font-weight: 600; background: var(--primary-soft); }
.spacer { flex: 1; }
.search-box { padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; width: 200px; background: var(--panel); }
.search-box:focus { outline: 2px solid #f5c6c9; border-color: var(--primary); }

.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 9px; padding: 8px 14px; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; }
.btn:hover { border-color: #c9ccd4; }
.btn-primary { background: var(--action); border-color: var(--action); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--action-2); border-color: var(--action-2); }
.btn-block { width: 100%; margin-top: 14px; justify-content: center; }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn-danger { color: var(--danger); }

/* Chips de filtros activos */
.filter-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--primary-soft); color: var(--primary-2); border: 1px solid #f3c2c5; border-radius: 20px; padding: 4px 11px; font-size: 12.5px; font-weight: 600; }
.filter-chip button { border: none; background: none; color: inherit; font-weight: 700; padding: 0 2px; }

/* ---------- Zona de tableros: UN solo scroll (x + y) ---------- */
#board-body { flex: 1; min-height: 0; overflow: auto; border-radius: var(--radius); }
.group-block { margin-bottom: 20px; min-width: max-content; }
.group-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14.5px; margin-bottom: 6px; cursor: pointer; user-select: none; position: sticky; left: 0; max-width: calc(100vw - 300px); }
.group-title .gdot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.group-title .gcount { color: var(--muted); font-weight: 400; font-size: 12px; }
.tbl-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); width: max-content; min-width: 720px; }
table.board { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
table.board th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; position: sticky; top: 0; background: var(--panel); z-index: 2; }
table.board th:first-child { left: 0; z-index: 4; border-top-left-radius: 12px; }
table.board td { padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--panel); }
table.board tr:last-child td { border-bottom: none; }
table.board tr:hover td { background: #faf9f8; }
td.cell-name { font-weight: 600; position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 0 var(--line); }
.name-txt { cursor: pointer; }
.name-txt:hover { color: var(--primary); }
.cell-editable { cursor: pointer; }
.cell-editable:hover { outline: 1px dashed #d9b8ba; outline-offset: -1px; }

.status-pill { display: inline-block; min-width: 88px; text-align: center; color: #fff; font-size: 11.5px; font-weight: 600; border-radius: 6px; padding: 4px 10px; }
.status-empty { background: #e4e6ec; color: #666; }
.chip { display: inline-block; background: #eef0f4; border-radius: 9px; font-size: 11.5px; padding: 2px 9px; margin-right: 3px; color: #555a63; }
.file-link { display: inline-block; margin-right: 6px; font-size: 12.5px; cursor: pointer; color: var(--primary); }
.mirror-val { color: var(--muted); font-style: italic; font-size: 12.5px; }
.rel-chip { display: inline-block; background: #eef3fd; color: #2a5bd7; border-radius: 9px; font-size: 11.5px; padding: 2px 9px; margin-right: 3px; cursor: pointer; }
.date-late { color: var(--danger); font-weight: 600; }

/* Stock de tableros (sobrantes) */
.stock-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-tabla th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .02em; padding: 6px 8px; border-bottom: 1px solid var(--border, #e2e4ea); white-space: nowrap; }
.stock-tabla td { padding: 6px 8px; border-bottom: 1px solid #f0f1f5; }
.stock-tabla tbody tr:hover > td { background: #f7f8fb; }
.stock-tabla tr.st-usada > td { color: var(--muted); background: #fafafa; }

/* Barra de rangos de fecha (PROSPECTOS y PROYECTOS VENDIDOS) */
.rango-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 10px; flex-shrink: 0; }
.rango-bar .rg-tit { font-size: 12.5px; color: var(--muted); margin-right: 2px; }
.rango-bar .rg-met { width: 155px; }
.rango-bar .rg-d { width: 140px; }
.rango-bar .rg-sep { width: 1px; height: 20px; background: var(--border, #e2e4ea); margin: 0 4px; }
.rango-bar .rg-p.on { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.rango-bar .rg-res { font-size: 12.5px; margin-left: auto; white-space: nowrap; }
.rango-bar .rg-res small { color: var(--muted); margin-left: 6px; }

/* Rectificación de medidas (NO / fecha) y plazo de entrega de información */
.pill-no { display: inline-block; background: #eceef3; color: #5b616e; border-radius: 9px; font-size: 11.5px; font-weight: 600; padding: 2px 9px; }
.pill-late { display: inline-block; background: #ffe9ec; color: #a01326; border: 1px solid #f3c3cb; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 1px 7px; white-space: nowrap; }
.pill-ok { color: var(--accent); font-weight: 700; }
.lim-ok { color: var(--muted); font-size: 11.5px; }
tr.row-late > td { background: #fff5f6; }
tr.row-late > td.cell-name { box-shadow: inset 3px 0 0 var(--danger); }

.add-item-row { padding: 7px 10px; }
.add-item-row input { border: none; background: transparent; width: 240px; padding: 4px; }
.add-item-row input:focus { outline: none; border-bottom: 1px solid var(--primary); }

/* Botón comentarios en la celda del nombre */
.cmt-btn { border: none; background: none; color: #b6bac2; padding: 2px 4px; margin-left: 6px; border-radius: 6px; position: relative; vertical-align: -1px; }
.cmt-btn:hover { color: var(--primary); background: var(--primary-soft); }
.cmt-btn.has { color: var(--primary); }
.cmt-count { font-size: 10px; font-weight: 700; margin-left: 1px; vertical-align: 2px; }

/* ---------- Editor inline ---------- */
.cell-editor { position: fixed; z-index: 260; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.18); padding: 10px; min-width: 220px; max-height: 70vh; overflow-y: auto; }
.cell-editor .opt { display: block; width: 100%; text-align: center; margin: 4px 0; border: none; border-radius: 7px; color: #fff; font-weight: 600; padding: 7px; }
.cell-editor input[type=text], .cell-editor input[type=number], .cell-editor input[type=date], .cell-editor input[type=email], .cell-editor input[type=tel], .cell-editor textarea { width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; }
.cell-editor textarea { min-height: 110px; width: 320px; }
.cell-editor .row { display: flex; gap: 6px; }
.cell-editor label.ck { display: flex; gap: 8px; align-items: center; padding: 5px 2px; font-size: 13.5px; cursor: pointer; }

/* ---------- Modales ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,17,22,.5); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--panel); border-radius: 16px; width: 700px; max-width: 100%; max-height: 92vh; overflow-y: auto; padding: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
.modal h2 { font-size: 18px; margin-bottom: 4px; }
.modal .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.modal-close { float: right; border: none; background: #f1f2f5; width: 30px; height: 30px; border-radius: 50%; font-size: 15px; color: var(--muted); }
.modal-close:hover { background: var(--primary-soft); color: var(--primary); }

/* Ficha: tarjeta de datos personales */
.person-card { background: #f8f9fb; border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; margin-bottom: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
.person-card .pc-item { font-size: 13px; min-width: 0; }
.person-card .pc-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 1px; display: flex; gap: 5px; align-items: center; }
.person-card .pc-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-row { display: flex; padding: 7px 0; border-bottom: 1px solid var(--line); gap: 12px; align-items: baseline; }
.detail-row .dlabel { width: 210px; flex-shrink: 0; color: var(--muted); font-size: 12.5px; }
.detail-row .dval { flex: 1; min-width: 0; }
.activity-list { margin-top: 10px; font-size: 12.5px; }
.activity-list li { list-style: none; padding: 5px 0; border-bottom: 1px dashed var(--line); color: var(--muted); }
.activity-list b { color: var(--text); }

/* Lightbox de archivos */
.lightbox-bg { position: fixed; inset: 0; background: rgba(10,11,14,.82); z-index: 300; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; }
.lightbox-top { color: #fff; width: min(960px, 96vw); display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 13.5px; gap: 10px; }
.lightbox-top a { color: #ffb3b7; }
.lightbox-bg img { max-width: 96vw; max-height: 84vh; border-radius: 10px; background: #fff; }
.lightbox-bg iframe { width: min(960px, 96vw); height: 84vh; border: 0; border-radius: 10px; background: #fff; }

/* Comentarios */
.cmt-list { max-height: 46vh; overflow-y: auto; margin: 10px 0; }
.cmt { border: 1px solid var(--line); border-radius: 12px; padding: 10px 13px; margin-bottom: 8px; }
.cmt.reply { margin-left: 34px; background: #f8f9fb; }
.cmt .cmt-head { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.cmt .cmt-head b { color: var(--text); font-size: 12.5px; }
.cmt .cmt-text { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.cmt .cmt-text .mention { color: var(--primary); font-weight: 600; }
.cmt-reply-btn { border: none; background: none; color: var(--muted); font-size: 11.5px; padding: 2px 0; margin-top: 4px; }
.cmt-reply-btn:hover { color: var(--primary); }
.cmt-form { display: flex; gap: 8px; align-items: flex-end; }
.cmt-form textarea { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; min-height: 44px; max-height: 130px; resize: vertical; }
.mention-hint { font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.mention-hint button { border: 1px solid var(--line); background: #f8f9fb; border-radius: 12px; padding: 1px 9px; font-size: 11.5px; color: #555; margin: 2px 3px 0 0; }

/* ---------- Dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
.goal-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; text-align: center; }
.goal-card h3 { font-size: 14px; margin-bottom: 4px; }
.goal-card .gc-sub { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.goal-ring { position: relative; width: 190px; height: 190px; margin: 0 auto 8px; }
.goal-ring svg { transform: rotate(-90deg); }
.goal-ring .gr-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.goal-ring .gr-pct { font-size: 30px; font-weight: 800; }
.goal-ring .gr-amt { font-size: 12px; color: var(--muted); }
.goal-meta { display: flex; justify-content: space-around; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 4px; }
.goal-meta b { display: block; font-size: 15px; color: var(--text); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 15px; cursor: pointer; }
.stat-card:hover { border-color: #d5b3b5; }
.stat-card .num { font-size: 24px; font-weight: 800; }
.stat-card .lbl { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.stat-card.warn .num { color: var(--danger); }
.stat-card.good .num { color: var(--accent); }
.panel-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.panel-card h3 { font-size: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.chart6 { display: flex; gap: 14px; align-items: flex-end; height: 150px; padding: 0 6px; }
.chart6 .cbar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.chart6 .cbar .bar { width: 70%; max-width: 46px; border-radius: 7px 7px 3px 3px; background: #e9ebf0; position: relative; min-height: 3px; transition: background .15s; }
.chart6 .cbar.cur .bar { background: var(--primary); }
.chart6 .cbar:hover .bar { background: #c9ccd4; }
.chart6 .cbar.cur:hover .bar { background: var(--primary-2); }
.chart6 .cbar .cv { font-size: 10.5px; color: var(--muted); }
.chart6 .cbar .cm { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.chart6 .cbar.cur .cm { color: var(--primary); font-weight: 700; }
.agenda-item { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; align-items: center; }
.agenda-item .ad { font-weight: 700; width: 52px; flex-shrink: 0; }
.agenda-item .atag { font-size: 11px; color: var(--muted); background: #f1f2f5; border-radius: 8px; padding: 2px 8px; flex-shrink: 0; }

/* ---------- Calendario ---------- */
.cal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-head h3 { font-size: 15px; min-width: 165px; text-align: center; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; min-width: 900px; }
.cal-dow { font-size: 11px; color: var(--muted); text-align: center; padding: 4px; }
.cal-cell { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; min-height: 92px; padding: 5px; font-size: 12px; }
.cal-cell.other { opacity: .4; }
.cal-cell.today { border-color: var(--primary); border-width: 2px; }
.cal-cell .cd { font-weight: 700; margin-bottom: 3px; }
.cal-ev { display: block; color: #fff; border-radius: 5px; padding: 2px 6px; margin-bottom: 2px; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-legend { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.cal-legend .cal-ev { cursor: default; }

/* ---------- Notificaciones ---------- */
.notif-item { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; margin-bottom: 8px; font-size: 13.5px; box-shadow: var(--shadow); }
.notif-item.unread { border-left: 4px solid var(--primary); }
.notif-item .nmeta { color: var(--muted); font-size: 11.5px; margin-top: 4px; }

/* ---------- Conversaciones: bandeja de dos paneles ----------
   Lista de chats a la izquierda y conversación abierta a la derecha, como en WhatsApp Web.
   Cada panel gestiona su propio scroll: por eso #content no scrollea en .chat-mode y todos
   los contenedores que crecen llevan min-height:0 (sin eso el flex respeta el alto del
   contenido y el cuadro de respuesta se sale de la pantalla). */
#content.chat-mode { overflow-y: hidden; }

/* ---------- Franja de resumen ----------
   Va encima de la bandeja y responde "¿qué tengo que hacer ahora?" antes de que nadie
   lea un solo nombre. Cifra grande y ligera, etiqueta pequeña: el número es el dato, no
   el adorno. La única en rojo es la que exige acción hoy. */
.resumen { display: flex; gap: 10px; margin-bottom: 12px; flex-shrink: 0; flex-wrap: wrap; }
.res { flex: 1 1 148px; min-width: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; display: flex; flex-direction: column; gap: 1px; }
.res .n { font-size: 26px; font-weight: 300; line-height: 1.05; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; }
.res .l { font-size: 11.5px; line-height: 1.3; }
.res .s { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res.alerta .n { color: var(--urgente); font-weight: 600; }
.res.cliqueable { cursor: pointer; }
.res.cliqueable:hover { border-color: var(--muted); }
.res.cliqueable.on { border-color: var(--urgente); background: var(--urgente-soft); }
.res-nota { font-size: 10.5px; color: var(--muted); align-self: center; padding-left: 2px; }

@media (max-width: 900px) { .resumen { display: none; } }

/* Lista a la izquierda, detalle a la derecha. Nació para la Bandeja y lo reutiliza la Base
   de conocimiento, así que las reglas llevan además un nombre genérico (.ld*) — navegar 64
   documentos y leer uno es el mismo problema que navegar chats y leer uno. Los nombres
   .chat-* se quedan como alias para no tocar conv.js, que ya funciona. */
.ld, .chat-wrap { display: flex; flex: 1; min-height: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }

.ld-lista, .chat-list { width: 336px; flex-shrink: 0; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
.chat-list-head { padding: 11px 12px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.chat-filtros { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 9px; }
.chat-filtro { border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 999px; padding: 3px 11px; font-size: 12px; }
.chat-filtro:hover { border-color: var(--action); color: var(--action); }
.chat-filtro.on { background: var(--action); border-color: var(--action); color: #fff; font-weight: 600; }
.chat-filtro .n { opacity: .75; margin-left: 3px; }

.chat-items { flex: 1; overflow-y: auto; min-height: 0; }
.chat-item { display: flex; gap: 11px; padding: 11px 13px; border-bottom: 1px solid var(--line);
  cursor: pointer; align-items: flex-start; }
.chat-item:hover { background: #f8f9fb; }
/* Seleccionado es neutro, no rojo: si el chat abierto se pinta de rosa, el rojo vuelve a
   significar dos cosas a la vez y "por responder" deja de destacar dentro de la lista. */
.chat-item.active { background: #eceef2; box-shadow: inset 3px 0 0 var(--action); }
.chat-item.unread .ci-name { font-weight: 700; }
.chat-item.unread .ci-prev { color: var(--text); }

/* Avatar con la inicial del cliente y, encima, el distintivo del canal por el que escribe. */
.ci-av { position: relative; flex-shrink: 0; }
.ci-av .avatar { width: 40px; height: 40px; font-size: 14px; }
.ci-canal { position: absolute; right: -3px; bottom: -3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--panel); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 1.5px var(--panel); }
.ci-canal .ic { width: 13px; height: 13px; stroke-width: 2; }
.ch-wa { color: #25d366; }        /* verde de WhatsApp */
.ch-ig { color: #e1306c; }        /* magenta de Instagram */
.ch-int { color: var(--muted); }  /* nota interna del equipo */

.ci-body { flex: 1; min-width: 0; }
.ci-top { display: flex; align-items: center; gap: 6px; }
.ci-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Monoespaciada: las fechas de la columna se comparan entre filas y con anchura fija se
   barren mucho más rápido. Es la única razón por la que aparece aquí. */
.ci-time { margin-left: auto; font-size: 10.5px; color: var(--muted); flex-shrink: 0;
  font-family: var(--mono); letter-spacing: -0.02em; }
.ci-prev { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; margin-top: 2px; }
.ci-meta { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
/* Sin leer NO es lo mismo que sin responder. El punto se queda en gris oscuro para que el
   rojo signifique una sola cosa en esta pantalla: el cliente escribió y nadie le contestó. */
.ci-punto { width: 8px; height: 8px; border-radius: 50%; background: var(--action); flex-shrink: 0; }
.ci-pend { background: var(--urgente-soft); color: var(--urgente); font-weight: 700; }

.ld-panel, .chat-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-head { padding: 10px 16px; border-bottom: 1px solid var(--line); flex-shrink: 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.chat-head .ch-nombre { font-size: 15px; font-weight: 700; }
.chat-head .ch-sub { font-size: 12px; color: var(--muted); }
.chat-ia { flex-shrink: 0; border-bottom: 1px solid var(--line); background: #fbfcfd;
  padding: 9px 16px; font-size: 12px; max-height: 20vh; overflow-y: auto; }
.chat-ia + .chat-ia { border-top: none; }

.chat-body { flex: 1; overflow-y: auto; min-height: 0; padding: 16px; background: var(--bg);
  display: flex; flex-direction: column; }
.chat-dia { align-self: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 12px; font-size: 11px; color: var(--muted); margin: 6px 0 12px; }

.msg { max-width: 74%; padding: 8px 12px 6px; border-radius: 12px; margin-bottom: 8px;
  font-size: 13.5px; line-height: 1.45; box-shadow: 0 1px 1px rgba(20,22,30,.06); }
.msg.in  { background: var(--panel); border-top-left-radius: 4px; align-self: flex-start; }
.msg.out { background: #e7f7ef; border-top-right-radius: 4px; align-self: flex-end; }  /* verde suave del propio sistema */
.msg .m-aut { font-size: 11px; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
/* pre-wrap SOLO en el texto: si se pone en .msg, la indentación de la plantilla se
   renderiza como espacios y saltos de línea reales y la burbuja sale enorme. */
.msg .m-txt { white-space: pre-wrap; word-break: break-word; }
.msg .m-hora { font-size: 10px; color: var(--muted); text-align: right; margin-top: 2px;
  font-family: var(--mono); letter-spacing: -0.02em; }

/* Cita: el mensaje al que se responde, dentro de la burbuja */
.m-cita { border-left: 3px solid var(--primary); background: rgba(0,0,0,.045);
  border-radius: 6px; padding: 5px 9px; margin-bottom: 5px; font-size: 12px; cursor: pointer; }
.m-cita:hover { background: rgba(0,0,0,.08); }
.m-cita b { display: block; color: var(--primary); font-size: 11px; margin-bottom: 1px; }
.m-cita span { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-reenv { font-size: 11px; color: var(--muted); font-style: italic; margin-bottom: 3px;
  display: flex; align-items: center; gap: 4px; }

/* Reacciones y etiquetas colgando de la burbuja */
.m-reacs { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.m-reac { background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 1px 7px; font-size: 12px; line-height: 1.5; box-shadow: 0 1px 1px rgba(20,22,30,.05); }
.m-reac.mia { border-color: var(--primary); background: var(--primary-soft); }
.m-etis { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.m-eti { font-size: 10.5px; font-weight: 600; color: #fff; border-radius: 999px; padding: 1px 8px; }
.m-fav { color: var(--warn); font-size: 12px; }

/* Barra de acciones que aparece al pasar por encima de un mensaje */
.msg-wrap { position: relative; display: flex; flex-direction: column; }
.msg-wrap.der { align-items: flex-end; }
/* La barra va en el hueco lateral que deja la burbuja (máx. 74% de ancho), no encima:
   si se coloca arriba tapa las etiquetas y reacciones del mensaje anterior. */
.msg-acc { position: absolute; top: 50%; transform: translateY(-50%); display: none; gap: 1px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  box-shadow: var(--shadow); padding: 2px; z-index: 5; }
.msg-wrap:hover .msg-acc { display: flex; }
.msg-wrap.der .msg-acc { left: 6px; }
.msg-wrap:not(.der) .msg-acc { right: 6px; }
.msg-acc button { border: none; background: none; padding: 4px 7px; border-radius: 999px;
  font-size: 13px; line-height: 1; color: var(--muted); }
.msg-acc button:hover { background: var(--bg); color: var(--primary); }
.msg-acc .ic { width: 14px; height: 14px; }

/* Menú emergente de reaccionar / etiquetar / reenviar */
/* fixed, no absolute: las coordenadas salen de getBoundingClientRect (relativas a la
   ventana) y además así el menú no se descoloca si la conversación se desplaza debajo. */
.pop { position: fixed; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 7px; z-index: 60; min-width: 180px; }
.pop-emojis { display: flex; gap: 2px; }
.pop-emojis button { border: none; background: none; font-size: 19px; padding: 4px 6px; border-radius: 8px; line-height: 1; }
.pop-emojis button:hover { background: var(--bg); transform: scale(1.15); }
.pop-lista { max-height: 230px; overflow-y: auto; }
.pop-lista button { display: flex; align-items: center; gap: 8px; width: 100%; border: none;
  background: none; padding: 7px 9px; border-radius: 8px; font-size: 12.5px; text-align: left; color: var(--text); }
.pop-lista button:hover { background: var(--bg); }
.pop-lista .punto { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.pop-lista .marca { margin-left: auto; color: var(--accent); font-weight: 700; }

/* Cita en el cuadro de respuesta, antes de enviar */
.resp-cita { display: flex; align-items: center; gap: 9px; background: var(--bg);
  border-left: 3px solid var(--primary); border-radius: 8px; padding: 7px 10px; margin-bottom: 8px; font-size: 12.5px; }
.resp-cita div { min-width: 0; }
.resp-cita b { display: block; font-size: 11px; color: var(--primary); }
.resp-cita span { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resp-cita .quitar { margin-left: auto; border: none; background: none; color: var(--muted); font-size: 15px; padding: 0 4px; }

/* Adjuntos dentro de la burbuja */
.m-img { max-width: 260px; max-height: 260px; border-radius: 8px; display: block; cursor: pointer; margin-bottom: 4px; }
.m-vid { max-width: 280px; border-radius: 8px; display: block; margin-bottom: 4px; }
.m-aud { width: 250px; height: 34px; margin-bottom: 4px; }
.m-doc { display: flex; gap: 9px; align-items: center; background: rgba(0,0,0,.045);
  border-radius: 8px; padding: 8px 10px; margin-bottom: 4px; cursor: pointer; max-width: 260px; }
.m-doc:hover { background: rgba(0,0,0,.08); }
.m-doc .ic { flex-shrink: 0; color: var(--primary); }
.m-doc-n { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-doc-s { font-size: 11px; color: var(--muted); }
.m-pend { font-size: 11.5px; color: var(--muted); font-style: italic; }

.chat-compose { border-top: 1px solid var(--line); padding: 10px 14px; flex-shrink: 0; }
.chat-adj { display: flex; align-items: center; gap: 9px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; margin-bottom: 8px; font-size: 12.5px; }
.chat-adj img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; }
.chat-adj .quitar { margin-left: auto; border: none; background: none; color: var(--muted); font-size: 15px; padding: 0 4px; }
.chat-adj .quitar:hover { color: var(--danger); }

/* Menú de adjuntar, anclado al botón + */
.adj-menu { position: absolute; bottom: 46px; left: 0; background: var(--panel);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 6px; min-width: 190px; z-index: 40; }
.adj-menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: none;
  background: none; padding: 9px 11px; border-radius: 8px; font-size: 13px; text-align: left; color: var(--text); }
.adj-menu button:hover { background: var(--bg); }
.adj-menu .ic { color: var(--primary); }
.chat-compose textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 11px; min-height: 44px; max-height: 120px; resize: vertical; }
.chat-vacio { flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: var(--muted); font-size: 13px; gap: 8px; text-align: center; padding: 20px; }
.chat-vacio .ic { width: 40px; height: 40px; opacity: .35; }

@media (max-width: 900px) {
  .ld-lista, .chat-list { width: 100%; }
  .ld.abierto .ld-lista, .chat-wrap.abierto .chat-list { display: none; }
  .ld:not(.abierto) .ld-panel, .chat-wrap:not(.abierto) .chat-pane { display: none; }
}

/* ---------- IA ----------
   El botón de borrador no es un primario (no envía nada, no es la acción principal del
   compositor) ni un secundario cualquiera: conviene que se lea como "esto lo escribe la
   máquina". Se resuelve como variante de .btn, no como clase nueva de botón. */
.btn-ia { border-color: #cfd6ff; color: #4453c7; background: #f5f6ff; }
.btn-ia:hover:not(:disabled) { background: #eceeff; border-color: #b4bdff; }
.btn-ia .ic { opacity: .85; }
.btn-ia.cargando { opacity: .7; cursor: default; }
.btn-ia.cargando .ic { animation: ia-late 1.1s ease-in-out infinite; }
@keyframes ia-late { 0%,100% { opacity: .3; } 50% { opacity: 1; } }

/* ---------- Interruptor de la IA ----------
   Apagada se ve como un botón cualquiera. Encendida tiene que cantar: mientras esté así
   la máquina le habla al cliente sin supervisión, y eso no puede pasar desapercibido en
   una cabecera llena de controles. */
.ia-sw { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--muted); }
.ia-sw:hover { border-color: var(--action); color: var(--action); }
.ia-sw .ic { opacity: .8; }
.ia-sw.on { background: #eef6f0; border-color: var(--accent); color: #1c7a4f; font-weight: 600; }
.ia-sw.on .ic { opacity: 1; }
.m-aut.m-ia { color: #1c7a4f; display: flex; align-items: center; gap: 4px; }

/* ---------- Diagnóstico de la cola ---------- */
.cola-tabla { width: 100%; border-collapse: collapse; font-size: 12px; }
.cola-tabla th { text-align: left; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.cola-tabla td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.cola-tabla td.err { color: var(--urgente); font-family: var(--mono); font-size: 11px; word-break: break-word; }
.cola-est { font-size: 10.5px; padding: 1px 7px; border-radius: 3px; font-weight: 600; }
.cola-est.done { background: #e9f5ee; color: #1c7a4f; }
.cola-est.failed { background: var(--urgente-soft); color: var(--urgente); }
.cola-est.pending { background: #fdf4e3; color: #8a5a12; }
.cola-est.processing { background: #eef2f8; color: #3d6494; }

/* ---------- Base de conocimiento ----------
   Reutiliza el layout .ld de la Bandeja; aquí solo va lo propio de un documento. */
.kb-buscar { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 7px 11px; font-size: 13px; }
.kb-carpeta { padding: 9px 13px 5px; font-size: 10.5px; letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--muted); background: #fafbfc; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; }
.kb-doc { display: flex; align-items: center; gap: 9px; padding: 9px 13px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.kb-doc:hover { background: #f8f9fb; }
.kb-doc.active { background: #eceef2; box-shadow: inset 3px 0 0 var(--action); }
.kb-doc .kb-t { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kb-doc.active .kb-t { font-weight: 600; }

/* Punto de estado: verde vigente, ámbar borrador, hueco pendiente de contenido. Es lo
   primero que se ve al recorrer la lista, antes de leer un solo título. */
.kb-pt { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.kb-pt.vigente   { background: var(--accent); }
.kb-pt.borrador  { background: var(--warn); }
.kb-pt.pendiente { background: transparent; border: 1.5px solid #ccd0d8; }

.kb-cab { padding: 14px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.kb-cab h3 { font-size: 16px; font-weight: 700; }
.kb-ruta { font-size: 11.5px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.kb-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 10px; font-size: 11.5px; color: var(--muted); }
.kb-cuerpo { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px 20px; background: var(--bg); }
.kb-ed { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; font-family: var(--mono);
  font-size: 13px; line-height: 1.65; resize: none; background: var(--panel); }
.kb-ed:focus { outline: none; border-color: var(--primary); }
.kb-ed[readonly] { background: #fafbfc; color: #55606e; }
.kb-pie { display: flex; align-items: center; gap: 10px; margin-top: 11px; flex-shrink: 0; font-size: 12px; color: var(--muted); }
.kb-sucio { color: var(--warn); font-weight: 600; }

/* ---------- Admin ---------- */
.admin-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.admin-section h3 { margin-bottom: 12px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.simple th, table.simple td { text-align: left; padding: 7px 9px; border-bottom: 1px solid var(--line); }
.switch { width: 38px; height: 21px; background: #ccc; border-radius: 11px; border: none; position: relative; transition: .15s; }
.switch::after { content: ''; position: absolute; width: 17px; height: 17px; background: #fff; border-radius: 50%; top: 2px; left: 2px; transition: .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 19px; }

/* ---------- Login y formulario público ---------- */
.login-page, .form-page { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; background: linear-gradient(160deg, #111318, #2a2d35); padding: 40px 16px; }
.login-box, .pubform { background: #fff; border-radius: 18px; padding: 32px; width: 400px; max-width: 100%; margin-top: 4vh; }
.pubform { width: 520px; }
.login-logo { text-align: center; }
.login-logo img { width: 62px; height: 62px; border-radius: 50%; }
.login-box h1, .pubform h1 { text-align: center; font-size: 21px; margin-top: 8px; }
.pubform h1 img { width: 30px; height: 30px; border-radius: 50%; vertical-align: -6px; margin-right: 6px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.login-box label, .pubform label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.login-box input, .pubform input, .pubform select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; }
.login-error { background: #fdecee; color: var(--danger); border-radius: 8px; padding: 9px 12px; font-size: 13px; margin-bottom: 8px; }
.form-ok { text-align: center; padding: 26px 0; font-size: 16px; }
.req { color: var(--danger); font-weight: 700; }
#vt-fields { border-left: 3px solid #f3d5d6; padding-left: 12px; margin: 4px 0 4px 2px; }
.form-embed { background: #fff; }
.form-embed .pubform { width: 100%; margin: 0; border-radius: 0; box-shadow: none; padding: 18px 24px; }

/* Diseñador: avatar de color + iniciales */
.avatar.small.dz { color: #fff; font-weight: 700; }
.dz-name { font-size: 12.5px; margin: 0 6px 0 3px; }

/* Archivos como icono de documento */
.file-doc { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); cursor: pointer; padding: 3px 5px; border-radius: 6px; margin-right: 2px; }
.file-doc:hover { color: var(--primary); background: var(--primary-soft); }

/* Etiqueta de tablero en comentario global */
.cmt-tag { font-size: 10.5px; background: #eef0f4; color: #6b7078; border-radius: 8px; padding: 1px 7px; }

/* Login: selector de nombre */
.login-box select { width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }

/* ---------- Rendimiento individual ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.team-card { display: flex; align-items: center; gap: 11px; padding: 12px 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; }
.team-card:hover { border-color: var(--primary); background: #fffafa; }
.tc-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-role { font-size: 11.5px; color: var(--muted); }
.tc-go { margin-left: auto; font-size: 11.5px; color: var(--primary); white-space: nowrap; }
.perf-range { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.perf-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.perf-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.perf-chart { display: flex; gap: 8px; align-items: flex-end; height: 165px; overflow-x: auto; padding-bottom: 2px; }
.pc-week { flex: 1; min-width: 46px; display: flex; flex-direction: column; align-items: center; gap: 5px; height: 100%; justify-content: flex-end; }
.pc-bars { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.pc-bar { width: 11px; border-radius: 4px 4px 2px 2px; min-height: 2px; transition: height .3s; }
.pc-lbl { font-size: 10.5px; color: var(--muted); }

/* ---------- Gantt semanal ---------- */
.gantt { min-width: 920px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.gt-week { display: flex; align-items: stretch; border-top: 1px solid var(--line); }
.gt-week.gt-head { border-top: none; background: #faf9f8; }
.gt-wlabel { width: 132px; flex-shrink: 0; padding: 8px 12px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); }
.gt-wlabel b { font-size: 12.5px; }
.gt-wlabel span { color: var(--muted); font-size: 11px; }
.gt-track { position: relative; flex: 1; min-height: 42px; }
.gt-days, .gt-cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(7, 1fr); }
.gt-day { text-align: center; font-size: 11px; color: var(--muted); padding: 7px 0; font-weight: 600; }
.gt-cell { border-left: 1px solid var(--line); }
.gt-cell:first-child { border-left: none; }
.gt-cell.today { background: var(--primary-soft); }
.gt-bars { position: relative; z-index: 1; padding: 6px 8px 6px 0; }
.gt-bar { display: block; box-sizing: border-box; height: 20px; line-height: 20px; border-radius: 6px; color: #fff; font-size: 11px; padding: 0 8px; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.gt-empty { display: block; height: 24px; }

/* Modal del formulario de prospectos */
.form-modal { position: relative; width: 600px; max-width: 100%; padding: 0; overflow: hidden; }
.form-modal iframe { width: 100%; height: 80vh; border: 0; display: block; }
.form-modal .modal-close { position: absolute; top: 8px; right: 10px; z-index: 2; float: none; background: rgba(255,255,255,.95); box-shadow: 0 1px 5px rgba(0,0,0,.25); }

@media (max-width: 800px) {
  #app { flex-direction: column; height: auto; overflow: visible; }
  #sidebar { width: 100%; height: auto; position: relative; }
  #nav-boards { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav-sep { display: none; }
  #main { height: auto; }
  #content, #content.board-mode { overflow: visible; height: auto; }
  #board-body { overflow-x: auto; max-height: none; }
  .dash-grid { grid-template-columns: 1fr; }
  .detail-row { flex-direction: column; gap: 3px; }
  .person-card { grid-template-columns: 1fr; }
  .form-modal { width: 100%; }
  .form-modal iframe { height: 82vh; }
}

/* Reordenar columnas (solo admin) */
.board th.col-drag { cursor: grab; user-select: none; }
.board th.col-drag:active { cursor: grabbing; }
.board th.col-drop { box-shadow: inset 3px 0 0 0 var(--brand, #df2f4a); background: rgba(223,47,74,.06); }

/* Aviso flotante */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: #23252b; color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13.5px; z-index: 400; box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* Barra de totales bajo cada grupo */
table.board tfoot td { position: sticky; bottom: 0; background: #f7f8fa; border-top: 2px solid var(--line);
  font-weight: 700; font-size: 12.5px; padding: 7px 10px; white-space: nowrap; z-index: 3; }
table.board tfoot td.tot-lbl { left: 0; z-index: 5; color: var(--muted); font-weight: 600; }
table.board tfoot td.tot-val { color: var(--text); }

/* Mi trabajo (Inicio personalizado) */
.mi-card { margin-bottom: 16px; border-left: 3px solid var(--primary); }
.mi-card h3 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mi-sub { font-weight: 500; font-size: 12px; color: var(--muted); }
.mi-go { margin-left: auto; }
.mt-day { display: flex; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.mt-day:last-child { border-bottom: none; }
.mt-date { min-width: 54px; font-weight: 700; font-size: 12.5px; color: var(--muted); }
.mt-evs, .mt-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mt-ev { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; cursor: pointer; border: 1px solid transparent; }
.mt-ev:hover { filter: brightness(.96); }
.e-inst { background: #e8f2ff; color: #16437e; }
.e-fab  { background: #fff2e0; color: #8a4b00; }
.e-mat  { background: #eaf7ee; color: #1c6b34; }
.e-fact { background: #f1eefc; color: #4b2f9e; }
.e-late { background: #ffe9ec; color: #a01326; border-color: #f3c3cb; }
.mt-sec { padding: 8px 0; border-bottom: 1px solid var(--line); }
.mt-sec:last-child { border-bottom: none; }
.mt-sec-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.mt-count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: #e9ebf0; color: var(--muted); font-size: 12px; font-weight: 700; }
.mt-count.on { background: var(--primary); color: #fff; }
.mt-empty { font-size: 12.5px; color: var(--muted); }

/* Selector rápido de rango en "Mi rendimiento" */
.mi-rangos { display: flex; gap: 6px; flex-wrap: wrap; margin: 2px 0 12px; }
.e-task { background: #eef1f6; color: #40465a; }
.e-hoy  { background: #fff4cc; color: #7a5a00; border-color: #f0dc9a; }

/* Tablero sin acceso en el menú */
.nav-locked { opacity: .45; cursor: not-allowed; }
.nav-locked:hover { background: transparent; }

/* Calendario de producción (Inicio de Israel) */
.pcal-nav { display: inline-flex; gap: 4px; }
.pcal-head { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 6px 0 4px; }
.pcal-head div { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; text-align: center; }
.pcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pcal-day { min-height: 92px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; background: var(--panel); overflow: hidden; }
.pcal-day.empty { background: transparent; border-color: transparent; }
.pcal-day.hoy { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.pcal-num { font-size: 11.5px; font-weight: 700; color: var(--muted); margin-bottom: 3px; }
.pcal-ev { display: block; font-size: 10.5px; line-height: 1.35; padding: 2px 5px; margin-bottom: 2px; border-radius: 5px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcal-ev:hover { filter: brightness(.94); }
.pe-inst { background: #e8f2ff; color: #16437e; }
.pe-fab  { background: #fff2e0; color: #8a4b00; }
.pe-mat  { background: #eaf7ee; color: #1c6b34; }
.pcal-leg { display: flex; gap: 14px; margin-top: 10px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.pcal-leg i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
@media (max-width: 720px) { .pcal-day { min-height: 66px; } .pcal-ev { font-size: 9.5px; } }

/* Gantt de 5 días (Lun–Vie) y variante de letra grande — Inicio de Israel */
.pcal-wrap { overflow-x: auto; }
.gt-5 .gt-days, .gt-5 .gt-cells { grid-template-columns: repeat(5, 1fr); }
.gt-lg { min-width: 760px; }
.gt-lg .gt-track { min-height: 50px; }
.gt-lg .gt-day { font-size: 12.5px; }
.gt-lg .gt-wlabel { width: 148px; }
.gt-lg .gt-wlabel b { font-size: 14px; }
.gt-lg .gt-wlabel span { font-size: 12px; }
.gt-lg .gt-bar { font-size: 12.5px; height: 25px; line-height: 25px; font-weight: 600; margin: 3px 0; }
/* Fecha de instalación: más destacada */
.gt-lg .gt-bar.gt-inst { font-weight: 800; letter-spacing: .2px;
  box-shadow: 0 0 0 2px rgba(223,47,74,.28), 0 2px 4px rgba(0,0,0,.2); }

/* Número de día dentro de cada cuadro del Gantt (Inicio de Israel) */
.gt-5 .gt-cell { position: relative; }
.gt-dnum { position: absolute; top: 3px; left: 6px; font-size: 11.5px; font-weight: 700; color: var(--muted); pointer-events: none; }
.gt-dnum.hoy { color: var(--primary); }
.gt-lg .gt-bars { padding-top: 21px; }

/* Solo lectura + matriz de accesos */
.ro-chip { display: inline-block; margin-left: 8px; padding: 2px 9px; border-radius: 20px;
  background: #eef1f6; color: #40465a; font-size: 11.5px; font-weight: 600; }
.acc-tabla th { white-space: nowrap; font-size: 12px; }
.acc-tabla td { vertical-align: middle; }
.acc-sel { width: 118px; padding: 5px 8px; font-size: 12.5px; }

/* ==================== Cotizador ==================== */
.cot-wrap { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; overflow-y: auto; padding-bottom: 20px; }
.cot-form .panel-card { margin-bottom: 14px; }
.cot-form h3 { margin-bottom: 10px; }
.cot-add { display: flex; gap: 8px; margin-bottom: 10px; }
.cot-add select { flex: 1; min-width: 0; }
.cot-item { display: flex; align-items: center; gap: 6px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.cot-item:last-child { border-bottom: none; }
.cot-nom { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cot-nom small { color: var(--muted); }
.cot-n { width: 68px; padding: 4px 6px; font-size: 12.5px; }
.cot-x { color: var(--muted); font-size: 12px; }
.cot-row2 { display: flex; gap: 12px; margin-top: 10px; }
.cot-row2 label { flex: 1; font-size: 12.5px; color: var(--muted); }
.cot-row2 input { width: 100%; margin-top: 3px; }

.cot-total { position: sticky; top: 0; }
.ct-card { padding: 16px; }
.ct-card h4 { font-size: 12px; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; letter-spacing: .3px; }
.ct-final { text-align: center; padding: 6px 0 12px; border-bottom: 2px solid var(--line); }
.ct-lbl { font-size: 12px; color: var(--muted); }
.ct-big { font-size: 30px; font-weight: 800; color: var(--primary); line-height: 1.15; }
.ct-sub { font-size: 11.5px; color: var(--muted); }
.ct-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 3px 0; }
.ct-row.ct-dim { color: var(--muted); font-size: 12px; padding-left: 10px; }
.ct-sep { border-top: 1px solid var(--line); margin: 10px 0; }
.ct-pago { font-size: 12px; margin-bottom: 8px; }
.ct-pago b { font-size: 12.5px; }
.ct-pago div { color: var(--muted); padding-left: 8px; }
@media (max-width: 1100px) { .cot-wrap { grid-template-columns: 1fr; } .cot-total { position: static; } }

/* Cotizador v2 — filas manuales, extras y selector emergente */
.cot-elegir { margin-left: auto; }
.cot-form h3 { display: flex; align-items: center; gap: 8px; }
.cot-man { gap: 6px; }
.cot-med { flex: 1; min-width: 0; padding: 4px 8px; font-size: 12.5px; }
.cot-sub2 { font-size: 12px; font-weight: 700; color: var(--text); min-width: 62px; text-align: right; }

.cot-picker { width: 620px; max-width: 100%; display: flex; flex-direction: column; max-height: 88vh; }
.pk-hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.pk-list { overflow-y: auto; flex: 1; border: 1px solid var(--line); border-radius: 10px; }
.pk-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--line); }
.pk-row:last-child { border-bottom: none; }
.pk-row.on { background: rgba(223,47,74,.05); }
.pk-nom { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-nom small { color: var(--muted); font-size: 11px; }
.pk-precio { width: 74px; text-align: right; font-size: 12.5px; color: var(--muted); }
.pk-qty { display: flex; align-items: center; gap: 4px; }
.pk-qty button { width: 26px; height: 26px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 15px; line-height: 1; }
.pk-qty button:hover { background: #f2f3f5; }
.pk-input { width: 52px; text-align: center; padding: 4px; border: 1px solid var(--line); border-radius: 6px; font-size: 12.5px; }
.pk-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; }

/* Cotizador v3: puertas/espejos con Puerta #N + columna Cotizaciones aprobadas */
.cot-manrow { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; background: #fbfbfc; }
.cot-manhead { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cot-manhead b { font-size: 13px; }
.cot-manhead .cot-sub2 { margin-left: auto; font-weight: 700; color: var(--primary); font-size: 12.5px; }
.cot-manfields { display: flex; gap: 8px; flex-wrap: wrap; }
.cot-manfields label { flex: 1; min-width: 88px; font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 3px; }
.cot-manfields input, .cot-manfields select { width: 100%; padding: 5px 7px; font-size: 12.5px; }
.ct-row.ct-strong b { color: var(--primary); font-size: 14px; }

.cotiza-ver { display: inline-block; background: #eef1f6; color: #40465a; border-radius: 7px; padding: 2px 8px; margin: 1px 2px;
  font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.cotiza-ver:hover { filter: brightness(.96); }
.cotiza-ver.apr { background: #e8f7ee; color: #1c6b34; }

/* Página cotizar.php (sin sidebar) */
body.cot-standalone { background: var(--bg); }
body.cot-standalone #content { padding: 18px 22px; height: 100vh; overflow-y: auto; max-width: 1200px; margin: 0 auto; }

/* ==================== Orden de producción ==================== */
.op-bg-modal { padding: 0; align-items: stretch; justify-content: stretch; }
.op-wrap { display: flex; flex-direction: column; width: 100%; height: 100%; background: var(--bg); }
.op-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.op-hint { font-size: 12px; color: var(--muted); }
.op-sep { flex: 1; }
.op-scroll { flex: 1; overflow: auto; padding: 14px; display: flex; justify-content: center; align-items: flex-start; }
.op-holder { position: relative; }
.op-page { position: relative; width: 595.32px; height: 841.92px; background: #fff; color: #000;
  transform-origin: top left; box-shadow: 0 2px 18px rgba(0,0,0,.25); font-family: Arial, Helvetica, sans-serif; }
.op-bg, .op-ln, .op-t, .op-fr, .op-logo { position: absolute; }
.op-ln { background: #000; }
.op-t { display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.18;
  overflow: hidden; padding: 0 3px; box-sizing: border-box; white-space: pre-wrap; word-break: break-word; }
.op-ed { outline: none; cursor: text; }
.op-ed:hover { background: rgba(0,120,255,.09); }
.op-ed:focus { background: rgba(0,120,255,.15); box-shadow: inset 0 0 0 1px #0078ff; }
.op-logo { display: flex; align-items: center; justify-content: center; padding: 4px; }
.op-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.op-fr { overflow: hidden; }
.op-im { position: absolute; cursor: move; }
.op-im img { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-drag: none; }
.op-im:hover { outline: 1px dashed #0078ff; }
.op-im-x { position: absolute; top: 1px; right: 1px; width: 17px; height: 17px; padding: 0; border: 0;
  border-radius: 50%; background: #d9534f; color: #fff; font-size: 10px; line-height: 17px; cursor: pointer; opacity: 0; }
.op-im:hover .op-im-x { opacity: 1; }
.op-im-rz { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; background: #0078ff;
  border: 2px solid #fff; border-radius: 2px; cursor: nwse-resize; }
.op-add { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); font-size: 11px;
  padding: 4px 10px; border: 1px dashed #999; background: #fafafa; color: #555; border-radius: 4px; cursor: pointer; }
.op-fr:has(.op-im) .op-add { left: 4px; top: auto; bottom: 4px; transform: none; opacity: .55; }
.op-fr:has(.op-im) .op-add:hover { opacity: 1; }
.op-rowx { position: absolute; width: 11px; height: 9px; padding: 0; border: 0; border-radius: 2px;
  background: #d9534f; color: #fff; font-size: 9px; line-height: 9px; cursor: pointer; opacity: .22; }
.op-rowx:hover { opacity: 1; }

/* ==================== Lista de herrajes ==================== */
body.her-standalone { background: var(--bg); }
.her-bar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.her-bar .her-cli { font-weight: 600; color: var(--primary); }
.her-sep { flex: 1; }
.her-res { font-size: 12.5px; color: var(--muted); }
.her-res .her-falta { color: #d9534f; }
.her-estado { font-size: 12px; }
.her-sucio { color: #b45309; }
.her-ok { color: #12a150; }
.her-hoja-wrap { display: flex; justify-content: center; padding: 18px 12px 40px; }
.her-hoja { width: 780px; max-width: 100%; background: #fff; color: #000; padding: 20px;
  box-shadow: 0 2px 18px rgba(0,0,0,.18); border-radius: 4px; }
.her-tabla { width: 100%; border-collapse: collapse; font-size: 12px; }
.her-tabla td { border: 1px solid #000; padding: 3px 5px; vertical-align: middle; }
.her-et { background: #ff0; font-weight: 700; text-align: center; width: 14%; }
.her-val { text-align: center; }
.her-f { min-width: 74px; }
.her-banda { background: #c9e3bf; font-weight: 700; text-align: center; }
.her-th td, .her-tabla .her-th td { background: #c9e3bf; font-weight: 700; text-align: center; }
.her-cod { text-align: center; font-weight: 700; font-size: 14px; width: 18%; outline: none; }
.her-img { width: 29%; text-align: center; position: relative; cursor: pointer; height: 90px; }
.her-img img { max-width: 100%; max-height: 150px; display: block; margin: 0 auto; }
.her-ph { color: #999; font-size: 11px; }
.her-img-x { position: absolute; top: 2px; right: 2px; border: 0; background: #d9534f; color: #fff;
  width: 16px; height: 16px; border-radius: 50%; font-size: 9px; cursor: pointer; padding: 0; opacity: 0; }
.her-img:hover .her-img-x { opacity: 1; }
.her-her { text-align: center; }
.her-pick { cursor: pointer; }
.her-pick:hover { color: var(--primary); text-decoration: underline; }
.her-pick i { color: #999; }
.her-st { display: block; font-size: 9.5px; color: #777; }
.her-cant { text-align: center; width: 9%; outline: none; }
.her-sem { text-align: center; width: 13%; font-weight: 600; position: relative; }
.her-ok2, .her-sem.her-ok { background: #57c459; }
.her-sem.her-no { background: #ef3939; }
.her-fx { position: absolute; right: 1px; top: 3px; border: 0; background: transparent; color: #555;
  font-size: 10px; cursor: pointer; opacity: 0; }
.her-fila:hover .her-fx { opacity: 1; }
.her-addrow td { border: 0; padding: 4px 0 10px; }
.her-esp { margin-top: 18px; }
.her-banda-esp { display: flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid #000; }
.her-esp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 8px; }
.her-esp-card { border: 1px solid #000; padding: 6px; display: flex; flex-direction: column; gap: 5px;
  min-width: 0; box-sizing: border-box; }
.her-esp-card > * { min-width: 0; }
.her-esp-card .row { display: flex; gap: 5px; min-width: 0; }
.her-esp-card .row .search-box { flex: 1; min-width: 0; }
.her-esp-img { height: 82px; display: flex; align-items: center; justify-content: center; cursor: pointer; background: #fafafa; }
.her-esp-img img { max-width: 100%; max-height: 82px; }
.her-esp-card .search-box { font-size: 11px; padding: 4px 6px; width: 100%; min-width: 0; box-sizing: border-box; }
.her-esp-grid { min-width: 0; }
.her-esp-img img { object-fit: contain; }
.her-vacio { grid-column: 1/-1; color: #888; font-size: 12px; padding: 10px; text-align: center; }
.her-notas { margin-top: 16px; border: 1px solid #000; padding: 8px; }
.her-nota-txt { min-height: 40px; outline: none; font-size: 12px; margin-top: 4px; }
.hp-lista { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.hp-op { padding: 7px 10px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 13px; }
.hp-op:hover { background: var(--primary-soft); }
.hp-meta { display: block; font-size: 11px; color: var(--muted); }
@media (max-width: 820px) { .her-esp-grid { grid-template-columns: repeat(2, 1fr); } }
.her-aviso { font-size: 13px; display: flex; flex-direction: column; gap: 9px; margin-top: 6px; }
.her-aviso .ha-ok { display: flex; align-items: flex-start; gap: 7px; }
.her-aviso .ha-mal { background: #fdecea; border-left: 3px solid #d9534f; padding: 8px 10px; border-radius: 5px; }
.her-aviso .ha-mal ul { margin: 5px 0 0 16px; }
.mirror-na { color: #b9bcc4; font-size: 11px; font-style: italic; white-space: nowrap; }
/* Lista general de herrajes: hoja de pedido antes de imprimir */
.lg-modal { width: 880px; }
.lg-tabla { margin-top: 6px; }
.lg-tabla th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); }
.lg-tabla td.num, .lg-tabla th.num { text-align: right; }
.lg-tabla .lg-det { color: var(--muted); font-size: 12.5px; }
.lg-tabla .lg-no { color: var(--danger); font-weight: 700; }
.lg-tabla .lg-ok { color: var(--accent); font-weight: 700; }
.lg-inp { width: 74px; text-align: right; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font: inherit; font-weight: 700; }
.lg-inp:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 2px var(--primary-soft); }
.lg-inp:disabled { background: #f5f6f8; color: var(--muted); font-weight: 400; }
.lg-sub { font-size: 14px; margin: 18px 0 2px; }
.lg-pie { display: flex; align-items: center; gap: 9px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }

/* ---------- Inventario: contador rapido ----------
   Filas altas y botones grandes: esto se usa de pie en la fabrica y muchas veces
   desde una tablet. El contador de la fila sustituye a la ventana de ingreso/egreso;
   los toques se acumulan y se guardan como UN movimiento (ver assets/inv.js). */
.inv-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.inv-cab h1 { font-size: 22px; display: flex; align-items: center; gap: 9px; }
.inv-res { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); margin-top: 5px; }
.inv-res i { color: #d7dae2; font-style: normal; }
.inv-res b { font-weight: 400; }
.inv-res b.malo { color: #a01326; font-weight: 600; }

.inv-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.inv-bar .rg-sep { width: 1px; height: 26px; background: var(--border, #e2e4ea); margin: 0 4px; }
.inv-tb { height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); font-size: 14.5px; display: inline-flex; align-items: center; gap: 8px; }
.inv-tb:hover { border-color: #c9ccd4; }
.inv-tb.on { background: var(--action); border-color: var(--action); color: #fff; font-weight: 600; }
.inv-tb.on:hover { background: var(--action-2); border-color: var(--action-2); }
.inv-busca { position: relative; flex: 1; color: var(--muted); }
.inv-busca svg { position: absolute; left: 14px; top: 14px; pointer-events: none; }
.inv-busca input { width: 100%; height: 46px; padding: 0 14px 0 42px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); font-family: inherit; font-size: 14.5px; color: var(--text); }
.inv-busca input:focus { outline: 2px solid #f5c6c9; border-color: var(--primary); }

.inv-tabla { padding: 0; overflow: hidden; }
.inv-fila { display: grid; grid-template-columns: 1fr 236px 120px 104px; align-items: center; gap: 16px;
  padding: 0 18px; height: 72px; border-bottom: 1px solid #f0f1f5; }
.inv-fila:last-child { border-bottom: none; }
.inv-fila.baja { background: #fff5f6; box-shadow: inset 3px 0 0 var(--danger); }
.inv-fila.pend { grid-template-columns: 1fr 236px 240px; background: #fffaf0;
  box-shadow: inset 3px 0 0 var(--warn); position: relative; }
.inv-th { height: 44px; border-bottom: 1px solid var(--border, #e2e4ea); color: var(--muted); font-size: 11.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.inv-art { font-size: 15.5px; font-weight: 600; }
.inv-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.inv-vacio { padding: 22px 18px; color: var(--muted); }

.inv-conpaso { display: flex; align-items: center; gap: 10px; }
.inv-step { display: flex; align-items: center; border: 1px solid #d7dae2; border-radius: 12px;
  background: var(--panel); overflow: hidden; height: 52px; flex: 1; }
.inv-step.baja { border-color: #e3a7ab; }
.inv-step.act { border-color: #f0b862; box-shadow: 0 0 0 3px rgba(253,171,61,.16); }
.inv-step button { width: 56px; height: 100%; border: none; background: var(--panel);
  display: inline-flex; align-items: center; justify-content: center; }
.inv-step button.men { border-right: 1px solid #eceef3; color: var(--urgente); }
.inv-step button.mas { border-left: 1px solid #eceef3; color: #0a7a4f; }
.inv-step button:hover:not(:disabled) { background: #f7f8fb; }
.inv-step button:disabled { opacity: .32; cursor: default; }
.inv-step button.val { flex: 1; width: auto; font-family: inherit; font-size: 20px; font-weight: 700;
  color: inherit; font-variant-numeric: tabular-nums; }
.inv-solo { font-size: 20px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

.inv-delta { font-size: 13.5px; font-weight: 700; border-radius: 8px; padding: 3px 9px; font-variant-numeric: tabular-nums; }
.inv-delta.mas { background: #effaf5; color: #0a7a4f; border: 1px solid #bfe9d5; }
.inv-delta.men { background: var(--urgente-soft); color: var(--urgente); border: 1px solid #f3c9cf; }

.inv-acc { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }
.inv-mini { width: 44px; height: 44px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.inv-mini:hover { border-color: #c9ccd4; color: var(--text); }
.inv-guardar { height: 44px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--action);
  background: var(--action); color: #fff; font-family: inherit; font-size: 14px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.inv-guardar:disabled { opacity: .6; cursor: default; }
.inv-cancel { width: 44px; height: 44px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.inv-barra { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--warn);
  animation: inv-cuenta 3s linear forwards; }
@keyframes inv-cuenta { from { width: 100%; } to { width: 0; } }

.pill-cero { display: inline-block; background: var(--urgente); color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; white-space: nowrap; }

/* Aviso de lo ultimo guardado, con Deshacer */
.inv-aviso { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px); background: var(--action);
  color: #fff; border-radius: 12px; padding: 13px 18px; font-size: 14px; z-index: 420; display: none;
  align-items: center; gap: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.inv-aviso.ver { display: flex; transform: translate(-50%, 0); }
.inv-aviso .ok { color: var(--accent); display: inline-flex; }
.inv-aviso button { height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid #4a5262;
  background: transparent; color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600; }
.inv-aviso button:hover { background: #333b48; }
.inv-aviso button:disabled { opacity: .5; }

/* Cantidad exacta */
.inv-modal { width: 460px; }
.inv-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.inv-seg button { height: 52px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel);
  font-family: inherit; font-size: 15px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.inv-seg button.ing.on { border-color: #bfe9d5; background: #effaf5; color: #0a7a4f; }
.inv-seg button.egr.on { border-color: #f3c9cf; background: var(--urgente-soft); color: var(--urgente); }
.inv-lbl { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; margin: 18px 0 8px; }
.inv-cant { width: 100%; height: 76px; border-radius: 12px; border: 1px solid #d7dae2; background: var(--panel);
  font-family: inherit; font-size: 34px; font-weight: 800; padding: 0 20px; color: var(--text); }
.inv-cant:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(38,45,56,.09); }
.inv-prev { display: flex; align-items: center; gap: 14px; margin-top: 16px; padding: 14px 18px;
  border-radius: 12px; background: #f7f8fb; border: 1px solid var(--line); }
.inv-prev span { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .02em; }
.inv-prev b { font-size: 20px; font-variant-numeric: tabular-nums; }
.inv-prev b.bajo { color: var(--urgente); }
.inv-prev b.malo { color: var(--muted); }
.inv-prev .fl { color: var(--muted); font-size: 18px; }
.inv-prev .mn { margin-left: auto; font-size: 13px; color: var(--muted); }
.inv-ok { height: 56px; border-radius: 12px; border: 1px solid var(--action); background: var(--action); color: #fff;
  font-family: inherit; font-size: 16px; font-weight: 700; display: inline-flex; align-items: center;
  justify-content: center; gap: 10px; }
.inv-ok:disabled { opacity: .5; cursor: default; }
.inv-no { height: 56px; padding: 0 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  font-family: inherit; font-size: 15px; color: var(--text); }
.inv-baja { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* ---------- Intención de compra ----------
   El único verde fuerte de la Bandeja. Rojo = el cliente escribió y nadie le contestó;
   verde = el cliente quiere comprar y la IA ya le dijo que un diseñador le escribe. Son las
   dos cosas que se miran primero, y no pueden confundirse entre sí. */
:root { --venta: #16794a; --venta-soft: #e8f5ee; }
.res.venta { border-color: var(--venta); background: var(--venta-soft); }
.res.venta .n { color: var(--venta); font-weight: 600; }
.res.cliqueable.venta.on, .res.cliqueable.on#res-int { border-color: var(--venta); background: var(--venta-soft);
  box-shadow: inset 0 0 0 1px var(--venta); }
.chat-filtro.venta { border-color: var(--venta); color: var(--venta); font-weight: 600; }
.chat-filtro.venta.on { background: var(--venta); border-color: var(--venta); color: #fff; }
.chat-item.venta, .chat-item.venta.active { box-shadow: inset 3px 0 0 var(--venta); }
.ci-venta { background: var(--venta-soft); color: var(--venta); font-weight: 700; }
.chat-venta { flex-shrink: 0; display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  font-size: 12.5px; background: var(--venta-soft); border-bottom: 1px solid #cfe8da; color: #0f5133; }
.chat-venta .ic { color: var(--venta); flex-shrink: 0; }
.chat-venta .btn { margin-left: auto; flex-shrink: 0; }

/* Cabecera de la Bandeja con el interruptor general de la IA a la derecha. */
.chat-top { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
#chat-ia-modo { margin-left: auto; }
.ia-modo { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.ia-modo .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: var(--panel); }
.ia-modo .seg button { border: none; background: none; padding: 5px 12px; font-size: 12px; color: var(--muted); }
.ia-modo .seg button + button { border-left: 1px solid var(--line); }
.ia-modo .seg button:hover { color: var(--action); }
.ia-modo .seg button.on { background: var(--action); color: #fff; font-weight: 600; }
.ia-modo .seg button.on.apagada { background: var(--urgente); }
.ia-modo .seg button.on.nuevos { background: var(--venta); }
.ia-modo .btn.falta { border-color: var(--warn); color: #8a5a12; }
