:root {
  --ground: #F4F5F7;
  --surface: #FFFFFF;
  --line: #E2E5EA;
  --line-2: #EEF0F3;
  --field: #CBD1D9;
  --ink: #15181D;
  --ink-2: #3A414C;
  --muted: #5A6270;
  --side: #10141B;
  --side-ink: #C9CED6;
  --side-active: #222A36;
  --blue: #2350C8;
  --blue-dk: #173A99;
  --blue-bg: #EEF2FD;
  --blue-line: #C9D6F7;
  --orange: #B4470F;
  --orange-dk: #8A3A0B;
  --orange-bg: #FCEFE6;
  --teal: #0B6B5A;
  --teal-dk: #0B5B4C;
  --teal-bg: #E3F4EF;
  --amber-dk: #7A4A00;
  --amber-bg: #FDF1DC;
  --red: #B42318;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ground);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: var(--blue); }
a:hover { color: var(--blue-dk); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.boot { padding: 40px; color: var(--muted); }

/* ---------- Botones y campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 16px; border-radius: 8px;
  border: 1px solid var(--field); background: var(--surface); font-weight: 500;
  text-decoration: none; color: var(--ink);
}
.btn:hover { background: #F8F9FA; color: var(--ink); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--blue-dk); }
.btn.take { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn.take:hover { background: var(--orange-dk); }
.btn.green { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.link { border: 0; background: none; color: var(--blue); padding: 0 4px; min-height: 32px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-2); }
.input, .field input, .field select, .field textarea {
  min-height: 40px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px;
  background: var(--surface); font-size: 14px; color: var(--ink);
}
.field textarea, textarea.input { padding: 10px 12px; resize: vertical; }
.error { color: var(--red); font-size: 13px; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--blue); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
.brand-name { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 12px; color: #9AA3B0; }
.login-card h1 { margin: 0; font-size: 20px; }

/* ---------- Estructura ---------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side {
  flex: 1 1 220px; max-width: 100%; background: var(--side); color: var(--side-ink);
  padding: 20px 12px; display: flex; flex-direction: column; gap: 4px;
}
.side .brand { padding: 4px 10px 20px; }
.side .brand-name { color: #fff; }
.nav-item {
  display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  border-radius: 8px; color: var(--side-ink); text-decoration: none;
}
.nav-item:hover { color: #fff; background: #1A202A; }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 500; }
.nav-item .label { flex: 1; }
.badge {
  background: var(--orange); color: #fff; font-size: 12px; font-weight: 600;
  padding: 1px 8px; border-radius: 999px;
}
.side-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 16px 10px 0; border-top: 1px solid #252C38; }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 999px; background: var(--line-2); color: var(--ink);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px;
}
.side-foot .avatar { background: var(--orange); color: #fff; }
.side-foot .who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.side-foot .who strong { color: #fff; font-weight: 500; }
.side-foot .who span { font-size: 12px; color: #9AA3B0; }
.side-foot button { background: none; border: 0; color: var(--side-ink); padding: 6px; border-radius: 6px; }
.side-foot button:hover { color: #fff; background: #1A202A; }

.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 24px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 20px; font-weight: 600; flex: 1 1 auto; }
.live { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--teal); flex: none; }
.dot.off { background: #C77700; }
.dot.red { background: #C81E3A; }

/* ---------- Bandeja ---------- */
.inbox { display: flex; flex-wrap: wrap; gap: 16px; padding: 20px 24px; align-items: stretch; flex: 1; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.list-col { flex: 1 1 320px; display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 110px); }
.thread-col { flex: 2 1 440px; display: flex; flex-direction: column; overflow: hidden; max-height: calc(100vh - 110px); min-height: 520px; }
.info-col { flex: 1 1 270px; padding: 18px; display: flex; flex-direction: column; gap: 18px; align-self: flex-start; }

.list-head { padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.list-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  min-height: 34px; padding: 0 10px; border: 1px solid var(--field); border-radius: 999px;
  background: var(--surface); font-size: 13px;
}
.chip-btn[aria-selected="true"] { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 500; }
.chip-btn.urgent:not([aria-selected="true"]) { border-color: #E9B89A; color: var(--orange-dk); font-weight: 600; }
.conv-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); overflow-y: auto; flex: 1; }
.conv-list li { border-bottom: 1px solid var(--line-2); }
.conv {
  display: flex; gap: 10px; width: 100%; padding: 12px 16px; border: 0; background: var(--surface);
  text-align: left;
}
.conv:hover { background: #F8F9FB; }
.conv.selected { background: #F3F6FE; box-shadow: inset 3px 0 0 var(--blue); }
.conv .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv .row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.conv .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .time { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.conv .prev { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.unread { background: var(--blue); color: #fff; font-size: 11px; font-weight: 600; border-radius: 999px; padding: 0 7px; }
.empty { padding: 24px 16px; color: var(--muted); font-size: 13px; }

.pill { font-size: 12px; font-weight: 500; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.human { background: var(--orange-bg); color: var(--orange-dk); }
.pill.bot { background: #E8EEFC; color: var(--blue-dk); }
.pill.agent { background: var(--teal-bg); color: var(--teal-dk); }
.pill.gray { background: var(--line-2); color: var(--ink-2); }
.pill.amber { background: var(--amber-bg); color: var(--amber-dk); }
.reason { font-size: 12px; color: var(--orange-dk); }

.thread-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.thread-head .who { flex: 1 1 200px; display: flex; flex-direction: column; min-width: 0; }
.thread-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.back { display: none; }
.msgs {
  list-style: none; margin: 0; padding: 18px; display: flex; flex-direction: column; gap: 10px;
  background: #F7F8FA; flex: 1; overflow-y: auto;
}
.msg { display: flex; }
.msg.in { justify-content: flex-start; }
.msg.out { justify-content: flex-end; }
.msg.sys { justify-content: center; }
.bubble {
  max-width: 72%; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
}
.msg.out .bubble.bot { background: var(--blue-bg); border-color: var(--blue-line); }
.msg.out .bubble.agent { background: var(--orange-bg); border-color: #F0C7AE; }
.bubble.blocked { opacity: .65; border-style: dashed; }
.bubble .who { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.bubble.bot .who { color: var(--blue-dk); }
.bubble.agent .who { color: var(--orange-dk); }
.bubble .text { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .meta { font-family: var(--mono); font-size: 11px; color: var(--muted); align-self: flex-end; }
.bubble .meta.failed { color: var(--red); font-family: inherit; }
.sysmsg {
  font-size: 12px; padding: 6px 12px; border-radius: 8px; background: var(--line-2); color: var(--ink-2);
  text-align: center; max-width: 85%;
}
.sysmsg.alert { background: var(--orange-bg); color: var(--orange-dk); }
.daysep { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 0; }

.composer { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; flex-direction: column; gap: 10px; }
.composer .window { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; font-size: 12px; color: var(--muted); }
.composer .window.closed { color: var(--orange-dk); }
.notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
  background: var(--ground); border: 1px dashed var(--field);
}
.notice span { flex: 1 1 240px; color: var(--ink-2); }
.write { display: flex; gap: 8px; align-items: flex-end; }
.write textarea {
  flex: 1; min-width: 0; min-height: 44px; max-height: 180px; padding: 10px 12px;
  border: 1px solid var(--field); border-radius: 8px; resize: vertical; font-size: 14px;
}
.tpl { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #FAFBFC; }
.tpl .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.tpl .preview { font-size: 13px; color: var(--ink-2); white-space: pre-wrap; }

.info-col h2 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
.dl { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500;
  padding: 3px 4px 3px 10px; border-radius: 999px; background: var(--teal-bg); color: var(--teal-dk);
}
.tag.src-bot { background: #E8EEFC; color: var(--blue-dk); }
.tag button { border: 0; background: none; color: inherit; width: 22px; height: 22px; border-radius: 999px; line-height: 1; }
.tag button:hover { background: rgba(0,0,0,.08); }
.add-tag { display: flex; gap: 6px; margin-top: 8px; }
.add-tag input { flex: 1; min-width: 0; min-height: 34px; padding: 0 10px; border: 1px solid var(--field); border-radius: 8px; font-size: 13px; }
.box { padding: 12px 14px; border-radius: 10px; background: #F8F9FA; border: 1px solid var(--line); font-size: 13px; }
.box.warn { background: var(--orange-bg); border-color: #F0C7AE; color: var(--orange-dk); }
.stack { display: flex; flex-direction: column; gap: 8px; }
.placeholder { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 40px; text-align: center; }

/* ---------- Páginas de admin ---------- */
.page { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; max-width: 1100px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.card h2 { margin: 0; font-size: 16px; font-weight: 600; }
.card p { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
td { padding: 10px 8px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
td .btn { margin-right: 6px; }
pre.code {
  margin: 0; padding: 12px 14px; border-radius: 8px; background: var(--side); color: #E6E9EE;
  font-family: var(--mono); font-size: 12px; line-height: 1.6; overflow-x: auto;
}
code.inline { font-family: var(--mono); font-size: 13px; background: var(--ground); border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; }
.ok-mark { color: var(--teal-dk); font-weight: 700; }
.bad-mark { color: var(--orange-dk); font-weight: 700; }

/* ---------- Avisos ---------- */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 50; max-width: calc(100vw - 32px); }
.toast {
  background: var(--ink); color: #fff; padding: 12px 14px; border-radius: 10px; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18); max-width: 380px;
}
.toast.alert { background: var(--orange-dk); }
.toast.err { background: var(--red); }
.toast button { margin-left: 8px; background: rgba(255,255,255,.18); border: 0; color: #fff; border-radius: 6px; padding: 4px 8px; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 900px) {
  .side { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 4px; }
  .side .brand { padding: 0 8px 0 0; }
  .side .brand-sub, .side-foot .who { display: none; }
  .nav-item { min-height: 40px; padding: 0 10px; }
  .nav-item .label { font-size: 13px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; }
  .side-foot .avatar { display: none; }
  .inbox { padding: 12px; }
  .list-col, .thread-col { max-height: none; }
  .inbox.has-current .list-col { display: none; }
  .inbox:not(.has-current) .thread-col, .inbox:not(.has-current) .info-col { display: none; }
  .back { display: inline-flex; }
  .bubble { max-width: 88%; }
}

/* ---------- Login ---------- */
.login2 { min-height: 100vh; display: flex; flex-wrap: wrap; background: var(--surface); }
.login-art {
  flex: 1 1 520px; position: relative; overflow: hidden; color: #E9EDF7;
  background-color: #0E1A3A;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 22px 22px;
  display: flex; flex-direction: column; justify-content: space-between; padding: 40px 48px; min-height: 420px;
}
.login-art .brand-name { color: #fff; font-size: 16px; }
.login-art .brand-sub { color: #AAB5CF; }
.login-art .brand-mark { background: #C9A227; color: #0E1A3A; }
.art-stage { display: flex; flex-direction: column; align-items: flex-start; gap: 28px; max-width: 520px; }
.art-cap { width: 220px; height: 170px; }
.cap-line { fill: none; stroke: #E9EDF7; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 700; stroke-dashoffset: 700; animation: draw 2.2s ease-out forwards; }
.cap-fill { fill: #1B2C5C; opacity: 0; animation: fadein 1s ease-out 1.6s forwards; }
.cap-gold { fill: #C9A227; opacity: 0; animation: fadein .8s ease-out 2s forwards; }
.tassel { transform-origin: 150px 62px; animation: swing 3.2s ease-in-out 2.2s infinite; }
.art-title { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; color: #fff;
  opacity: 0; transform: translateY(8px); animation: rise .8s ease-out .5s forwards; }
.art-sub { margin: 0; font-size: 16px; color: #C3CBE0; max-width: 420px; opacity: 0; animation: rise .8s ease-out .8s forwards; }
.grades { display: flex; align-items: center; gap: 0; list-style: none; margin: 0; padding: 0; }
.grades li { display: flex; align-items: center; }
.grade {
  min-width: 38px; height: 38px; padding: 0 12px; border-radius: 999px; border: 1.5px solid #3A4B7A; color: #8E9BBD; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; font-family: inherit; font-size: 12px; font-weight: 600;
  animation: grade 7s ease-in-out infinite;
}
.grade.final { width: auto; padding: 0 12px; border-radius: 999px; font-family: inherit; letter-spacing: .02em; }
.grades .bar { width: 22px; height: 2px; background: #3A4B7A; animation: bar 7s ease-in-out infinite; }
.grades li:nth-child(1) .grade { animation-delay: 0s; }
.grades li:nth-child(2) .grade, .grades li:nth-child(2) .bar { animation-delay: .6s; }
.grades li:nth-child(3) .grade, .grades li:nth-child(3) .bar { animation-delay: 1.2s; }
.grades li:nth-child(4) .grade, .grades li:nth-child(4) .bar { animation-delay: 1.8s; }
.grades li:nth-child(5) .grade, .grades li:nth-child(5) .bar { animation-delay: 2.4s; }
.grades li:nth-child(6) .grade, .grades li:nth-child(6) .bar { animation-delay: 3s; }
.grades li:nth-child(7) .grade, .grades li:nth-child(7) .bar { animation-delay: 3.6s; }
.art-foot { font-size: 12px; color: #8E9BBD; }
.dots { position: absolute; inset: 0; pointer-events: none; }
.dots span { position: absolute; bottom: -10px; width: 6px; height: 6px; border-radius: 999px; background: #C9A227; opacity: 0; animation: float 9s linear infinite; }
.dots span:nth-child(1) { left: 12%; animation-delay: 0s; }
.dots span:nth-child(2) { left: 30%; animation-delay: 2.5s; width: 4px; height: 4px; }
.dots span:nth-child(3) { left: 55%; animation-delay: 5s; }
.dots span:nth-child(4) { left: 72%; animation-delay: 1.2s; width: 4px; height: 4px; }
.dots span:nth-child(5) { left: 88%; animation-delay: 6.5s; }
.login-side { flex: 1 1 420px; display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--ground); }
.login-side .login-card { animation: rise .7s ease-out .2s both; box-shadow: 0 10px 40px rgba(14,26,58,.08); }
.login-card .lead { margin: -6px 0 4px; color: var(--muted); }
.login-card .btn.primary { background: #0E1A3A; border-color: #0E1A3A; min-height: 46px; }
.login-card .btn.primary:hover { background: #1B2C5C; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fadein { to { opacity: 1; } }
@keyframes rise { to { opacity: 1; transform: none; } }
@keyframes swing { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(9deg); } }
@keyframes grade {
  0%, 8% { border-color: #3A4B7A; color: #8E9BBD; background: transparent; }
  14%, 70% { border-color: #C9A227; color: #0E1A3A; background: #C9A227; }
  80%, 100% { border-color: #3A4B7A; color: #8E9BBD; background: transparent; }
}
@keyframes bar { 0%, 8% { background: #3A4B7A; } 14%, 70% { background: #C9A227; } 80%, 100% { background: #3A4B7A; } }
@keyframes float { 0% { transform: translateY(0); opacity: 0; } 10% { opacity: .55; } 90% { opacity: .3; } 100% { transform: translateY(-110vh); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .cap-line, .cap-fill, .cap-gold, .tassel, .art-title, .art-sub, .grade, .grades .bar, .dots span, .login-side .login-card { animation: none !important; }
  .cap-line { stroke-dashoffset: 0; } .cap-fill, .cap-gold, .art-title, .art-sub { opacity: 1; transform: none; }
}
@media (max-width: 900px) {
  .login-art { padding: 28px 22px; min-height: 0; gap: 24px; }
  .art-cap { width: 150px; height: 116px; }
  .art-title { font-size: 26px; }
  .grade { width: 32px; height: 32px; font-size: 12px; }
  .grades .bar { width: 10px; }
}

/* ---------- Monitor, campañas y cola ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi strong { font-family: var(--mono); font-size: 24px; font-weight: 600; }
.kpi small { font-size: 12px; color: var(--muted); }
.cards4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.mini { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mini.ia { box-shadow: inset 4px 0 0 var(--blue); }
.mini.ag { box-shadow: inset 4px 0 0 var(--orange); }
.mini.ok { box-shadow: inset 4px 0 0 var(--teal); }
.mini.bad { box-shadow: inset 4px 0 0 var(--orange); }
.mini.off { box-shadow: inset 4px 0 0 #8A929E; opacity: .85; }
.mini .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.progress { height: 8px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--blue); }
.mini.ag .progress > span { background: var(--orange); }
.mini.ok .progress > span { background: var(--teal); }
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 16px; border-radius: 12px; border: 1px solid #F0C7AE; background: var(--orange-bg); color: #5C2606; }
.banner.info { border-color: var(--blue-line); background: var(--blue-bg); color: var(--blue-dk); }
.banner span { flex: 1 1 320px; }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split > .grow { flex: 2 1 560px; min-width: 0; }
.split > .side-panel { flex: 1 1 340px; min-width: 0; }
.panel-pad { padding: 16px 18px; }
.panel h2 { margin: 0; font-size: 16px; font-weight: 600; }
.panel .head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 16px 18px 10px; }
table.data td, table.data th { white-space: nowrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #F8F9FB; }
tr.sel td { background: #F3F6FE; }
.turns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-height: 420px; overflow-y: auto; }
.turns li { display: flex; flex-direction: column; gap: 2px; }
.turns .who { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.turns .who.agent { color: var(--blue-dk); }
.turns .msg-t { font-size: 14px; }
details.fold { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0 18px; }
details.fold > summary { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 600; }
details.fold > summary span { font-weight: 400; font-size: 13px; color: var(--muted); }
details.fold > .fold-body { padding: 4px 0 18px; }
.bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.bars li { display: grid; grid-template-columns: 170px minmax(0, 1fr) 60px; gap: 10px; align-items: center; font-size: 13px; }
.bars .track { height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.bars .track span { display: block; height: 100%; background: var(--blue); }
.bars .n { font-family: var(--mono); text-align: right; }
.queue { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.queue .now { flex: 2 1 520px; min-width: 0; padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; }
.queue .next { flex: 1 1 300px; min-width: 0; }
.big-phone { font-family: var(--mono); font-size: 28px; font-weight: 600; letter-spacing: .01em; }
.results { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.res-btn { min-height: 46px; padding: 0 12px; border: 1px solid var(--field); border-radius: 8px; background: var(--surface); text-align: left; font-weight: 500; }
.res-btn[aria-pressed="true"] { border: 2px solid var(--blue); background: var(--blue-bg); color: var(--blue-dk); font-weight: 600; }
.timer { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--teal-dk); }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--ink-2); }
.facts strong { color: var(--ink); }
.dropzone { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 16px; border: 1px dashed #A9B1BC; border-radius: 10px; background: #F8F9FA; }
.split-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--line-2); }
.split-bar .a { background: var(--blue); }
.split-bar .b { background: var(--orange); }
.inline-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.calls-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.calls-list li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.page.wide { max-width: none; }
[hidden] { display: none !important; }
.table-wrap.scroll { max-height: 430px; overflow-y: auto; }
.table-wrap.scroll thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }

/* ===== Módulo Pacientes (MTD) ===== */
.pac-small { font-size: 12px; margin-top: 2px; }
.pac-alerta { margin-top: 4px; font-size: 12px; color: var(--red); font-weight: 600; }
.pac-campos { table-layout: fixed; width: 100%; }
.pac-campos thead th:nth-child(1) { width: 25%; }
.pac-campos thead th:nth-child(2), .pac-campos thead th:nth-child(3) { width: 23%; }
.pac-campos thead th:nth-child(4) { width: 29%; }
.pac-campos th[scope="row"] { font-weight: 500; overflow-wrap: anywhere; }
table.data.pac-campos td, table.data.pac-campos th { vertical-align: top; white-space: normal; }
.pac-campos input, .pac-campos select { width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--field); border-radius: 6px; background: var(--surface); }
.pac-campos input:disabled, .pac-campos select:disabled { background: var(--line-2); color: var(--ink-2); }
.pac-src { color: var(--ink-2); overflow-wrap: anywhere; }
.pac-grupo th { background: var(--line-2); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.pac-cambio td.pac-src { background: var(--amber-bg); }
.pac-falta th[scope="row"] { color: var(--red); }
.pac-falta input, .pac-falta select { border-color: var(--red); }
.pac-prob { font-size: 12px; color: var(--red); margin-top: 2px; }
.pac-obl { color: var(--red); }
.pac-tag { margin-left: 6px; font-size: 11px; }
.pac-acciones { flex-wrap: wrap; gap: 8px; }
.pac-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pac-calls { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pac-calls > li { border-bottom: 1px solid var(--line-2); padding-bottom: 8px; }
.pac-call-det { margin-top: 8px; }
.pac-banner-alerta { background: #FDECEA; border-color: #F3B8B2; color: var(--red); }
.pac-ficha .inline-row select, .pac-ficha .inline-row input[type="text"] { padding: 6px 8px; border: 1px solid var(--field); border-radius: 6px; }
@media (max-width: 860px) {
  .pac-cols { grid-template-columns: 1fr; }
  .pac-campos { table-layout: auto; }
  .pac-campos input, .pac-campos select { min-width: 120px; }
}
