/* Tema neutro de Astryx (sistema de diseño de Meta) — mismos valores que Orbital Listening (web/styles/tokens.css). */
:root {
  --bg: #f1f1f1; --panel: #fff; --panel2: #f1f1f1;
  --ink: #000; --muted: #474747; --faint: #919191;
  --line: #00000014; --line-strong: #d4d4d4;
  --btn-bg: #1b1b1b; --btn-ink: #fff; --accent: #1b1b1b; --link: #0067ce;
  --brand: #1aa37a; --neg: #c9303a;
  --pos-muted: #bce0bb; --on-pos-muted: #00490b; --neg-muted: #ffc4be; --on-neg-muted: #76000c;
  --neu-muted: #e2e2e2; --on-neu-muted: #1b1b1b; --warn-muted: #fae19e; --on-warn-muted: #4b3900;
  --info-muted: #b9d7ff; --on-info-muted: #003978;
  --overlay-hover: #0000000d; --overlay-pressed: #0000001a;
  --bubble: #d9fdd3; --on-bubble: #111b21;
  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;
  --size-sm: 28px; --size-md: 32px; --size-lg: 36px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .06);
  --shadow-md: 0 4px 12px -2px rgb(0 0 0 / .10), 0 2px 4px -2px rgb(0 0 0 / .06);
  --ease: cubic-bezier(.24, 1, .4, 1); --dur: .175s;
  --font: 'Figtree Variable', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
:root[data-theme='dark'] {
    --bg: #1b1b1b; --panel: #262626; --panel2: #303030;
    --ink: #fff; --muted: #9e9e9e; --faint: #6a6a6a;
    --line: #ffffff1a; --line-strong: #525252;
    --btn-bg: #f1f1f1; --btn-ink: #111; --accent: #f1f1f1; --link: #a1caff;
    --brand: #34d399; --neg: #ff705d;
    --pos-muted: #2b422b; --on-pos-muted: #90ca90; --neg-muted: #5b2b28; --on-neg-muted: #ffaea7;
    --neu-muted: #3a3a3a; --on-neu-muted: #d4d4d4; --warn-muted: #453a1c; --on-warn-muted: #eec448;
    --info-muted: #253c5a; --on-info-muted: #a1caff;
    --overlay-hover: #ffffff0d; --overlay-pressed: #ffffff1a;
    --bubble: #005c4b; --on-bubble: #e9edef;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .3);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / .45), 0 2px 4px -2px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #1b1b1b; --panel: #262626; --panel2: #303030;
    --ink: #fff; --muted: #9e9e9e; --faint: #6a6a6a;
    --line: #ffffff1a; --line-strong: #525252;
    --btn-bg: #f1f1f1; --btn-ink: #111; --accent: #f1f1f1; --link: #a1caff;
    --brand: #34d399; --neg: #ff705d;
    --pos-muted: #2b422b; --on-pos-muted: #90ca90; --neg-muted: #5b2b28; --on-neg-muted: #ffaea7;
    --neu-muted: #3a3a3a; --on-neu-muted: #d4d4d4; --warn-muted: #453a1c; --on-warn-muted: #eec448;
    --info-muted: #253c5a; --on-info-muted: #a1caff;
    --overlay-hover: #ffffff0d; --overlay-pressed: #ffffff1a;
    --bubble: #005c4b; --on-bubble: #e9edef;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / .3);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / .45), 0 2px 4px -2px rgb(0 0 0 / .3);
    color-scheme: dark;
  }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; } }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--link); }

main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 32px 80px; }
@media (max-width: 760px) { main { padding: 18px 16px 60px; } }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head > div { margin-right: auto; }
h1 { font-size: 22px; font-weight: 600; margin: 0 0 2px; letter-spacing: -.01em; }
.sub { margin: 0; color: var(--muted); }

