/* Bandeja Penta · diseño con la identidad de New Penta (rojo #E1111B, verde #07924B) */
:root {
  --rojo: #e1111b; --rojo-osc: #b30d15; --rojo-suave: #fdeced; --rojo-borde: #f7c4c6;
  --verde: #07924b; --verde-osc: #056b37; --verde-suave: #e6f5ec;
  --ambar: #d97706; --ambar-suave: #fff4e0; --azul: #1d5fbf; --azul-suave: #e8f0fc;
  --bg: #f5f2f1; --panel: #ffffff; --line: #ece6e5; --line-2: #e0d8d7; --text: #23191a; --muted: #786a6b;
  --brand: var(--rojo); --brand-soft: var(--rojo-suave); --danger: #c81e1e; --danger-soft: #fdecec;
  --in: #ffffff; --out: #e3f4ea; --note: #fff6d6; --sys: #f1ecea; --warn: #b45309;
  --radius: 14px; --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(60, 20, 20, .06), 0 1px 3px rgba(60, 20, 20, .05);
  --shadow: 0 10px 30px rgba(60, 20, 20, .14);
  --franja: linear-gradient(90deg, var(--verde) 0 33.3%, #fff 33.3% 66.6%, var(--rojo) 66.6% 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--text); background: var(--bg); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 8px 10px; background: #fff; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--rojo); box-shadow: 0 0 0 3px rgba(225, 17, 27, .12); }
input[type=checkbox] { accent-color: var(--rojo); }
textarea { resize: vertical; }
a { color: var(--rojo); }
h2 { font-size: 22px; letter-spacing: -.01em; }

.btn { border: 1px solid var(--line-2); background: #fff; border-radius: var(--radius-sm); padding: 8px 14px; cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { border-color: #cdbfbe; background: #fcfafa; }
.btn.primary { background: var(--rojo); color: #fff; border-color: var(--rojo); box-shadow: 0 2px 6px rgba(225, 17, 27, .25); }
.btn.primary:hover { background: var(--rojo-osc); border-color: var(--rojo-osc); }
.btn.danger { color: var(--danger); border-color: var(--rojo-borde); }
.btn.small { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; cursor: pointer; font-size: 18px; position: relative; padding: 8px; border-radius: 12px; }
.icon-btn:hover { background: var(--rojo-suave); }

/* ---------- Pantalla de carga ---------- */
.cargando { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 10px; background: var(--bg); z-index: 70; }
.cargando img { width: 240px; max-width: 70vw; animation: latido 1.6s ease-in-out infinite; }
@keyframes latido { 0%, 100% { opacity: .55; transform: scale(.98); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- Inicio de sesión ---------- */
.login { display: grid; place-items: center; height: 100%; padding: 16px;
  background: radial-gradient(1200px 600px at 10% -10%, #fff 0, transparent 60%), linear-gradient(160deg, #fbe9ea 0%, #f5f2f1 55%, #e9f4ee 100%); }
.login-card { background: #fff; padding: 0 32px 28px; border-radius: 20px; width: min(400px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); overflow: hidden; }
.login-card::before { content: ""; height: 6px; margin: 0 -32px 6px; background: var(--franja); }
.login-logo { width: 230px; max-width: 80%; justify-self: center; margin-top: 8px; }
.login-card h1 { margin: 0; color: var(--text); font-size: 20px; text-align: center; }
.login-card p.muted { text-align: center; margin: -8px 0 4px; }
.login-card label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.login-card .btn.primary { padding: 11px; font-size: 15px; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: 92px 1fr; height: 100%; }
.nav { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; padding: 12px 8px; gap: 4px; position: relative; }
.nav::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, var(--verde) 0 33.3%, #fff 33.3% 66.6%, var(--rojo) 66.6% 100%); }
.nav .brand { display: grid; place-items: center; margin: 2px 0 12px; }
.nav .brand img { width: 52px; height: 52px; filter: drop-shadow(0 2px 4px rgba(225, 17, 27, .25)); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 4px; cursor: pointer; font-size: 20px; position: relative; text-decoration: none; color: var(--muted); border-radius: 14px; transition: background .15s, color .15s; }
.nav a span { font-size: 11px; font-weight: 600; }
.nav a:hover { background: #faf5f5; color: var(--text); }
.nav a.active { background: var(--rojo-suave); color: var(--rojo); box-shadow: inset 0 0 0 1px var(--rojo-borde); }
.nav-bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.badge { position: absolute; top: 3px; right: 8px; background: var(--rojo); color: #fff; border-radius: 9px; font-size: 10px; padding: 0 5px; min-width: 17px; text-align: center; font-style: normal; font-weight: 700; box-shadow: 0 0 0 2px #fff; }
.badge.red { background: var(--rojo); }
.badge:empty { display: none; }
.switch { position: relative; width: 40px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #c9bdbc; border-radius: 22px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--verde); }
.switch input:checked + span::before { transform: translateX(18px); }

main { min-width: 0; height: 100%; overflow: hidden; }
.view { height: 100%; }
.page { overflow: auto; padding: 22px 28px; }
.page > p.muted { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--verde); border-radius: var(--radius-sm); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; padding: 14px 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.page-head::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--rojo); }
.page-head h2 { margin: 0; }
.drawer .page-head, .modal-card .page-head { box-shadow: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.card h3 { color: var(--text); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card h3::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--rojo); flex: none; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-grid label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.form-grid .full { grid-column: 1 / -1; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters.row { margin-bottom: 14px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.filters input { flex: 1 1 160px; }

/* Pestañas en forma de píldora */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; padding: 4px; background: #efe9e8; border-radius: 12px; width: fit-content; max-width: 100%; }
.tabs button { background: none; border: 0; padding: 7px 12px; cursor: pointer; border-radius: 9px; color: var(--muted); font-weight: 500; transition: background .15s, color .15s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { background: #fff; color: var(--rojo); font-weight: 600; box-shadow: var(--shadow-sm); }
.tabs b { font-weight: 700; font-size: 11px; background: var(--rojo); color: #fff; border-radius: 8px; padding: 0 6px; margin-left: 2px; }
.tabs b:empty { display: none; }

.table-wrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { background: #faf6f5; font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clic { cursor: pointer; }
.table tr.clic:hover td { background: #fdf6f6; }
.card .table th { background: transparent; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }

.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--sys); color: var(--text); margin: 1px 2px 1px 0; white-space: nowrap; }
.chip.tipo-medico { background: var(--azul-suave); color: var(--azul); }
.chip.tipo-distribuidor { background: #f1eafe; color: #5b21b6; }
.chip.tipo-paciente { background: var(--verde-suave); color: var(--verde-osc); }
.chip.tipo-desconocido, .chip.tipo-prospecto { background: var(--ambar-suave); color: #92400e; }
.chip.tipo-proveedor, .chip.tipo-interno { background: #ebe7e6; color: #4b4142; }
.chip.red { background: var(--rojo-suave); color: var(--rojo-osc); }
.chip.ok { background: var(--verde-suave); color: var(--verde-osc); }

/* ---------- Bandeja ---------- */
.inbox { display: grid; grid-template-columns: 360px 1fr 330px; gap: 12px; padding: 12px; }
.list-pane, .chat-pane, .info-pane { border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--line); overflow: hidden; }
.list-pane { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.list-head { padding: 12px 12px 10px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #fff, #fcf8f8); }
.list-head .tabs { margin-bottom: 10px; width: 100%; }
.list-head .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.list-head .tabs button { padding: 6px 7px; font-size: 12.5px; flex: 1 0 auto; white-space: nowrap; }
.filters select { flex: 1 1 90px; }
.conv-list { list-style: none; margin: 0; padding: 8px; overflow: auto; flex: 1; display: grid; gap: 6px; align-content: start; background: #fbf8f7; }
.conv-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; display: grid; gap: 3px; background: #fff; transition: border-color .15s, box-shadow .15s, transform .1s; }
.conv-list li:hover { border-color: var(--rojo-borde); box-shadow: var(--shadow-sm); }
.conv-list li.active { border-color: var(--rojo); background: var(--rojo-suave); box-shadow: 0 0 0 1px var(--rojo) inset; }
.conv-list .top { display: flex; justify-content: space-between; gap: 6px; }
.conv-list .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-list .time { font-size: 11px; color: var(--muted); white-space: nowrap; }
.conv-list .preview { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-list .meta { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.conv-list .unread { background: var(--verde); color: #fff; border-radius: 9px; font-size: 11px; font-weight: 700; padding: 0 7px; }
.conv-list li.vencido { border-left: 4px solid var(--rojo); }

.chat-pane { display: flex; flex-direction: column; min-height: 0;
  background: #f4eeec url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44'%3E%3Cpath d='M22 6l7 5-2.7 8h-8.6L15 11z' fill='none' stroke='%23e8d9d7' stroke-width='1'/%3E%3C/svg%3E"); }
.chat-pane .empty { margin: auto; color: var(--muted); text-align: center; display: grid; gap: 10px; justify-items: center; }
.chat-pane .empty::before { content: ""; width: 220px; height: 118px; background: url("img/logo-newpenta.svg") center/contain no-repeat; opacity: .35; }
.chat-head { background: var(--panel); padding: 10px 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; position: relative; }
.chat-head::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: var(--franja); opacity: .9; }
.chat-head .title { font-weight: 700; font-size: 16px; }
.chat-head .grow { flex: 1; }
.chat-head select { max-width: 170px; }
.messages { flex: 1; overflow: auto; padding: 16px 6%; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 72%; padding: 8px 11px 5px; border-radius: 12px; box-shadow: 0 1px 1px rgba(60,20,20,.08); white-space: pre-wrap; word-wrap: break-word; }
.msg.entrante { background: var(--in); align-self: flex-start; border-top-left-radius: 4px; }
.msg.saliente { background: var(--out); align-self: flex-end; border-top-right-radius: 4px; }
.msg.nota { background: var(--note); align-self: flex-end; border: 1px dashed #e5c35a; }
.msg.sistema { background: rgba(255,255,255,.75); align-self: center; font-size: 12px; color: var(--muted); max-width: 90%; text-align: center; box-shadow: none; border-radius: 999px; padding: 3px 12px; }
.msg .foot { font-size: 11px; color: var(--muted); text-align: right; margin-top: 2px; display: flex; gap: 6px; justify-content: flex-end; }
.msg .who { font-size: 11px; font-weight: 700; color: var(--rojo); }
.msg.saliente .who { color: var(--verde-osc); }
.msg .foot .tick { color: #8696a0; font-weight: 700; letter-spacing: -2px; }
.msg .foot .tick.visto { color: #34b7f1; }
.msg.fallido { border: 1px solid #fca5a5; }
.msg .err { color: var(--danger); font-size: 12px; }
.msg img { max-width: 260px; border-radius: 8px; display: block; }
.day-sep { align-self: center; font-size: 11px; font-weight: 600; background: #fff; border-radius: 999px; padding: 3px 12px; color: var(--muted); margin: 8px 0; box-shadow: var(--shadow-sm); text-transform: capitalize; }

.composer { background: var(--panel); border-top: 1px solid var(--line); padding: 10px 12px; display: grid; gap: 8px; position: relative; }
.composer .modes { display: flex; gap: 4px; align-items: center; }
.composer .modes button { background: none; border: 0; padding: 5px 12px; border-radius: 999px; cursor: pointer; color: var(--muted); font-weight: 500; }
.composer .modes button.active { background: var(--rojo-suave); color: var(--rojo); font-weight: 700; }
.composer .modes button.nota.active { background: var(--note); color: #92400e; }
.composer .row { display: flex; gap: 6px; align-items: flex-end; }
.composer > textarea { width: 100%; min-height: 170px; max-height: 55vh; border-radius: 12px; line-height: 1.55; padding: 12px 14px; white-space: pre-wrap; }
.composer .row { align-items: center; }
.composer .txt-cuenta { font-size: 12px; margin-left: 4px; }
.composer #btn-send { margin-left: auto; }
.composer.nota textarea { background: #fffbeb; }
.window-closed { background: var(--ambar-suave); color: #9a3412; padding: 9px 12px; border-radius: 10px; font-size: 13px; display: flex; justify-content: space-between; align-items: center; gap: 8px; border: 1px solid #fcd9a6; }
.qr-pop { position: absolute; bottom: 100%; left: 10px; right: 10px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); max-height: 220px; overflow: auto; }
.qr-pop div { padding: 7px 12px; cursor: pointer; }
.qr-pop div:hover, .qr-pop div.sel { background: var(--rojo-suave); }

.info-pane { background: var(--panel); overflow: auto; padding: 16px; }
.info-pane h3 { margin: 0 0 2px; font-size: 17px; }
.info-pane h4 { margin: 18px 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--rojo); display: flex; align-items: center; gap: 8px; }
.info-pane h4::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.info-pane .field { display: grid; gap: 3px; margin-bottom: 9px; font-size: 13px; }
.info-pane .field span { color: var(--muted); font-size: 12px; }
.req { border: 1px solid var(--line); border-left: 4px solid var(--azul); border-radius: 10px; padding: 9px 10px; margin-bottom: 8px; font-size: 13px; background: #fff; }
.req.vencida { border-color: #f5b5b7; border-left-color: var(--rojo); background: #fff7f7; }
.req.resuelta { opacity: .6; border-left-color: var(--verde); }
.req .top { display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.sugeridas { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.sugeridas button { border: 1px dashed var(--rojo); background: var(--rojo-suave); color: var(--rojo-osc); border-radius: 999px; font-size: 12px; padding: 3px 10px; cursor: pointer; }
.odoo-box { background: #faf7f6; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.odoo-box table { width: 100%; font-size: 12px; border-collapse: collapse; }
.odoo-box td { padding: 4px 2px; border-bottom: 1px solid var(--line); }

/* ---------- Modal, panel lateral y aviso ---------- */
.modal { position: fixed; inset: 0; background: rgba(35, 15, 15, .45); display: grid; place-items: center; z-index: 50; padding: 16px; backdrop-filter: blur(2px); }
.modal-card { background: #fff; border-radius: 18px; padding: 0 22px 22px; width: min(660px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-card::before { content: ""; display: block; height: 5px; margin: 0 -22px 18px; background: var(--franja); }
.modal-card h3 { margin-top: 0; }
.modal-card .actions { justify-content: flex-end; margin-top: 16px; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); box-shadow: var(--shadow); z-index: 40; overflow: auto; padding: 14px; }
.drawer .notif { padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-size: 13px; background: #fff; margin-bottom: 8px; }
.drawer .notif.unread { border-left: 4px solid var(--rojo); background: #fff; font-weight: 600; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #2b1f20; color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 60; max-width: 90vw; box-shadow: var(--shadow); border-left: 4px solid var(--verde); }
.toast.err { background: var(--danger); border-left-color: #fff; }

/* Recuadros de indicadores con color */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { --c: var(--rojo); --s: var(--rojo-suave); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 4px; background: var(--c); }
.kpi::after { content: ""; position: absolute; right: -18px; bottom: -18px; width: 70px; height: 70px; border-radius: 50%; background: var(--s); }
.kpi:nth-child(4n+2) { --c: var(--verde); --s: var(--verde-suave); }
.kpi:nth-child(4n+3) { --c: var(--ambar); --s: var(--ambar-suave); }
.kpi:nth-child(4n+4) { --c: var(--azul); --s: var(--azul-suave); }
.kpi b { display: block; font-size: 28px; color: var(--c); position: relative; z-index: 1; }
.kpi span { color: var(--muted); font-size: 12px; position: relative; z-index: 1; }
.bar { height: 8px; background: var(--sys); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--rojo); border-radius: 4px; }
.back { display: none; }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) { .inbox { grid-template-columns: 320px 1fr; } .info-pane { display: none; } .inbox.show-info .info-pane { display: block; position: fixed; right: 0; top: 0; bottom: 0; width: min(340px, 100%); z-index: 30; box-shadow: var(--shadow); border-radius: 0; } }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr 60px; }
  .nav { order: 2; flex-direction: row; padding: 4px; overflow-x: auto; border-right: 0; border-top: 1px solid var(--line); }
  .nav::before { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 3px; background: var(--franja); }
  .nav .brand, .nav a span, .nav-bottom .switch { display: none; }
  .nav a { flex: 1; justify-content: center; border-radius: 12px; }
  .nav-bottom { flex-direction: row; margin: 0; padding: 0 6px; }
  .inbox { grid-template-columns: 1fr; padding: 8px; gap: 8px; }
  .inbox .chat-pane { display: none; }
  .inbox.chat-open .list-pane { display: none; }
  .inbox.chat-open .chat-pane { display: flex; }
  .back { display: inline-block; }
  .page { padding: 12px; }
  .page-head { padding: 12px 14px; }
  .tabs { width: 100%; }
  .msg { max-width: 88%; }
  .messages { padding: 10px; }
}

/* =====================================================================
   Diseño profesional: buscadores, filtros, avatares y estados
   ===================================================================== */
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }

/* Buscador con lupa y botón para borrar */
.search { position: relative; display: flex; align-items: center; flex: 1 1 200px; min-width: 0; }
.search .ico { position: absolute; left: 11px; width: 17px; height: 17px; fill: none; stroke: var(--muted); stroke-width: 2.2; stroke-linecap: round; pointer-events: none; }
.search input { width: 100%; padding: 10px 34px 10px 36px; border-radius: 12px; background: #faf7f6; border-color: var(--line-2); font-size: 14px; }
.search input:focus { background: #fff; }
.search input:focus + .search-clear, .search .search-clear { position: absolute; right: 6px; }
.search-clear { display: none; border: 0; background: #e9e1e0; color: var(--muted); width: 22px; height: 22px; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 22px; padding: 0; }
.search-clear:hover { background: var(--rojo); color: #fff; }
.search.con-texto .search-clear { display: block; }
.list-head .search { margin-bottom: 8px; }

/* Campos de filtro con su etiqueta arriba */
.fld { display: grid; gap: 4px; min-width: 0; }
.fld > span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.fld select, .fld input { width: 100%; }
.filter-card .fld select, .filter-card .search input { height: 42px; }
.filter-card .search input { padding-top: 0; padding-bottom: 0; }
.filters.compact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.filter-card { display: grid; grid-template-columns: minmax(260px, 2.2fr) repeat(3, minmax(140px, 1fr)) auto; gap: 12px; align-items: end; padding: 14px 16px; margin-bottom: 10px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--rojo); }
.btn.ghost:hover { background: var(--rojo-suave); }
.results-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 4px 10px; font-size: 13px; color: var(--muted); }
.results-bar b { color: var(--text); }
.page-head .actions .fld > span { font-size: 10px; }

/* Título de la bandeja */
.list-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.list-title h2 { font-size: 17px; margin: 0; }
.count-pill { font-size: 12px; font-weight: 700; color: var(--rojo); background: var(--rojo-suave); border-radius: 999px; padding: 2px 10px; }
.count-pill:empty { display: none; }

/* Avatares con iniciales */
.avatar { width: 38px; height: 38px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; letter-spacing: .02em; box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.conv-list li[data-id] { grid-template-columns: 38px 1fr; align-items: start; column-gap: 10px; }
.conv-list li .cuerpo { display: grid; gap: 3px; min-width: 0; }
.conv-list li.no-leido .name { color: var(--rojo-osc); }
.conv-list li.no-leido .preview { color: var(--text); font-weight: 600; }
.conv-list li.plain, .table tr.plain td { cursor: default; border: 0; background: transparent; box-shadow: none; }
.persona { display: flex; align-items: center; gap: 10px; }
.persona .avatar { width: 32px; height: 32px; font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.etq { background: var(--verde-suave); color: var(--verde-osc); }

/* Estados vacíos, de carga y de error */
.empty-state { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 28px 16px; color: var(--muted); }
.empty-state .es-ico { font-size: 30px; width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: var(--rojo-suave); margin-bottom: 6px; }
.empty-state b { color: var(--text); font-size: 15px; }
.empty-state span { font-size: 13px; max-width: 280px; }
.info-pane > .empty-state { margin-top: 30%; }
.skeleton { display: grid; grid-template-columns: 38px 1fr; gap: 10px; align-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 6px; }
.skeleton i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #f1eceb 25%, #f9f6f5 50%, #f1eceb 75%); background-size: 200% 100%; animation: brillo 1.2s infinite linear; }
.skeleton > i { width: 38px; height: 38px; border-radius: 50%; }
.skeleton div { display: grid; gap: 7px; }
.skeleton div i:last-child { width: 60%; }
@keyframes brillo { to { background-position: -200% 0; } }
.cargando-tabla { opacity: .55; transition: opacity .15s; }
.pager .btn:disabled { opacity: .35; }
#pend-body > .skeleton, #rep-body > .skeleton { max-width: 640px; }

@media (max-width: 1100px) { .filter-card { grid-template-columns: 1fr 1fr; } .filter-card .grow2 { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .filter-card { grid-template-columns: 1fr; }
  .results-bar { margin: 0 2px 8px; }
  .table .persona .avatar { display: none; }
}

/* =====================================================================
   Encabezados en recuadros oscuros y logo completo en la barra lateral
   ===================================================================== */
:root { --oscuro: #2a1d1e; --oscuro-2: #4a1518; }
.app { grid-template-columns: 112px 1fr; }
.nav .brand { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 8px 6px; margin: 0 0 14px; box-shadow: var(--shadow-sm); }
.nav .brand img { width: 88px; height: auto; filter: none; }

/* Encabezado de cada sección: franja oscura */
.page-head { background: linear-gradient(120deg, var(--oscuro) 0%, var(--oscuro-2) 100%); border: 0; color: #fff; padding: 18px 22px 18px 26px; box-shadow: 0 6px 18px rgba(42, 29, 30, .25); }
.page-head::before { width: 6px; background: linear-gradient(180deg, var(--verde) 0 33.3%, #fff 33.3% 66.6%, var(--rojo) 66.6% 100%); }
.page-head h2 { color: #fff; }
.page-head .sub { color: rgba(255, 255, 255, .72); }
.page-head .btn:not(.primary) { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .28); color: #fff; }
.page-head .btn:not(.primary):hover { background: rgba(255, 255, 255, .2); }
.page-head .fld > span { color: rgba(255, 255, 255, .7); }
.page-head input[type=date] { background: #fff; color: var(--text); }
.drawer .page-head, .modal-card .page-head { background: none; color: var(--text); padding: 0 0 10px; box-shadow: none; }
.drawer .page-head::before { display: none; }
.drawer .page-head h3 { color: var(--text); }
.drawer .page-head .btn:not(.primary) { background: #fff; color: var(--text); border-color: var(--line-2); }

/* Cada recuadro con su título en una franja oscura */
.card > h3:first-child, .card > b:first-child, .card > .full:first-child > b:first-child { display: flex; }
.card > h3:first-child { margin: -18px -18px 14px !important; padding: 12px 18px; background: var(--oscuro); color: #fff; border-radius: var(--radius) var(--radius) 0 0; font-size: 14px; letter-spacing: .02em; }
.card > h3:first-child::before { background: var(--rojo); box-shadow: 0 0 0 3px rgba(225, 17, 27, .3); }
.card > h3:first-child small { color: rgba(255, 255, 255, .7); margin-left: auto; font-weight: 500; }
.card.form-grid > .full:first-child { margin: -18px -18px 4px; padding: 12px 18px; background: var(--oscuro); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.card.form-grid > .full:first-child .muted { color: rgba(255, 255, 255, .7); }
.card > b:first-child { margin: -18px -18px 12px; padding: 12px 18px; background: var(--oscuro); color: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.card > b:first-child + .muted, .card > b:first-child ~ .muted:first-of-type { display: block; }

/* Bandeja: título oscuro y filtros en orden */
.list-pane .list-head { padding: 0 12px 10px; }
.list-title { margin: 0 -12px 12px; padding: 13px 14px; background: linear-gradient(120deg, var(--oscuro), var(--oscuro-2)); }
.list-title h2 { color: #fff; }
.count-pill { background: #fff; color: var(--rojo); }
.info-pane { padding-top: 0; }
.info-pane > h3:first-child { margin: 0 -16px 2px; padding: 14px 16px 4px; background: linear-gradient(120deg, var(--oscuro), var(--oscuro-2)); color: #fff; }
.info-pane > h3:first-child + .muted { margin: 0 -16px 10px; padding: 0 16px 12px; background: linear-gradient(120deg, var(--oscuro), var(--oscuro-2)); color: rgba(255, 255, 255, .75); }
.chat-head { background: linear-gradient(120deg, var(--oscuro), var(--oscuro-2)); color: #fff; border-bottom: 0; }
.chat-head .muted { color: rgba(255, 255, 255, .75) !important; }
.chat-head .btn:not(.primary) { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
.chat-head .chip { box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }

/* Tablas: encabezado de columnas oscuro y ordenado */
.table-wrap .table th { background: #3a2b2c; color: #fff; border-bottom: 0; }
.card .table th { background: #f3eeed; color: var(--muted); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .page-head { padding: 14px 16px 14px 20px; }
}
.chat-head select { color: var(--text); background: #fff; border-color: transparent; }
.info-pane > h3:first-child { margin-bottom: 0; padding-bottom: 2px; }
.info-pane > h3:first-child + .muted { margin-top: 0; }
.composer .modes button { white-space: nowrap; }

/* Encabezados en gris (más ligeros a la vista) */
:root { --oscuro: #5a6068; --oscuro-2: #474c53; }
.page-head { box-shadow: 0 4px 14px rgba(70, 76, 83, .18); }
.table-wrap .table th { background: #6b7179; }

/* ---------- Recuadros más visibles (17-nov-2026, pedido de Magali) ---------- */
:root {
  --line: #d6cccb; --line-2: #c4b8b7; --muted: #5f5253; --bg: #ebe6e5;
  --shadow-sm: 0 1px 3px rgba(40, 20, 20, .12), 0 2px 6px rgba(40, 20, 20, .08);
}
.card, .filter-card, .filters.row, .table-wrap, .kpi, .page > p.muted,
.list-pane, .chat-pane, .info-pane { border: 1.5px solid var(--line-2); }
.conv-list li { border: 1.5px solid var(--line-2); }
.conv-list li:hover { border-color: var(--rojo); }
.conv-list li.active { border-width: 2px; }
input, select, textarea { border: 1.5px solid var(--line-2); }
.search input { background: #fff; border: 1.5px solid var(--line-2); }
.odoo-box, .req, .drawer .notif { border: 1.5px solid var(--line-2); }
/* Pestañas: todas a la vista (en dos renglones si no caben), con contraste */
.tabs, .list-head .tabs { background: #ddd5d4; border: 1px solid var(--line-2); }
.list-head .tabs { flex-wrap: wrap; overflow: visible; }
.list-head .tabs button { flex: 1 1 auto; padding: 6px 8px; }
.tabs button { color: #3d3132; font-weight: 600; }
.tabs button:hover { background: rgba(255, 255, 255, .6); }
.tabs button.active { background: #fff; color: var(--rojo); box-shadow: 0 0 0 1.5px var(--rojo) inset, var(--shadow-sm); }

/* Botón de sugerencia con IA */
.btn.ia { background: linear-gradient(135deg, #f3e8ff, #e0f2fe); border: 1.5px solid #a78bfa; color: #5b21b6; font-weight: 600; }
.btn.ia:hover { background: linear-gradient(135deg, #ede0ff, #d5ecfb); border-color: #7c3aed; }
.btn.ia:disabled { opacity: .7; }
.btn.ia.ia-ico { padding: 0; width: 42px; height: 42px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; }

/* Lista de chats: nada se sale del recuadro (nombres largos se recortan con …) */
.conv-list { grid-template-columns: minmax(0, 1fr); overflow-x: hidden; }
.conv-list li { min-width: 0; }
.conv-list li[data-id] { grid-template-columns: 38px minmax(0, 1fr); }
.conv-list .top { min-width: 0; align-items: baseline; }
.conv-list .name { min-width: 0; flex: 1 1 auto; }
.conv-list .time { flex: none; }
.conv-list .meta { min-width: 0; }
.conv-list .meta > * { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-pane { min-width: 0; }
.ia-fuentes { font-size: 12px; color: #5b21b6; background: #f5f0ff; border: 1px solid #ddd0fb; border-radius: 8px; padding: 5px 10px; }
.chip.green { background: var(--verde-suave); color: var(--verde-osc); }
.chip.amber { background: var(--ambar-suave); color: #9a3412; }
.chip.red { background: var(--danger-soft); color: var(--danger); }

/* Almacén de consigna: tiene que verse antes de capturar el pedido en Odoo */
.chip.consigna { background: #ede9fe; color: #5b21b6; border: 1px solid #c4b5fd; }
.aviso-consigna { margin: 10px 0 4px; padding: 10px 12px; border-radius: 12px; background: #f5f3ff; border: 2px solid #7c3aed; color: #3b0764; font-size: 13px; line-height: 1.45; }
.aviso-consigna .t { font-weight: 800; letter-spacing: .03em; color: #6d28d9; margin-bottom: 2px; }
.aviso-consigna .wid { font-size: 12px; color: #5b21b6; }
.registro { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; }
.registro .t { font-weight: 800; margin-bottom: 2px; }
.registro .btn { margin-top: 6px; }
.registro.ok { background: #ecfdf5; border: 1.5px solid #10b981; color: #064e3b; }
.registro.ok .t { color: #047857; }
.registro.alta { background: #fff7ed; border: 1.5px solid #f59e0b; color: #78350f; }
.registro.alta .t { color: #b45309; }
.etq-drop { border: 1.5px solid var(--line-2, #ddd); border-radius: 10px; background: #fff; }
.etq-drop summary { cursor: pointer; padding: 8px 30px 8px 10px; list-style: none; position: relative; display: flex; flex-wrap: wrap; gap: 4px; min-height: 22px; }
.etq-drop summary::-webkit-details-marker { display: none; }
.etq-drop summary::after { content: "▾"; position: absolute; right: 10px; top: 8px; color: #666; }
.etq-drop[open] summary::after { content: "▴"; }
.etq-lista { border-top: 1px solid var(--line, #eee); max-height: 220px; overflow-y: auto; padding: 4px 0; }
.etq-item { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
.etq-item:hover { background: #faf7f6; }
.etq-color { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.field-titulo { font-weight: 700; font-size: 13px; margin: 4px 0 6px; }
.aviso-principal { margin: 8px 0 0; font-size: 12px; color: var(--muted, #6b6b6b); }
.otro-num { font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }

/* Reporte diario del chat (IA) */
.rd-lista { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.rd-alerta { border-left: 4px solid #dc2626; }
.rd-solo-impresion { display: none; }
@media print {
  .nav, #rep-tabs, #rep-diario .page-head, #toast, .modal-bg { display: none !important; }
  .app, .page { display: block !important; height: auto !important; overflow: visible !important; }
  .rd-solo-impresion { display: block; }
  .card { break-inside: avoid; }
  #rd-doc a { color: inherit; text-decoration: none; }
}
#rd-fecha { color: #1f2937; min-width: 230px; }

/* Notificaciones con seguimiento: urgente / proceso / cerrado (19-nov-2026) */
.n-resumen { display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; margin-bottom: 10px; border-radius: 12px; background: #f8fafc; border: 1.5px solid var(--line-2); font-size: 12.5px; color: #1f2937; }
.n-rojo { color: #b91c1c; }
.n-filtros { margin-bottom: 10px; flex-wrap: wrap; }
.drawer .notif { font-weight: 400; }
.drawer .notif.unread { font-weight: 400; }
.drawer .notif.unread .n-texto { font-weight: 700; }
.drawer .notif.seg-urgente { border-left: 5px solid #dc2626; background: #fef2f2; }
.drawer .notif.seg-proceso { border-left: 5px solid #f59e0b; }
.drawer .notif.seg-cerrado { border-left: 5px solid #16a34a; opacity: .8; }
.n-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 11px; }
.n-chip { padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.n-chip.seg-urgente { background: #fee2e2; color: #b91c1c; }
.n-chip.seg-proceso { background: #fef3c7; color: #92400e; }
.n-chip.seg-cerrado { background: #dcfce7; color: #166534; }
.n-tipo { color: #475569; font-weight: 600; }
.n-fecha { margin-left: auto; color: #64748b; }
.n-motivo { margin-top: 4px; font-size: 12px; font-weight: 600; color: #334155; }
.n-det { display: flex; flex-direction: column; gap: 1px; margin-top: 4px; font-size: 11.5px; color: #475569; }

/* Pestañas de la bandeja alineadas en recuadros (19-nov-2026) */
.list-head #inbox-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; width: 100%; }
.list-head #inbox-tabs button { display: flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; padding: 7px 4px;
  background: #fff; border: 1.5px solid var(--line-2); border-radius: 9px; white-space: nowrap; }
.list-head #inbox-tabs button:hover { border-color: var(--rojo); background: #fff; }
.list-head #inbox-tabs button.active { border-color: var(--rojo); box-shadow: 0 0 0 1px var(--rojo) inset; }
/* Igual en los filtros de Notificaciones */
.drawer .n-filtros { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 6px; width: 100%; }
.drawer .n-filtros button { display: flex; align-items: center; justify-content: center; gap: 4px; background: #fff; border: 1.5px solid var(--line-2); border-radius: 9px; }
.drawer .n-filtros button.active { border-color: var(--rojo); box-shadow: 0 0 0 1px var(--rojo) inset; }
.n-veces { margin-left: 4px; padding: 0 6px; border-radius: 8px; background: #e2e8f0; color: #334155; font-weight: 700; }

/* 20-nov-2026: tarjeta compacta «Datos Odoo» y etiquetas rápidas de la ficha */
.ficha-odoo { margin: 10px 0 0; padding: 8px 12px; border-radius: 12px; background: #ecfdf5; border: 1.5px solid #10b981; font-size: 13px; }
.ficha-odoo.alerta { background: #fff7ed; border-color: #f59e0b; }
.fo-row { display: grid; grid-template-columns: 74px 1fr auto; gap: 6px; align-items: baseline; padding: 3px 0; }
.fo-row + .fo-row { border-top: 1px solid rgba(0, 0, 0, .06); }
.fo-row span { color: var(--muted, #6b6b6b); font-size: 12px; }
.fo-row b { font-weight: 600; overflow-wrap: anywhere; }
.fo-ok, .fo-mal { font-style: normal; font-weight: 800; }
.fo-ok { color: #047857; }
.fo-mal { color: #b45309; }
.fo-aviso { margin: 0 0 4px 80px; font-size: 12px; color: #78350f; }
.fo-aviso .btn { margin-top: 3px; }
.etq-rapidas { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; padding: 6px; border: 1.5px solid var(--line-2, #ddd); border-radius: 12px; }
.etq-r { display: flex; align-items: center; justify-content: center; gap: 5px; padding: 7px 4px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; background: #faf7f6; }
.etq-r:has(input:checked) { background: var(--rojo, #d71920); color: #fff; }
.etq-r.off { opacity: .45; cursor: not-allowed; }

/* 20-nov-2026: facturas y pedidos de la ficha, una fila por renglón */
.odoo-box table.fp { width: 100%; table-layout: auto; font-size: 12px; border-collapse: collapse; }
.odoo-box table.fp th { text-align: left; font-weight: 600; color: var(--muted, #6b6b6b); font-size: 11px; padding: 2px 3px 4px; border-bottom: 1px solid var(--line); }
.odoo-box table.fp td { padding: 5px 3px; white-space: nowrap; vertical-align: middle; }
.odoo-box table.fp th:nth-child(n+3), .odoo-box table.fp td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.odoo-box table.fp .fp-debe { color: var(--rojo, #d71920); font-weight: 700; }
.odoo-box { overflow-x: auto; }

/* 20-nov-2026: «Para dar seguimiento» en Notificaciones */
.seg-box { margin: 0 0 12px; padding: 10px; border-radius: 12px; border: 1.5px solid var(--line-2); background: #fffaf5; }
.seg-tit { font-weight: 800; font-size: 13px; margin-bottom: 6px; }
.seg-item { padding: 8px 10px; margin-top: 6px; border-radius: 10px; background: #fff; border: 1px solid var(--line); border-left: 5px solid #9ca3af; cursor: pointer; font-size: 12.5px; }
.seg-item:hover { box-shadow: var(--shadow-sm); }
.seg-item.seg-urgente { border-left-color: #dc2626; background: #fef2f2; }
.seg-item.seg-aviso { border-left-color: #f59e0b; background: #fffbeb; }
.seg-item .seg-min { font-weight: 700; white-space: nowrap; }
.seg-item.seg-urgente .seg-min { color: #dc2626; }
.seg-item.seg-aviso .seg-min { color: #b45309; }
.seg-det { color: #4b5563; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#btn-notif.seg-pulso { animation: segPulso 1.6s ease-in-out infinite; }
@keyframes segPulso { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.seg-item .n-top { justify-content: space-between; font-size: 13px; margin-bottom: 2px; }

/* 20-nov-2026: aviso de versión nueva */
.aviso-version { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 1000; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 14px; background: #1f1718; color: #fff; box-shadow: var(--shadow, 0 8px 24px rgba(0,0,0,.25)); font-size: 13.5px; }
.aviso-version .btn:not(.primary) { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.3); color: #fff; }
.filters.compact .fld-full { grid-column: 1 / -1; }
.list-head .filters.compact + .search { margin-top: 10px; }

/* 25-nov-2026: avisos e instalación (Mi perfil) */
.avisos-caja { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 10px 0 14px; }
.avisos-caja p { margin: 4px 0 10px; }
.avisos-caja .actions { flex-wrap: wrap; }

/* 2-dic-2026: sugerencia de Claude dejada por el conector (proponer_respuesta) */
.claude-sug { background: #f5f0ff; border: 1px solid #ddd0fb; border-radius: 10px; padding: 8px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.claude-sug .cs-head { color: #5b21b6; }
.claude-sug .cs-aviso { background: var(--ambar-suave); color: #9a3412; border-radius: 6px; padding: 4px 8px; font-size: 12px; }
.claude-sug .cs-coment { color: #4c1d95; font-size: 12px; font-style: italic; }
.claude-sug .cs-texto { white-space: pre-wrap; max-height: 180px; overflow-y: auto; background: #fff; border-radius: 6px; padding: 6px 8px; }
.claude-sug .cs-acc { display: flex; gap: 6px; align-items: center; }

/* 2-dic-2026: vista Todos y agrupar por persona que atiende */
.conv-list .quien, #conv-list .quien { font-size: 11px; margin-left: auto; text-align: right; line-height: 1.3; }
#conv-list li.grupo-persona { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: transparent; border: 0; box-shadow: none; cursor: default; position: sticky; top: 0; z-index: 1; backdrop-filter: blur(4px); }

/* 3-dic-2026: Administración Chat */
.nav-svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ac-grid { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .ac-grid { grid-template-columns: 1fr; } }
.ac-tree { max-height: calc(100vh - 230px); overflow: auto; }
.ac-tree input#ac-filtro { width: 100%; margin: 8px 0; }
.ac-acciones { display: flex; gap: 6px; flex-wrap: wrap; }
.ac-tree details { margin: 2px 0; }
.ac-tree summary { cursor: pointer; display: flex; justify-content: space-between; gap: 6px; padding: 4px 6px; border-radius: 6px; font-weight: 600; }
.ac-tree summary:hover { background: #f5f0ef; }
.ac-hijos { margin-left: 14px; border-left: 1px solid var(--line); padding-left: 8px; display: flex; flex-direction: column; }
.ac-file { padding: 3px 6px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 13px; }
.ac-file:hover { background: #f5f0ef; }
.ac-file.active { background: var(--rojo); color: #fff; }
.ac-vacia { font-size: 12px; padding: 2px 6px; }
.ac-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ac-doc-head h3 { margin: 2px 0 0; }
.ac-texto { width: 100%; min-height: 55vh; font-family: ui-monospace, Consolas, monospace; font-size: 13px; line-height: 1.5; padding: 10px; border: 1px solid var(--line-2); border-radius: 8px; resize: vertical; box-sizing: border-box; }
.ac-editores { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 10px 0 14px; }
.ac-llave { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.ac-llave code { background: #f5f0ef; padding: 6px 8px; border-radius: 6px; word-break: break-all; }

/* 3-dic-2026: memoria por cliente en la ficha */
.memoria { display: flex; flex-direction: column; gap: 6px; }
.mem-form { display: flex; gap: 6px; align-items: flex-end; }
.mem-form textarea { flex: 1; font-size: 13px; resize: vertical; }
.mem-item { background: #faf7f6; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
.mem-meta { font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.mem-txt { white-space: pre-wrap; }
.mem-x { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 11px; text-decoration: underline; }

/* 3-dic-2026: cuadro de respuesta plegable (Bandeja a media pantalla junto a Claude) */
.composer .comp-barra { display: none; }
.composer.plegado { padding: 6px 10px; gap: 4px; }
.composer.plegado > textarea, .composer.plegado .modes, .composer.plegado #btn-adjunto,
.composer.plegado #btn-tpl2, .composer.plegado #btn-send, .composer.plegado .txt-cuenta { display: none; }
.composer.plegado .comp-barra { display: block; flex: 1; text-align: left; border: 1px solid var(--line-2); border-radius: 12px; padding: 9px 14px; background: #fff; color: var(--muted); cursor: pointer; font: inherit; }
.composer.plegado .comp-barra:hover { border-color: #cdbfbe; background: #fcfafa; }

/* 3-dic-2026: cabecera del chat compacta en pantalla angosta */
@media (max-width: 1100px) {
  .chat-head { padding: 6px 10px; gap: 6px; }
  .chat-head .avatar.lg { width: 30px; height: 30px; font-size: 12px; }
  .chat-head .title { font-size: 14px; }
  .chat-head .muted { font-size: 11px !important; }
  .chat-head .btn, .chat-head select { padding: 3px 8px; font-size: 12px; }
  .chat-head select { max-width: 120px; }
  .chat-head .lbl-largo { display: none; }
  .composer .modes-ayuda { display: none; }
  .composer #btn-plegar { margin-left: auto; }
}

/* 3-dic-2026: a media pantalla (junto a Claude) el chat abierto ocupa todo el ancho; ‹ regresa a la lista */
@media (max-width: 1100px) {
  .inbox.chat-open { grid-template-columns: 1fr; }
  .inbox.chat-open .list-pane { display: none; }
  .inbox.chat-open .back { display: inline-block; }
}

/* 3-dic-2026: número del chat en el encabezado (el mismo conv_id que usa Claude); clic = copiar */
.chat-num { font: 600 12px/1 ui-monospace, Consolas, monospace; padding: 3px 8px; margin-left: 6px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .12); color: inherit; cursor: pointer; vertical-align: 2px; white-space: nowrap; }
.chat-num:hover { background: rgba(255, 255, 255, .25); }

/* 3-dic-2026: ocultar la columna de conversaciones (« en la lista, » en el chat) */
.list-title .count-pill { margin-left: auto; }
.list-title .btn-lista { margin-left: 8px; font-size: 16px; line-height: 1; padding: 3px 9px; background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); color: #fff; }
#btn-mostrar-lista { display: none; font-size: 16px; line-height: 1; }
.inbox.lista-oculta { grid-template-columns: 1fr 330px; }
.inbox.lista-oculta .list-pane { display: none; }
.inbox.lista-oculta #btn-mostrar-lista { display: inline-block; }
@media (max-width: 1200px) { .inbox.lista-oculta { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .inbox.chat-open.lista-oculta #btn-mostrar-lista { display: none; } }
