@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&display=swap');

:root {
  --paper: #f6f4ef;
  --stage: #e8e4da;
  --card: #ffffff;
  --line: #e7e3da;
  --line-2: #d9d4c8;
  --ink: #16231f;
  --ink-2: #44504b;
  --muted: #66716c;
  --brand: #0f5c57;
  --brand-2: #0b4743;
  --brand-soft: #e3efec;
  --brand-line: #bcd9d3;
  --alert: #c8431b;
  --alert-soft: #fbe9e2;
  --ok: #1f7a4d;
  --ok-soft: #e1f2e8;
  --warn: #8a5a00;
  --warn-soft: #fbf0d6;
  --d1: #0f5c57;
  --d1s: #dcece9;
  --d2: #8a5a00;
  --d2s: #f6e8c8;
  --d3: #2f5f98;
  --d3s: #dde8f5;
  --r: 12px;
  --f-ui: 'Figtree', system-ui, sans-serif;
  --f-display: 'Fraunces', Georgia, serif;
  --shadow: 0 1px 2px rgba(22, 35, 31, 0.05), 0 8px 24px rgba(22, 35, 31, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 400 14px/1.45 var(--f-ui);
  color: var(--ink);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.i { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- estructura ---------- */
#escena { height: 100vh; height: 100dvh; display: grid; grid-template-columns: 560px 1fr; }
.stage {
  background: var(--stage);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: 24px; border-right: 1px solid var(--line-2); min-height: 0;
}
.stage-cap { font-size: 12px; color: var(--muted); letter-spacing: 0.04em; display: flex; gap: 8px; align-items: center; }
.stage-cap b { font-weight: 600; color: var(--ink-2); }
.phone {
  width: 390px; height: min(844px, calc(100vh - 96px)); min-height: 560px;
  background: #fff; border-radius: 44px; border: 10px solid #1b2623; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: 0 30px 60px -20px rgba(22, 35, 31, 0.35), 0 0 0 1px rgba(0,0,0,0.06);
  position: relative;
}
.statusbar { height: 36px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 6px 26px 0; font-size: 13px; font-weight: 600; background: #fff; }
.statusbar .sb-r { display: flex; gap: 6px; align-items: center; }

/* chat */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 8px 16px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font: 500 20px/1 var(--f-display); flex: none; position: relative; }
.avatar.sm { width: 28px; height: 28px; font-size: 14px; }
.avatar.ag { background: #2f5f98; font: 600 13px var(--f-ui); }
.chat-head h1 { margin: 0; font: 600 15px/1.2 var(--f-ui); }
.chat-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; display: inline-block; }
.dot.warn { background: var(--warn); } .dot.alert { background: var(--alert); } .dot.mute { background: var(--line-2); }
.icon-btn { margin-left: auto; width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--paper); }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; background: #fff; }
.daysep { align-self: center; font-size: 11px; color: var(--muted); margin: 4px 0 8px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.row.u { justify-content: flex-end; }
.row.gap { margin-top: 10px; }
.bub { max-width: 80%; padding: 9px 13px; border-radius: 18px; font-size: 14.5px; line-height: 1.42; overflow-wrap: anywhere; white-space: pre-line; }
.bub.b { background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bub.a { background: var(--d3s); border: 1px solid #c3d6ec; border-bottom-left-radius: 6px; }
.bub.u { background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.bub .t { font-size: 10.5px; opacity: 0.6; margin-left: 8px; float: right; margin-top: 6px; }
.bub .who { display: block; font-size: 11px; font-weight: 600; color: var(--d3); margin-bottom: 2px; }
.bub.err { border-color: #ecc0b0; background: var(--alert-soft); }
.spacer { width: 28px; flex: none; }
.typing { display: inline-flex; gap: 4px; padding: 14px 14px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); opacity: 0.4; animation: tp 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; } .typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes tp { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 0.9; transform: translateY(-3px); } }
.msg-in { animation: in 0.22s ease-out; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card { width: 100%; max-width: 292px; background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(22,35,31,.04); }
.card .ph { height: 112px; background-size: cover; background-position: center 40%; }
.card .bd { padding: 12px 14px 14px; }
.card h3 { margin: 0 0 2px; font: 500 17px/1.25 var(--f-display); }
.card .sub { color: var(--muted); font-size: 12.5px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.kv:first-of-type { margin-top: 10px; }
.kv span:first-child { color: var(--muted); }
.kv b { font-weight: 600; text-align: right; }
.price { font: 500 26px/1.1 var(--f-display); letter-spacing: -0.01em; margin: 8px 0 2px; }
.price small { font: 400 12px var(--f-ui); color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.pl { list-style: none; margin: 8px 0 0; padding: 0; }
.pl li { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.pl li b { font-weight: 600; white-space: nowrap; }
.pl li span small { display: block; color: var(--muted); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  min-height: 44px; padding: 0 14px; border: 1px solid var(--brand-line); background: #fff; color: var(--brand-2);
  border-radius: 22px; font-size: 13.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s, transform .1s;
}
.chip:hover:not(:disabled) { background: var(--brand-soft); }
.chip:active:not(:disabled) { transform: scale(0.98); }
.chip:disabled { opacity: 0.45; cursor: default; }
.chip.sel { background: var(--brand); color: #fff; border-color: var(--brand); opacity: 1; }
.chip small { color: var(--muted); font-weight: 400; }
.chip.sel small { color: #cfe6e2; }
.chip.day { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0; border-radius: 12px; padding: 6px 12px; line-height: 1.2; min-width: 82px; }
.chip.day small { font-size: 11.5px; }
.chip.slot { min-width: 72px; justify-content: center; border-radius: 12px; padding: 0 10px; font-variant-numeric: tabular-nums; }
.grp { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0.05em; text-transform: uppercase; margin: 12px 0 0; }
.btn { min-height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: #fff; padding: 0 16px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s; }
.btn:hover { background: var(--paper); }
.btn.p { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.p:hover { background: var(--brand-2); }
.btn.w { width: 100%; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.okmark { width: 28px; height: 28px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin-bottom: 8px; }
.wait { display: flex; align-items: center; gap: 10px; background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: 13px; font-weight: 500; margin-top: 10px; }
.wait.live { background: var(--ok-soft); color: var(--ok); }

.qr-wrap { padding: 8px 0 4px; border-top: 1px solid transparent; }
.qr { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.qr::-webkit-scrollbar { display: none; }
.qr .chip { flex: none; }
.composer { display: flex; gap: 8px; padding: 8px 12px 6px; border-top: 1px solid var(--line); background: #fff; align-items: center; }
.composer input { flex: 1; min-width: 0; height: 44px; border: 1px solid var(--line-2); border-radius: 22px; padding: 0 16px; background: var(--paper); font-size: 15px; }
.composer input::placeholder { color: var(--muted); }
.composer input:focus { outline: 2px solid var(--brand); outline-offset: 0; background: #fff; border-color: transparent; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.send:disabled { background: var(--line-2); cursor: default; }
.fine { text-align: center; font-size: 11px; color: var(--muted); padding: 0 20px 10px; line-height: 1.35; }
.homebar { height: 5px; width: 120px; background: #1b2623; border-radius: 3px; margin: 0 auto 6px; opacity: 0.85; flex: none; }

/* ---------- panel ---------- */
.office { display: grid; grid-template-columns: 232px 1fr; min-width: 0; min-height: 0; background: var(--paper); }
.side { padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; border-right: 1px solid var(--line); background: #f1eee7; min-height: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand .mark { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); color: #fff; display: grid; place-items: center; font: 500 19px var(--f-display); }
.brand b { font: 500 21px/1 var(--f-display); letter-spacing: -0.01em; display: block; }
.brand small { font-size: 11px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 0 10px; min-height: 36px; border-radius: 8px; color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 13.5px; }
.nav a:hover { background: rgba(22,35,31,0.05); }
.nav a[aria-current="page"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.nav a .n { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.nav a .n.al { background: var(--alert); color: #fff; padding: 0 6px; border-radius: 9px; min-width: 18px; text-align: center; line-height: 18px; }
.side-sec { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 18px 10px 6px; }
.me { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; border-top: 1px solid var(--line-2); }
.me .avatar { width: 32px; height: 32px; font: 600 12px var(--f-ui); background: #c9a96e; color: #3b2c0a; }
.me b { display: block; font-size: 13px; } .me small { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }

.main { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 16px; padding: 0 24px; height: 64px; border-bottom: 1px solid var(--line); flex: none; }
.top h2 { margin: 0; font: 500 22px/1 var(--f-display); letter-spacing: -0.01em; }
.top .sub { color: var(--muted); font-size: 13px; }
.top .grow { flex: 1; }
.seg { display: inline-flex; background: #ece8de; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 0 12px; min-height: 30px; border-radius: 8px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
.view { flex: 1; min-height: 0; display: none; }
.view.on { display: flex; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 12px; font-weight: 600; background: var(--paper); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.tag .dot { width: 6px; height: 6px; }
.tag.bot { background: var(--brand-soft); color: var(--brand-2); border-color: var(--brand-line); }
.tag.hum { background: #dde8f5; color: #234a7b; border-color: #c3d6ec; }
.tag.esp { background: var(--alert-soft); color: var(--alert); border-color: #f0c9bb; }
.tag.res { background: var(--ok-soft); color: var(--ok); border-color: #b9dfc9; }
.tag.warn { background: var(--warn-soft); color: var(--warn); border-color: #ecd9a4; }

/* bandeja */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 320px; width: 100%; min-height: 0; }
.clist { border-right: 1px solid var(--line); overflow-y: auto; min-height: 0; background: #faf8f4; }
.cl-h { display: flex; gap: 6px; padding: 12px 16px; position: sticky; top: 0; background: #faf8f4; z-index: 1; border-bottom: 1px solid var(--line); }
.cl-h button { border: 1px solid transparent; background: transparent; border-radius: 8px; min-height: 30px; padding: 0 10px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.cl-h button[aria-pressed="true"] { background: #fff; border-color: var(--line); color: var(--ink); }
.cl-h button b { color: var(--muted); font-weight: 600; margin-left: 4px; }
.ci { display: grid; grid-template-columns: 36px 1fr auto; gap: 4px 12px; padding: 12px 16px; border: 0; border-bottom: 1px solid var(--line); background: transparent; width: 100%; text-align: left; min-height: 68px; position: relative; }
.ci:hover { background: #fff; }
.ci[aria-current="true"] { background: #fff; box-shadow: inset 3px 0 0 var(--brand); }
.ci .av { grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; background: #e4dfd2; display: grid; place-items: center; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.ci .av.live { background: var(--brand); color: #fff; }
.ci .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.ci .ago { font-size: 12px; color: var(--muted); }
.ci .pv { grid-column: 2 / 4; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; min-width: 0; }
.ci .pv > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.ci .un { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--card); }
.th-h { display: flex; align-items: center; gap: 12px; padding: 0 24px; height: 64px; border-bottom: 1px solid var(--line); flex: none; }
.th-h b { font-size: 15px; } .th-h small { color: var(--muted); display: block; font-size: 12.5px; }
.th-h .grow { flex: 1; }
.tmsgs { flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; background: #fcfbf8; }
.tm { display: flex; flex-direction: column; max-width: 72%; gap: 4px; }
.tm.u { align-self: flex-start; }
.tm.b, .tm.a { align-self: flex-end; align-items: flex-end; }
.tm .bb { padding: 10px 14px; border-radius: 14px; font-size: 14px; white-space: pre-line; line-height: 1.45; }
.tm.u .bb { background: #fff; border: 1px solid var(--line); border-top-left-radius: 4px; }
.tm.b .bb { background: var(--brand-soft); border: 1px solid var(--brand-line); border-top-right-radius: 4px; }
.tm.a .bb { background: #dde8f5; border: 1px solid #c3d6ec; border-top-right-radius: 4px; }
.tm .meta { font-size: 11.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tm .meta .int { font-family: var(--f-ui); background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; height: 20px; display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 500; }
.tm .meta .int i { font-style: normal; color: var(--muted); }
.tm .card-sum { font-size: 12.5px; color: var(--brand-2); font-weight: 600; display: flex; gap: 6px; align-items: center; margin-bottom: 4px; }
.sysnote { align-self: center; font-size: 12.5px; color: var(--ink-2); background: #fff; border: 1px dashed var(--line-2); border-radius: 10px; padding: 6px 12px; display: flex; gap: 8px; align-items: center; }
.sysnote.ok { border-style: solid; border-color: #b9dfc9; background: var(--ok-soft); color: var(--ok); font-weight: 500; }
.sysnote.al { border-style: solid; border-color: #f0c9bb; background: var(--alert-soft); color: var(--alert); font-weight: 500; }
.reply { padding: 12px 24px 16px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex: none; background: #fff; }
.reply input { flex: 1; height: 44px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 14px; background: #fff; }
.reply input:disabled { background: var(--paper); }
.reply .hint { font-size: 12.5px; color: var(--muted); }
.det { border-left: 1px solid var(--line); overflow-y: auto; padding: 20px 20px 24px; background: #fff; min-height: 0; }
.det h4, .sec-t { margin: 22px 0 8px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.det h4:first-child { margin-top: 0; }
.det .pt { display: flex; gap: 12px; align-items: center; margin-bottom: 4px; }
.det .pt .av { width: 44px; height: 44px; border-radius: 50%; background: #e4dfd2; display: grid; place-items: center; font-weight: 600; }
.det .pt b { display: block; font-size: 16px; font-family: var(--f-display); font-weight: 500; }
.det dl { margin: 0; } .det dl div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.det dt { color: var(--muted); } .det dd { margin: 0; font-weight: 500; text-align: right; }
.conf { height: 6px; background: #ece8de; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.conf i { display: block; height: 100%; background: var(--brand); }
.acts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.empty { margin: auto; text-align: center; max-width: 320px; padding: 32px; color: var(--muted); }
.empty img { width: 100%; height: 150px; object-fit: cover; border-radius: 14px; margin-bottom: 16px; }
.empty h3 { margin: 0 0 6px; font: 500 20px var(--f-display); color: var(--ink); }
.empty p { margin: 0 0 14px; }

/* turnos */
.cal { display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 0; }
.cal-bar { display: flex; gap: 12px; align-items: center; padding: 12px 24px; border-bottom: 1px solid var(--line); flex: none; flex-wrap: wrap; }
.cal-bar .rng { font-weight: 600; font-size: 15px; min-width: 150px; text-align: center; }
.nbtn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--line-2); background: #fff; display: grid; place-items: center; }
.dfilter { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.dfilter button { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 12px; border-radius: 18px; border: 1px solid var(--line-2); background: #fff; font-weight: 500; font-size: 13px; }
.dfilter button[aria-pressed="false"] { opacity: .5; }
.dfilter i { width: 10px; height: 10px; border-radius: 3px; }
.calwrap { flex: 1; min-height: 0; overflow: auto; display: flex; }
.grid { display: grid; grid-template-columns: 56px repeat(6, minmax(120px, 1fr)); flex: 1; min-width: 780px; align-self: flex-start; }
.gh { position: sticky; top: 0; z-index: 3; background: var(--paper); border-bottom: 1px solid var(--line); padding: 8px 10px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.gh b { display: block; font: 500 22px/1.15 var(--f-display); color: var(--ink); letter-spacing: 0; text-transform: none; }
.gh.today b { color: var(--brand); } .gh.today::after { content: ''; display: block; width: 100%; height: 2px; background: var(--brand); margin-top: 4px; border-radius: 1px; }
.hrs { position: relative; border-right: 1px solid var(--line); }
.hrs span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11.5px; color: var(--muted); }
.col { position: relative; border-right: 1px solid var(--line); background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 55px, var(--line) 55px, var(--line) 56px); }
.col.closed { background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(22,35,31,0.035) 8px 9px); }
.ap { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 8px; font-size: 12px; line-height: 1.25; overflow: hidden; border: 0; text-align: left; border-left: 3px solid; display: block; }
.ap b { display: block; font-weight: 600; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ap span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.ap.d1 { background: var(--d1s); border-color: var(--d1); color: #0a3f3b; }
.ap.d2 { background: var(--d2s); border-color: var(--d2); color: #5b3b00; }
.ap.d3 { background: var(--d3s); border-color: var(--d3); color: #1f4474; }
.ap.tiny span { display: none; }
.ap.tiny { padding: 3px 4px 3px 5px; border-left-width: 2px; }
.ap.tiny b { font-size: 12px; }
.ap.nw { box-shadow: 0 0 0 2px var(--brand), 0 6px 14px rgba(15,92,87,.25); z-index: 2; }
.ap.nw::after { content: 'Nuevo'; position: absolute; right: 6px; top: 4px; font-size: 10.5px; font-weight: 700; background: var(--brand); color: #fff; padding: 0 6px; border-radius: 8px; }
.ap.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.nowline { position: absolute; left: 0; right: 0; height: 0; border-top: 2px solid var(--alert); z-index: 2; pointer-events: none; }
.nowline::before { content: ''; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--alert); }
.agenda { display: none; }
.drawer { position: absolute; right: 0; top: 64px; bottom: 0; width: 340px; background: #fff; border-left: 1px solid var(--line); box-shadow: -16px 0 32px rgba(22,35,31,.08); padding: 24px; z-index: 6; transform: translateX(0); animation: dr .2s ease-out; overflow-y: auto; }
@keyframes dr { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer h3 { margin: 0 0 4px; font: 500 22px var(--f-display); }
.drawer .x { position: absolute; right: 12px; top: 12px; }
.main { position: relative; }

/* derivaciones */
.queue { width: 100%; padding: 24px; overflow-y: auto; }
.q-sum { display: flex; gap: 32px; margin-bottom: 20px; }
.q-sum div b { display: block; font: 500 34px/1.1 var(--f-display); } .q-sum div span { color: var(--muted); font-size: 13px; }
table.tb { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tb th { text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #faf8f4; }
.tb td { padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; vertical-align: middle; }
.tb tr:last-child td { border-bottom: 0; }
.tb td.n, .tb th.n { text-align: right; }
.tb input { width: 130px; height: 32px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 8px; text-align: right; font-variant-numeric: tabular-nums; }
.tb td small { color: var(--muted); display: block; }
.wt { font-weight: 600; font-variant-numeric: tabular-nums; } .wt.hot { color: var(--alert); }

/* métricas */
.met { width: 100%; padding: 24px; overflow-y: auto; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.kpi { padding: 18px 20px 16px; border-right: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-right: 0; }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi b { display: block; font: 500 36px/1.15 var(--f-display); letter-spacing: -0.02em; margin: 4px 0 2px; }
.kpi em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ok); }
.kpi em.dn { color: var(--ok); }
.kpi svg { width: 100%; height: 36px; margin-top: 8px; display: block; }
.mg { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-top: 16px; }
.pan { border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 18px 20px; min-width: 0; }
.pan h3 { margin: 0; font-size: 14px; font-weight: 600; } .pan .sub { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; border-bottom: 1px solid var(--line-2); }
.bars i { flex: 1; background: #cdc7b8; border-radius: 3px 3px 0 0; min-height: 2px; transition: height .3s; }
.bars i.off { background: var(--brand); }
.bars i:hover { filter: brightness(.9); }
.axis { display: flex; gap: 4px; font-size: 11px; color: var(--muted); margin-top: 6px; }
.axis span { flex: 1; text-align: center; }
.hbar { display: grid; grid-template-columns: 130px 1fr 44px; gap: 10px; align-items: center; margin: 9px 0; font-size: 13.5px; }
.hbar div { height: 10px; background: #ece8de; border-radius: 5px; overflow: hidden; } .hbar div i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }
.hbar b { text-align: right; font-weight: 600; }
.unans { list-style: none; margin: 0; padding: 0; } .unans li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); font-size: 13.5px; } .unans li span:last-child { color: var(--muted); white-space: nowrap; }
.note { margin-top: 16px; background: var(--brand-soft); border: 1px solid var(--brand-line); border-radius: 12px; padding: 14px 18px; color: var(--brand-2); font-weight: 500; display: flex; gap: 12px; align-items: center; }

/* precios */
.prices { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; width: 100%; padding: 24px; overflow-y: auto; align-items: start; }
.clinic { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.clinic img { width: 100%; height: 190px; object-fit: cover; display: block; }
.clinic div { padding: 16px 18px 18px; } .clinic h3 { margin: 0 0 8px; font: 500 20px var(--f-display); } .clinic p { margin: 4px 0; color: var(--ink-2); font-size: 13.5px; }

.toast { position: fixed; right: 24px; top: 20px; z-index: 50; background: #1b2623; color: #fff; border-radius: 12px; padding: 12px 16px; box-shadow: 0 12px 32px rgba(0,0,0,.25); font-size: 13.5px; display: flex; gap: 12px; align-items: center; max-width: 360px; animation: in .25s ease-out; }
.toast b { display: block; font-weight: 600; } .toast span { color: #b9c7c2; font-size: 12.5px; }
.tabbar { display: none; }
.back { display: none; }
body.foto *, body.foto *::before, body.foto *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* ---------- ancho medio ---------- */
@media (max-width: 1699px) {
  .inbox { grid-template-columns: 320px minmax(0, 1fr); }
  .det { display: none; }
}
@media (max-width: 1399px) {
  #escena { grid-template-columns: 460px 1fr; }
  .phone { width: 372px; }
  .office { grid-template-columns: 200px 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); } .kpi:nth-child(2) { border-right: 0; } .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .mg, .prices { grid-template-columns: 1fr; }
}

/* ---------- celular ---------- */
@media (max-width: 1099px) {
  #escena { display: block; height: 100dvh; }
  .stage { padding: 0; background: #fff; border: 0; height: 100dvh; display: none; gap: 0; }
  .stage-cap { display: none; }
  .phone { width: 100%; height: 100%; min-height: 0; border: 0; border-radius: 0; box-shadow: none; padding-bottom: 60px; }
  .statusbar, .homebar { display: none; }
  body[data-v="chat"] .stage { display: flex; }
  body[data-v="chat"] .office { display: none; }
  body:not([data-v="chat"]) .stage { display: none; }
  .office { display: block; height: 100dvh; }
  .side { display: none; }
  .main { height: 100dvh; padding-bottom: 60px; }
  .top { padding: 0 16px; height: 56px; } .top h2 { font-size: 20px; } .top .sub { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 60px; background: #fff; border-top: 1px solid var(--line); z-index: 40; padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); text-decoration: none; min-height: 44px; position: relative; }
  .tabbar a[aria-current="page"] { color: var(--brand); }
  .tabbar a .n { position: absolute; top: 4px; left: calc(50% + 6px); background: var(--alert); color: #fff; min-width: 16px; height: 16px; border-radius: 8px; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; }
  .tabbar svg.i { width: 20px; height: 20px; }
  .chat-head { padding-top: 12px; }
  .inbox { display: block; position: relative; }
  .inbox .clist { height: 100%; border: 0; }
  .inbox .thread { position: absolute; inset: 0; display: none; z-index: 5; }
  .inbox.open .thread { display: flex; }
  .back { display: grid; }
  .th-h { padding: 0 8px; gap: 4px; } .th-h .tag { display: none; }
  .tmsgs { padding: 16px; } .tm { max-width: 88%; }
  .reply { padding: 8px 12px 12px; }
  .view.on { display: block; overflow-y: auto; }
  .view.on.inb { display: block; overflow: hidden; }
  .cal-bar { padding: 8px 16px; } .cal-bar .rng { min-width: 0; flex: 1; text-align: left; }
  .dfilter { margin-left: 0; width: 100%; } .calwrap { display: none; }
  .agenda { display: block; padding: 8px 16px 24px; }
  .ag-day { font: 500 18px var(--f-display); margin: 20px 0 8px; display: flex; justify-content: space-between; align-items: baseline; }
  .ag-day small { font: 500 12px var(--f-ui); color: var(--muted); }
  .ag { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); min-height: 56px; align-items: center; width: 100%; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; }
  .ag time { font-weight: 600; font-variant-numeric: tabular-nums; }
  .ag div { border-left: 3px solid; padding-left: 10px; } .ag div small { display: block; color: var(--muted); }
  .drawer { top: auto; bottom: 60px; left: 0; width: 100%; max-height: 70%; border-radius: 18px 18px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .queue, .met, .prices { padding: 16px; }
  .q-sum { gap: 24px; }
  .tb thead { display: none; } .tb, .tb tbody, .tb tr, .tb td { display: block; width: 100%; }
  .tb tr { padding: 14px 16px; border-bottom: 1px solid var(--line); } .tb td { border: 0; padding: 3px 0; }
  .tb td.n { text-align: left; }
  .kpis { grid-template-columns: repeat(2, 1fr); } .kpi { padding: 14px; } .kpi b { font-size: 28px; }
  .kpi:nth-child(2) { border-right: 0; } .kpi:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .mg, .prices { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 96px 1fr 40px; }
  .toast { left: 12px; right: 12px; top: 12px; max-width: none; }
  .prices .tb tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
  .prices .tb td:first-child { grid-column: 1 / 3; font-weight: 600; }
  .prices .tb input { width: 120px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.qgrid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 32px; align-items: start; }
.rules { border: 1px solid var(--line); border-radius: 14px; background: #fff; padding: 20px; }
.rules h3 { margin: 0 0 4px; font: 500 20px var(--f-display); } .rules p { margin: 0 0 8px; color: var(--muted); font-size: 13px; }
.rule { display: grid; grid-template-columns: 1fr auto 40px; gap: 10px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.rule b { display: block; font-size: 13.5px; } .rule small { color: var(--muted); font-size: 12.5px; display: block; line-height: 1.35; }
.rule .cnt { font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.sw { appearance: none; width: 36px; height: 22px; border-radius: 11px; background: var(--line-2); position: relative; cursor: pointer; transition: background .15s; margin: 0; }
.sw::after { content: ''; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw:checked { background: var(--brand); } .sw:checked::after { transform: translateX(14px); }
@media (max-width: 1399px) { .qgrid { grid-template-columns: 1fr; } }
@media (max-width: 1099px) { .qgrid { display: block; } .rules { margin-top: 24px; } .tb td.n.wt { margin-top: 2px; } }

.tabbar .n[hidden] { display: none !important; }