.cols { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.cols aside { position: sticky; top: 24px; }
@media (max-width: 900px) { .cols { grid-template-columns: minmax(0, 1fr); } .cols aside { position: static; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px 22px; margin-bottom: 16px; }
.card h2 { font-size: 17px; font-weight: 600; margin: 0 0 2px; display: flex; align-items: center; gap: 10px; }
.card h2 .n { width: 22px; height: 22px; border-radius: 50%; background: var(--panel2); color: var(--muted); font-size: 12px; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.card .hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
@media (max-width: 640px) { .card { padding: 16px; } }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: minmax(0, 1fr); } }

label, .label { display: block; font-size: 13px; font-weight: 500; margin: 0 0 6px; }
.help { display: block; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=tel], input[type=password], select, textarea {
  width: 100%; background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius);
  font: 14px var(--font); padding: 0 12px; outline: none; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
input[type=text], input[type=tel], input[type=password], select { height: var(--size-lg); }
select { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23919191' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
textarea { padding: 9px 12px; resize: vertical; min-height: 110px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--overlay-pressed); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 13px; }

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--size-md); padding: 0 14px; border-radius: var(--radius); font: 500 14px var(--font); cursor: pointer; text-decoration: none;
  border: 1px solid transparent; background: var(--btn-bg); color: var(--btn-ink); white-space: nowrap;
  transition: box-shadow var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
button:hover, .btn:hover { box-shadow: inset 0 0 0 100px var(--overlay-hover); }
button:active, .btn:active { box-shadow: inset 0 0 0 100px var(--overlay-pressed); }
button:disabled { opacity: .4; cursor: default; box-shadow: none; }
button.lg { height: var(--size-lg); padding: 0 18px; }
button.ghost, .btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line-strong); }
button.flat { background: transparent; color: var(--ink); }
button.block { width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

.seg { display: inline-flex; background: var(--panel2); border-radius: var(--radius); padding: 3px; gap: 2px; }
.seg button { height: var(--size-sm); background: transparent; color: var(--muted); border: 0; border-radius: var(--radius-sm); padding: 0 12px; }
.seg button[aria-pressed=true] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }
.card .seg { margin-bottom: 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); }
.chip.on { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.chip .c { color: inherit; opacity: .6; margin-left: 2px; font-variant-numeric: tabular-nums; }

.banner { border-radius: var(--radius); padding: 10px 12px; font-size: 13px; margin-top: 12px; }
.banner b { font-weight: 600; }
.banner.warn { background: var(--warn-muted); color: var(--on-warn-muted); }
.banner.info { background: var(--info-muted); color: var(--on-info-muted); }
.banner.neg { background: var(--neg-muted); color: var(--on-neg-muted); }
.banner.pos { background: var(--pos-muted); color: var(--on-pos-muted); }
.banner code { background: transparent; padding: 0; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--panel2); padding: 1px 5px; border-radius: 6px; }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.neu { background: var(--neu-muted); color: var(--on-neu-muted); }
.pill.info { background: var(--info-muted); color: var(--on-info-muted); }
.pill.pos { background: var(--pos-muted); color: var(--on-pos-muted); }
.pill.neg { background: var(--neg-muted); color: var(--on-neg-muted); }
.pill.warn { background: var(--warn-muted); color: var(--on-warn-muted); }

/* Carga de archivo */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 28px 16px; background: var(--panel2);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.drop:hover, .drop.over { border-color: var(--accent); }
.drop b { font-weight: 600; }
.drop small { color: var(--muted); }
.file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); }
.file .i { flex: 1; min-width: 0; }
.file .i b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file .i small { color: var(--muted); font-variant-numeric: tabular-nums; }
.file .ico { width: 34px; height: 34px; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; flex: none; }

/* Tablas */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; max-height: 520px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { position: sticky; top: 0; background: var(--panel2); font-weight: 500; color: var(--muted); font-size: 12px; white-space: nowrap; z-index: 1; }
tr:last-child td { border-bottom: 0; }
td.num { color: var(--muted); width: 1%; white-space: nowrap; }
td.det { color: var(--muted); min-width: 220px; }
td.det.neg { color: var(--neg); }
td.nw { white-space: nowrap; }

/* Indicadores */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.stats > div { padding: 14px 16px; border-left: 1px solid var(--line); }
.stats > div:first-child { border-left: 0; }
.stats .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.stats .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.stats .v.neg { color: var(--neg); }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(3, 1fr); } .stats > div:nth-child(4) { border-left: 0; } .stats > div:nth-child(n+4) { border-top: 1px solid var(--line); } }
.progress { height: 6px; background: var(--panel2); border-radius: 999px; overflow: hidden; display: flex; margin: 4px 0 6px; }
.progress span { display: block; height: 100%; transition: width .4s var(--ease); }
.progress .p-ok { background: var(--brand); }
.progress .p-cur { background: var(--faint); }
.progress .p-bad { background: var(--neg); }

.mini-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* Vista previa estilo chat */
.phone { background: var(--panel2); border-radius: var(--radius); padding: 14px; min-height: 120px; display: flex; flex-direction: column; gap: 8px; }
.bubble { align-self: flex-end; max-width: 92%; background: var(--bubble); color: var(--on-bubble); border-radius: 10px 10px 2px 10px; padding: 8px 10px 6px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; box-shadow: var(--shadow-sm); }
.bubble .meta { display: block; text-align: right; font-size: 11px; opacity: .6; margin-top: 2px; }
.bubble .var { background: rgb(0 0 0 / .08); border-radius: 4px; padding: 0 2px; }
.bubble .var.miss { background: var(--neg-muted); color: var(--on-neg-muted); }
.phone .for { font-size: 12px; color: var(--muted); text-align: right; }
.empty { color: var(--muted); font-size: 13px; text-align: center; padding: 24px 8px; }
.side h3 { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.fmt-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.fmt-row .counter { margin: 0; }
.bubble b { font-weight: 700; }
.bubble .wa-mono { font-family: var(--mono); font-size: 12.5px; background: transparent; padding: 0; }
.counter { font-size: 12px; color: var(--muted); text-align: right; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Historial */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); cursor: pointer; text-decoration: none; color: inherit; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--overlay-hover); }
.list-row .i { flex: 1; min-width: 0; }
.list-row .i b { display: block; font-weight: 600; }
.list-row .i small { color: var(--muted); font-variant-numeric: tabular-nums; }

.toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: 380px; background: var(--btn-bg); color: var(--btn-ink); border-radius: var(--radius); padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow-md); opacity: 0; transform: translateY(8px); transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease); pointer-events: none; }
.toast.on { opacity: 1; transform: none; }
details.more { margin-top: 12px; font-size: 13px; color: var(--muted); }
details.more summary { cursor: pointer; color: var(--ink); font-weight: 500; }
details.more ul { margin: 8px 0 0; padding-left: 18px; }
.spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(1turn); } }

/* Respuestas: maestro-detalle (lista a la izquierda, conversación a la derecha) */
.inbox { display: grid; grid-template-columns: 320px minmax(0, 1fr); padding: 0; overflow: hidden; height: calc(100vh - 230px); min-height: 460px; }
.inbox-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.inbox-search { padding: 12px; border-bottom: 1px solid var(--line); }
#rLista { overflow-y: auto; flex: 1; }
.conv { display: flex; gap: 10px; align-items: flex-start; width: 100%; height: auto; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 400; }
.conv[aria-current=true] { background: var(--panel2); }
.conv .av { width: 36px; height: 36px; border-radius: 50%; background: var(--panel2); color: var(--muted); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.conv[aria-current=true] .av { background: var(--panel); }
.conv .i { flex: 1; min-width: 0; }
.conv .top-line { display: flex; gap: 8px; align-items: baseline; }
.conv .top-line b { font-weight: 600; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv .top-line small { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.conv .snip { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.conv .snip .txt { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv.unread .top-line b, .conv.unread .snip .txt { color: var(--ink); }
.badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-head .i { flex: 1; min-width: 0; }
.chat-head b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .win { display: none; }
.chat-head small { color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--panel2); }
.chat-msgs .day { align-self: center; font-size: 11.5px; color: var(--muted); background: var(--panel); border-radius: 999px; padding: 2px 10px; margin: 8px 0 4px; box-shadow: var(--shadow-sm); }
.chat-msgs .sys { align-self: center; font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0; }
.msg { max-width: 75%; padding: 7px 10px 5px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; box-shadow: var(--shadow-sm); }
.msg.in { align-self: flex-start; background: var(--panel); border-top-left-radius: 2px; }
.msg.out { align-self: flex-end; background: var(--bubble); color: var(--on-bubble); border-top-right-radius: 2px; }
.msg .meta { display: block; text-align: right; font-size: 11px; opacity: .6; margin-top: 2px; }
.msg .att { display: block; font-size: 12.5px; opacity: .8; margin-top: 2px; }
.msg .err { display: block; font-size: 12px; color: var(--neg); margin-top: 2px; }
.composer { border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 40px; height: 40px; max-height: 160px; resize: none; }
.composer button { height: 40px; }
.chat .banner { margin: 0; border-radius: 0; }
.back { display: none; }
@media (max-width: 760px) {
  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 180px); }
  .inbox.open .inbox-list { display: none; }
  .inbox:not(.open) .chat { display: none; }
  .inbox-list { border-right: 0; }
  .back { display: inline-flex; }
  .chat-head > .pill { display: none; }
  .chat-head .win { display: inline; }
  .chat-head .av { display: none !important; }
}

/* ============ Armazón: menú lateral + contenido (como Orbital Listening) ============ */
.app-shell { display: flex; align-items: stretch; min-height: 100vh; }
.sidebar { width: 240px; flex: none; display: flex; flex-direction: column; background: var(--panel); border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 70; }
.sidebar-head { padding: 18px 16px 12px; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 15px; letter-spacing: -.01em; white-space: nowrap; }
.logo b { color: var(--brand); font-weight: 600; }
.logo img { flex: none; border-radius: 7px; }
.org-tag { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 500; margin-top: 10px; min-height: 18px; }
.org-tag .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.org-tag .dot.on { background: var(--brand); }
.org-tag .dot.off { background: var(--neg); }
.org-tag span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidenav { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 6px 12px; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-label { padding: 14px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.nav-group:first-child .nav-group-label { padding-top: 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: auto; padding: 8px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; color: var(--muted); font: 500 14px var(--font); text-decoration: none; text-align: left; cursor: pointer; box-shadow: none; }
.nav-item:hover { background: var(--overlay-hover); color: var(--ink); box-shadow: none; }
.nav-item.active { background: var(--panel2); color: var(--ink); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--ink); }
.nav-icon { width: 17px; height: 17px; flex: none; display: flex; }
.nav-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-chev { display: flex; color: var(--muted); transition: transform var(--dur) var(--ease); transform: rotate(-90deg); }
.nav-parent[aria-expanded=true] .nav-chev { transform: none; }
.nav-parent.active[aria-expanded=true] { background: transparent; }
.nav-sub { display: flex; flex-direction: column; gap: 1px; margin: 2px 0 4px 18px; padding-left: 8px; border-left: 1px solid var(--line); }
.nav-sub-item { padding: 6px 10px; font-size: 13px; gap: 9px; }
.nav-sub-item .nav-icon, .nav-sub-item .nav-icon svg { width: 15px; height: 15px; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.foot-identity { display: flex; align-items: center; gap: 9px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--btn-bg); color: var(--btn-ink); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.foot-identity-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.foot-identity-text span { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-identity-text small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.foot-icon-btn { width: 30px; height: 30px; padding: 0; flex: none; }
.foot-icon-btn svg { width: 15px; height: 15px; }
.foot-theme { display: flex; align-items: center; justify-content: space-between; }
.slide-switch { position: relative; flex: none; width: 46px; height: 24px; padding: 0; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); box-shadow: none; }
.slide-switch:hover { box-shadow: none; border-color: var(--line-strong); }
.slide-switch .sw-side { position: absolute; top: 50%; transform: translateY(-50%); width: 12px; height: 12px; color: var(--muted); pointer-events: none; }
.slide-switch .sw-left { left: 6px; } .slide-switch .sw-right { right: 6px; }
.slide-switch .sw-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); box-shadow: var(--shadow-sm); transition: transform var(--dur) var(--ease); }
:root[data-theme='light'] .slide-switch .sw-thumb { transform: translateX(22px); }
@media (prefers-color-scheme: light) { :root:not([data-theme='dark']) .slide-switch .sw-thumb { transform: translateX(22px); } }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.badge { flex: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 600; display: grid; place-items: center; font-variant-numeric: tabular-nums; }
.icon-btn { width: 34px; padding: 0; }
.drawer-scrim { display: none; }
@media (max-width: 760px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform var(--dur) var(--ease); box-shadow: var(--shadow-md); }
  .app-shell.drawer-open .sidebar { transform: none; }
  .app-shell.drawer-open .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 65; background: rgb(0 0 0 / .4); }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20; height: 52px; padding: 0 12px; background: var(--panel); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px; }
  .inbox { height: calc(100vh - 230px); }
}

/* ============ Configuración ============ */
.set-section h2 { font-size: 17px; font-weight: 600; margin: 0 0 2px; }
.set-row { display: flex; gap: 24px; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); }
.set-row:first-child { padding-top: 0; } .set-row:last-child { border-bottom: 0; padding-bottom: 0; }
.set-row > div:first-child { min-width: 0; } .set-row b { font-weight: 600; }
.set-ctl { display: flex; gap: 8px; align-items: center; flex: none; max-width: 60%; }
.set-ctl input { width: 280px; max-width: 100%; }
.ro { color: var(--ink); font-variant-numeric: tabular-nums; word-break: break-all; text-align: right; }
@media (max-width: 640px) { .set-row { flex-direction: column; align-items: stretch; gap: 8px; } .set-ctl { max-width: none; } .set-ctl input { width: 100%; } .ro { text-align: left; } }
.pass { position: relative; display: flex; gap: 6px; }
.pass input { flex: 1; }
.pass .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); height: 28px; width: 28px; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 400; cursor: pointer; min-height: 36px; margin: 0; }
.check input { appearance: none; width: 18px; height: 18px; margin: 0; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--panel); display: grid; place-content: center; cursor: pointer; flex: none; }
.check input:checked { background: var(--btn-bg); border-color: var(--btn-bg); }
.check input:checked::after { content: ""; width: 9px; height: 5px; border: 2px solid var(--btn-ink); border-top: 0; border-right: 0; transform: translateY(-1px) rotate(-45deg); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions button { height: 28px; font-size: 13px; padding: 0 10px; }
td .who { display: flex; align-items: center; gap: 10px; }
td .who .avatar { width: 28px; height: 28px; font-size: 11px; background: var(--panel2); color: var(--muted); }
td .who b { display: block; font-weight: 600; }
td .who small { color: var(--muted); }

/* ============ Plantillas ============ */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 640px) { .tpl-grid { grid-template-columns: minmax(0, 1fr); } }
.tpl { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.tpl-head { display: flex; gap: 10px; align-items: flex-start; }
.tpl-head .i { flex: 1; min-width: 0; }
.tpl-head b { display: block; font-weight: 600; font-size: 15px; word-break: break-all; }
.tpl-head small { color: var(--muted); font-size: 12.5px; }
.tpl .phone { min-height: 0; flex: 1; }
.tpl .bubble { max-width: 100%; align-self: stretch; font-size: 13px; }
.tpl-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tpl-foot .help { margin: 0 auto 0 0; }
.tpl .reject { background: var(--neg-muted); color: var(--on-neg-muted); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }

/* ============ Login ============ */
.login-body { background: var(--bg); }
.login { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.login-hero { position: relative; overflow: hidden; background: #0b1411; color: #e9efe9; padding: 40px 48px; display: flex; flex-direction: column; gap: 28px; }
.login-hero::before { content: ""; position: absolute; width: 640px; height: 640px; right: -220px; bottom: -260px; border-radius: 50%; background: radial-gradient(circle, rgb(77 203 123 / .35), transparent 65%); pointer-events: none; }
.login-hero .logo b { color: #4dcb7b; }
.hero-copy { margin-top: auto; max-width: 460px; position: relative; }
.hero-copy h2 { font-size: 34px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; margin: 0 0 12px; color: #fff; }
.hero-copy p { margin: 0; color: #b7c4bb; font-size: 15px; }
.hero-chat { display: flex; flex-direction: column; gap: 8px; max-width: 360px; margin-bottom: auto; position: relative; }
.hero-bubble { align-self: flex-end; background: #005c4b; color: #e9edef; border-radius: 10px 10px 2px 10px; padding: 9px 12px; font-size: 14px; box-shadow: 0 6px 20px rgb(0 0 0 / .3); }
.hero-bubble.in { align-self: flex-start; background: #202c33; border-radius: 10px 10px 10px 2px; }
.hero-foot { color: #7f8f85; position: relative; }
.login-main { display: grid; place-items: center; padding: 32px 20px; }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 26px; margin: 0; }
.login-card .sub { margin: -6px 0 6px; }
.login-card .field label { margin-bottom: 6px; }
.login-card input { height: 40px !important; }
.login-card button.lg { height: 40px; margin-top: 4px; }
.login-card .banner { margin: 0; }
.login-note { text-align: center; margin: 4px 0 0; }
.login-logo-sm { display: none; margin-bottom: 8px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-hero { display: none; } .login-logo-sm { display: flex; } }

/* ============ Envío manual ============ */
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
button.sm, .btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.manual-bar { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.manual-bar .i { flex: 1; min-width: 240px; }
.manual-bar .i b { display: block; font-size: 15px; font-weight: 600; }
.manual-bar .i small { color: var(--muted); }
.manual-bar .btn.lg { height: var(--size-lg); padding: 0 18px; }
.manual-bar .banner { flex-basis: 100%; margin: 0; }
td .acts { display: flex; gap: 6px; justify-content: flex-end; }

/* ============ Opciones claras (Automático / Desde mi WhatsApp) ============ */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
@media (max-width: 640px) { .choice { grid-template-columns: minmax(0, 1fr); } }
.choice-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: auto; padding: 14px 16px; text-align: left; white-space: normal;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line-strong); border-radius: var(--radius); font-weight: 400; }
.choice-card b { font-weight: 600; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.choice-card b::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; box-sizing: border-box; }
.choice-card span { color: var(--muted); font-size: 13px; line-height: 1.4; }
.choice-card[aria-pressed=true] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.choice-card[aria-pressed=true] b::before { border: 5px solid var(--accent); }
.link-btn { height: auto; padding: 0; background: none; border: 0; color: var(--link); font: 500 13px var(--font); cursor: pointer; text-decoration: none; box-shadow: none !important; }
.link-btn:hover { text-decoration: underline; }
#verTexto { margin: 2px 0 12px; }

/* Variables de la plantilla: "¿Qué va en {{1}}?" con un selector de columna */
.var-row { display: grid; grid-template-columns: minmax(180px, 38%) minmax(0, 1fr); gap: 12px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.var-row:first-child { border-top: 0; }
.var-row .var-lbl b { display: block; font-weight: 600; font-size: 13.5px; }
.var-row .var-lbl small { color: var(--muted); font-size: 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.var-row input { margin-top: 8px; }
@media (max-width: 640px) { .var-row { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* Resumen antes de enviar */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 14px; overflow: hidden; }
.summary > div { padding: 12px 14px; border-left: 1px solid var(--line); }
.summary > div:first-child { border-left: 0; }
.summary .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.summary .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.summary .s { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .summary { grid-template-columns: 1fr 1fr; } .summary > div:nth-child(3) { border-left: 0; } .summary > div:nth-child(n+3) { border-top: 1px solid var(--line); } }

/* ============ Inicio ============ */
.stats.stats-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) { .stats.stats-4 { grid-template-columns: 1fr 1fr; } .stats.stats-4 > div:nth-child(3) { border-left: 0; } .stats.stats-4 > div:nth-child(n+3) { border-top: 1px solid var(--line); } }
.stats .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 760px) { .quick { grid-template-columns: minmax(0, 1fr); } }
.quick-card { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; height: auto; padding: 18px 20px; text-align: left; white-space: normal; text-decoration: none;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); font-weight: 400; cursor: pointer;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.quick-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.quick-card b { font-size: 15px; font-weight: 600; margin-top: 8px; }
.quick-card > span:not(.q-ico) { color: var(--muted); font-size: 13px; }
.q-ico { width: 40px; height: 40px; border-radius: var(--radius); background: var(--panel2); display: grid; place-items: center; color: var(--ink); }
.quick-card.primary { background: var(--btn-bg); color: var(--btn-ink); border-color: var(--btn-bg); }
.quick-card.primary > span:not(.q-ico) { color: var(--btn-ink); opacity: .75; }
.quick-card.primary .q-ico { background: rgb(255 255 255 / .12); color: var(--btn-ink); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.env-row { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.env-row:first-child { border-top: 0; }
.env-row:hover b { text-decoration: underline; }
.env-row b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.env-row small { color: var(--muted); font-variant-numeric: tabular-nums; }
.env-row .progress { margin: 0; }
@media (max-width: 640px) { .env-row { grid-template-columns: minmax(0, 1fr) auto; } .env-row .progress { display: none; } }

/* ============ Consumo ============ */
.c-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .c-grid { grid-template-columns: minmax(0, 1fr); } }
.c-card { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.c-card .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 500; }
.c-card .big { font-size: 32px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.1; }
.c-card .big small { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.c-card p { margin: 0; color: var(--muted); font-size: 13px; }
.meter { height: 8px; border-radius: 999px; background: var(--panel2); overflow: hidden; margin: 6px 0 2px; }
.meter span { display: block; height: 100%; background: var(--brand); border-radius: 999px; transition: width .4s var(--ease); }
.meter.warn span { background: var(--warn, #836700); }
.meter.full span { background: var(--neg); }
.breakdown { display: flex; flex-direction: column; margin-top: 6px; }
.breakdown div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; font-variant-numeric: tabular-nums; }
.breakdown div:first-child { border-top: 0; }
.breakdown span { color: var(--muted); }

/* ============ Ventana de prueba ============ */
dialog.modal { border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--panel); color: var(--ink); box-shadow: var(--shadow-xl, 0 24px 48px -12px rgb(0 0 0 / .22)); width: min(480px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog.modal::backdrop { background: rgb(0 0 0 / .4); }
.modal-in { padding: 20px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-in .hint { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.modal-in .phone { min-height: 0; max-height: 240px; overflow-y: auto; }
.modal-in .bubble { font-size: 13px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.steps { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.steps span { flex: 1; text-align: center; padding: 8px 6px; font-size: 12.5px; color: var(--muted); border-left: 1px solid var(--line); background: var(--panel); }
.steps span:first-child { border-left: 0; }
.steps span.done { background: var(--pos-muted); color: var(--on-pos-muted); font-weight: 600; }
.steps span.now { color: var(--ink); font-weight: 600; }
.steps span.bad { background: var(--neg-muted); color: var(--on-neg-muted); font-weight: 600; }
