/* Instrument Serif (OFL), servida desde acá: sin pedirle nada a Google antes de pintar. */
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/serif-latin-ext.woff2?v=a0ca5e485ac9) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/serif-latin.woff2?v=6c8e8a291bdd) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/serif-italic-latin-ext.woff2?v=d30d32243e6f) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Instrument Serif';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/serif-italic-latin.woff2?v=bd51d639d9f2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* wali — oscuro a propósito: es una app de llamada. La cara de Lisa es una nube con ojos, en los azules de SaveMoney. */

@property --spin {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}

:root {
  color-scheme: dark;
  --bg: #07060a;
  --bg-2: #100d17;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.08);
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --text: #f5f1ea;
  --muted: #a8a2b0;
  --faint: #7a7483;
  --blue: #3c7bff;
  --blue-2: #2454f8;
  --sky: #64afff;
  --ice: #b8d7ff;
  --violet: #8f7dff;
  --teal: #5ce1c6;
  --red: #ff4d5e;
  --radius: 22px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, 'Segoe UI', sans-serif;
  --display: 'Instrument Serif', 'New York', ui-serif, Georgia, serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --z-app: 10;
  --z-fab: 20;
  --z-sheet: 40;
  --z-pill: 45;
  --z-call: 50;
  --z-toast: 60;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ice);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.mono {
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-all;
}

/* ---------- fondo: aurora lenta + grano ---------- */

.aurora {
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.6;
  transition: opacity 1.2s var(--ease-io);
}
.aurora i {
  position: absolute;
  width: 70vmax;
  height: 70vmax;
  border-radius: 50%;
  will-change: transform;
  animation: drift 40s var(--ease-io) infinite alternate;
}
.aurora i:nth-child(1) {
  background: radial-gradient(closest-side, rgba(60, 123, 255, 0.3), transparent 72%);
  top: -8%;
  left: -12%;
}
.aurora i:nth-child(2) {
  background: radial-gradient(closest-side, rgba(143, 125, 255, 0.24), transparent 72%);
  top: 28%;
  right: -22%;
  animation-duration: 48s;
  animation-delay: -14s;
}
.aurora i:nth-child(3) {
  background: radial-gradient(closest-side, rgba(92, 225, 198, 0.13), transparent 72%);
  bottom: -18%;
  left: 8%;
  animation-duration: 56s;
  animation-delay: -26s;
}
body.in-call .aurora {
  opacity: 0.25;
}
@keyframes drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(9vmax, 6vmax, 0) scale(1.12);
  }
  100% {
    transform: translate3d(-7vmax, 11vmax, 0) scale(0.94);
  }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* ---------- contenedor: sigue al viewport visible (teclado de iOS) ---------- */

#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-app);
  height: var(--vvh, 100dvh);
  transform: translateY(var(--vvt, 0px));
  view-transition-name: app;
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  max-width: 720px;
  margin: 0 auto;
}
.view.enter {
  animation: view-in 0.5s var(--ease-out) both;
}
.view.enter-back {
  animation: view-in-back 0.5s var(--ease-out) both;
}
@keyframes view-in {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
}
@keyframes view-in-back {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
}

::view-transition-old(app),
::view-transition-new(app) {
  animation-duration: 0.46s;
  animation-timing-function: var(--ease-out);
}
html[data-dir='fwd']::view-transition-old(app) {
  animation-name: vt-out-left;
}
html[data-dir='fwd']::view-transition-new(app) {
  animation-name: vt-in-right;
}
html[data-dir='back']::view-transition-old(app) {
  animation-name: vt-out-right;
}
html[data-dir='back']::view-transition-new(app) {
  animation-name: vt-in-left;
}
@keyframes vt-out-left {
  to {
    opacity: 0;
    transform: translateX(-18%) scale(0.98);
  }
}
@keyframes vt-in-right {
  from {
    opacity: 0;
    transform: translateX(22%);
  }
}
@keyframes vt-out-right {
  to {
    opacity: 0;
    transform: translateX(22%);
  }
}
@keyframes vt-in-left {
  from {
    opacity: 0;
    transform: translateX(-18%) scale(0.98);
  }
}

/* ---------- piezas comunes ---------- */

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition:
    background 0.2s,
    transform 0.2s var(--ease-out);
}
.icon-btn:active {
  background: var(--surface-2);
  transform: scale(0.92);
}
.icon-btn.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.icon-btn.ghost {
  pointer-events: none;
}

.btn {
  height: 54px;
  border-radius: 18px;
  font-weight: 600;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 20px;
  transition:
    transform 0.2s var(--ease-out),
    filter 0.2s,
    background 0.2s;
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.6;
  cursor: default;
}
.btn-primary {
  background: linear-gradient(135deg, #4f8bff, var(--blue-2) 55%, #64afff);
  color: #ffffff;
  box-shadow:
    0 10px 30px -10px rgba(36, 84, 248, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-ghost {
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.btn-quiet {
  color: var(--muted);
  height: 46px;
}
.btn.small {
  height: 48px;
  padding: 0 18px;
  font-size: 15px;
}

.field {
  width: 100%;
  height: 54px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 0 18px;
  font: 16px var(--font);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}
.field:focus {
  border-color: rgba(90, 150, 255, 0.7);
  box-shadow: 0 0 0 4px rgba(60, 123, 255, 0.15);
}
.field::placeholder {
  color: var(--faint);
}

/* ---------- entrar ---------- */

.login {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.login h1 {
  font: italic 400 72px/1 var(--display);
  margin: 26px 0 6px;
  letter-spacing: -0.01em;
}
.login-actions {
  width: 100%;
  max-width: 340px;
  display: grid;
  gap: 12px;
  margin-top: 30px;
}
.login-err {
  min-height: 22px;
  margin: 0;
  color: #ff9aa4;
  font-size: 14px;
}
.shake {
  animation: shake 0.42s var(--ease-out);
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-8px);
  }
  40%,
  80% {
    transform: translateX(8px);
  }
}

.big-orb,
.empty-orb {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #eef5ff 0 6%, transparent 22%),
    radial-gradient(circle at 50% 50%, #7fb2ff 0%, #2454f8 42%, #0f2a7a 78%, #050c26 100%);
  box-shadow:
    0 0 80px -10px rgba(36, 84, 248, 0.55),
    0 0 160px -30px rgba(143, 125, 255, 0.45),
    inset 0 -14px 30px rgba(0, 0, 0, 0.35);
  animation: breathe 4.8s var(--ease-io) infinite;
  position: relative;
}
.big-orb::after,
.empty-orb::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(200, 225, 255, 0.35) 70%, transparent 85%);
  mix-blend-mode: screen;
  animation: spin 9s linear infinite;
}
@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- inicio ---------- */

.home-head {
  padding: calc(var(--safe-t) + 22px) 22px 4px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.brand {
  font: 600 12px/1 var(--font);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  display: inline-flex;
  gap: 9px;
  align-items: center;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  animation: ping 2.6s var(--ease-out) infinite;
}
.offline .live-dot {
  background: var(--faint);
  animation: none;
}
@keyframes ping {
  0% {
    box-shadow: 0 0 0 0 rgba(92, 225, 198, 0.55);
  }
  70%,
  100% {
    box-shadow: 0 0 0 9px rgba(92, 225, 198, 0);
  }
}
.hello {
  font: 400 44px/1.02 var(--display);
  letter-spacing: -0.012em;
  margin: 16px 0 8px;
}
.hello em {
  font-style: italic;
  background: linear-gradient(100deg, var(--ice), var(--blue) 60%, var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.summary {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(var(--safe-b) + 120px);
  mask-image: linear-gradient(transparent 0, #000 18px);
}
.section-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 22px 8px 10px;
  font: 600 12px var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.section-label .hint {
  letter-spacing: 0.04em;
  text-transform: none;
  font-weight: 500;
}
.section-toggle {
  width: calc(100% - 16px);
  padding: 0;
  border: 0;
  background: none;
  align-items: center;
  cursor: pointer;
}
.section-toggle .hint {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.conv-swipe {
  position: relative;
  margin-bottom: 10px;
  border-radius: var(--radius);
  transition:
    max-height 0.25s var(--ease-out),
    opacity 0.25s;
}
.conv-swipe > .conv {
  margin-bottom: 0;
  touch-action: pan-y;
}
.conv-swipe-bg {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-right: 22px;
  border-radius: var(--radius);
  background: rgba(255, 77, 94, 0.18);
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
  transition: background 0.2s;
}
.conv-swipe.is-swiping .conv-swipe-bg,
.conv-swipe.is-leaving .conv-swipe-bg {
  display: flex;
}
.conv-swipe.is-armed .conv-swipe-bg {
  background: var(--red);
  color: #fff;
}
.conv-swipe.is-leaving {
  opacity: 0;
}
.conv-call {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  border: 1px solid rgba(92, 225, 198, 0.4);
  background: rgba(92, 225, 198, 0.1);
  border-radius: 999px;
  padding: 2px 8px;
}
.is-call .conv-call {
  display: inline-flex;
}
.conv-call-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: call-pulse 1.4s ease-in-out infinite;
}
@keyframes call-pulse {
  50% {
    opacity: 0.3;
  }
}

.conv {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px 14px 14px 14px;
  margin-bottom: 10px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  position: relative;
  animation: rise 0.5s var(--ease-out) both;
  transition:
    transform 0.25s var(--ease-out),
    background 0.25s;
}
.conv:active {
  transform: scale(0.985);
  background: var(--surface-2);
}
.conv.is-running {
  border-color: transparent;
  background:
    linear-gradient(#120f19, #120f19) padding-box,
    conic-gradient(from var(--spin), rgba(255, 255, 255, 0.07) 0 62%, var(--blue) 76%, var(--sky) 84%, rgba(255, 255, 255, 0.07) 96%) border-box;
  animation:
    rise 0.5s var(--ease-out) both,
    border-spin 3.2s linear infinite;
}
@keyframes border-spin {
  to {
    --spin: 360deg;
  }
}
.conv.is-other {
  background: rgba(255, 255, 255, 0.025);
}

.avatar {
  --h: 20;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(
    circle at 33% 28%,
    hsl(calc(var(--h) + 25) 100% 90%) 0 7%,
    hsl(var(--h) 95% 64%) 32%,
    hsl(calc(var(--h) - 35) 75% 32%) 72%,
    hsl(calc(var(--h) - 60) 70% 12%) 100%
  );
  box-shadow:
    0 8px 20px -8px hsl(var(--h) 90% 55% / 0.7),
    inset 0 -4px 10px rgba(0, 0, 0, 0.35);
}
.avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 60%, hsl(calc(var(--h) + 40) 100% 80% / 0.9) 80%, transparent 95%);
  -webkit-mask: radial-gradient(closest-side, transparent 86%, #000 88%);
  mask: radial-gradient(closest-side, transparent 86%, #000 88%);
  opacity: 0;
  transition: opacity 0.4s;
}
/* La carita de Lisa en chico: dos ojos blancos que parpadean, como en la llamada. */
.ai-eyes {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 17%;
  padding-bottom: 8%;
  pointer-events: none;
}
.ai-eyes i {
  width: 13%;
  height: 16%;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
  animation: ai-blink 5.5s infinite;
}
@keyframes ai-blink {
  0%,
  94%,
  100% {
    transform: scaleY(1);
  }
  96% {
    transform: scaleY(0.1);
  }
}
.is-running .avatar {
  animation: breathe 2.6s var(--ease-io) infinite;
}
/* Programada o pospuesta: wali se apaga a gris y se duerme (ojos cerrados y una z que sube). */
.is-asleep .avatar {
  filter: grayscale(0.85) brightness(0.8);
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, 0.35);
}
.is-asleep .ai-eyes i {
  height: 7%;
  background: none;
  border: solid rgba(255, 255, 255, 0.85);
  border-width: 0 0 1.5px;
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
  box-shadow: none;
  animation: none;
}
.is-asleep .ai-eyes::after {
  content: 'z';
  position: absolute;
  top: -6%;
  right: 2%;
  font: 700 10px/1 var(--font, system-ui);
  color: rgba(255, 255, 255, 0.8);
  animation: ai-snore 3s ease-in-out infinite;
}
@keyframes ai-snore {
  0% {
    opacity: 0;
    transform: translate(-2px, 4px) scale(0.7);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(2px, -4px) scale(1.1);
  }
}
/* Archivada: wali muerto, todo gris y apagado, con los ojos en X y quieto. */
.is-archived .avatar {
  filter: grayscale(1) brightness(0.55);
  opacity: 0.75;
  box-shadow: none;
}
.is-archived .ai-eyes i {
  position: relative;
  width: 14%;
  height: 14%;
  background: none;
  box-shadow: none;
  animation: none;
}
.is-archived .ai-eyes i::before,
.is-archived .ai-eyes i::after {
  content: '';
  position: absolute;
  left: -15%;
  right: -15%;
  top: 50%;
  height: 2px;
  margin-top: -1px;
  border-radius: 1px;
  background: #fff;
  transform: rotate(45deg);
}
.is-archived .ai-eyes i::after {
  transform: rotate(-45deg);
}
.is-running .avatar::after {
  opacity: 1;
  animation: spin 1.8s linear infinite;
}

.glyph {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.conv-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.conv-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.conv-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time {
  font-size: 13px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.conv-sub {
  font-size: 14px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.conv-sub:empty {
  display: none;
}
.conv-sub.activity,
.working .txt,
.call-activity .txt {
  background: linear-gradient(90deg, var(--ice) 0%, #fff 40%, var(--ice) 60%, var(--sky) 100%) 0 0 / 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 2.4s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -150% 0;
  }
}
.conv-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  align-items: center;
  margin-top: 4px;
}
/* Los tokens de la conversa, chiquitos abajo a la derecha, con el parlante a su izquierda. */
.conv-corner {
  position: absolute;
  right: 12px;
  bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}
.conv-tok {
  font: 400 10px/1 var(--mono);
  color: var(--faint);
  opacity: 0.8;
  cursor: pointer;
  /* Más grande para el dedo de lo que se ve. */
  padding: 6px 12px 6px 4px;
  margin: -6px -12px -6px -4px;
}
.conv-tok:hover {
  opacity: 1;
  color: var(--sky);
}
.conv-tok:empty {
  display: none;
}
.conv-ctx {
  margin-left: 6px;
  color: var(--muted);
}
.conv-ctx.warm {
  color: #f2b84b;
}
.conv-ctx.hot {
  color: var(--red);
}
.conv-sound {
  display: flex;
  color: var(--faint);
  opacity: 0.55;
  cursor: pointer;
  /* Más grande para el dedo de lo que se ve. */
  padding: 6px;
  margin: -6px;
}
.conv-sound:hover {
  opacity: 1;
}
.conv-sound.on {
  color: var(--sky);
  opacity: 1;
}
/* Usa el navegador (web.js): el globo, con cuántas pestañas si son varias; gira mientras navega. */
.conv-web {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--teal);
  opacity: 0.75;
  font: 600 10px/1 var(--mono);
}
.conv-web[hidden] {
  display: none;
}
.conv-web.is-working {
  opacity: 1;
}
.conv-web.is-working svg {
  animation: conv-web-spin 2.4s linear infinite;
}
@keyframes conv-web-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .conv-web.is-working svg {
    animation: none;
  }
}
/* En la barra de la compu las tarjetas son bajas: el resumen le deja lugar para no pisarse. */
.desk-mode .conv .conv-sub {
  padding-right: 58px;
}
.desk-mode .conv:has(.conv-web:not([hidden])) .conv-sub {
  padding-right: 84px;
}
/* Sin llamada ni cola, el pie queda vacío y no ocupa alto. */
.conv:not(.is-call) .conv-foot:has(.conv-state:empty):has(.conv-when:empty):has(.conv-branch:empty):has(.conv-kids:empty):has(.conv-agents:empty):has(.conv-subs:empty):has(.conv-phones:empty) {
  display: none;
}
.conv-lead {
  flex: none;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.chip-cwd {
  max-width: 100%;
  font: 500 10px/1 var(--mono);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chip-cwd:empty {
  display: none;
}
.conv-state {
  font-size: 12px;
  color: var(--faint);
}
.conv.is-ended {
  opacity: 0.72;
}
.unread-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 14px var(--blue);
  transform: scale(0);
  transition: transform 0.35s var(--spring);
}
.is-unread .unread-dot {
  transform: scale(1);
}

.more {
  width: 100%;
  height: 48px;
  border-radius: 16px;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--line-2);
}
.more:active {
  background: var(--surface);
}

.empty {
  text-align: center;
  padding: 60px 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.empty-orb {
  width: 110px;
  height: 110px;
  margin-bottom: 26px;
}
.empty p {
  margin: 4px 0;
}
.empty p:first-of-type {
  font: italic 400 26px var(--display);
}

.fab {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 22px);
  z-index: var(--z-fab);
  transform: translateX(-50%);
  height: 62px;
  padding: 0 28px 0 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 17px;
  white-space: nowrap;
  color: #ffffff;
  background: linear-gradient(135deg, #4f8bff, var(--blue-2) 50%, #64afff);
  box-shadow:
    0 14px 40px -10px rgba(36, 84, 248, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transition: transform 0.25s var(--ease-out);
  animation: fab-in 0.7s var(--spring) backwards 0.1s;
}
.fab:active {
  transform: translateX(-50%) scale(0.96);
}
@keyframes fab-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(30px) scale(0.9);
  }
}
.fab-orb {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b8d7ff 0 8%, #4f8bff 40%, #1d3fb8 85%);
  box-shadow:
    inset 0 -3px 8px rgba(10, 30, 110, 0.35),
    0 0 0 2px rgba(255, 255, 255, 0.35);
}

/* ---------- conversa ---------- */

.chat-head {
  padding: calc(var(--safe-t) + 6px) 8px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
  z-index: 2;
  background: linear-gradient(var(--bg) 55%, transparent);
  transition: padding 0.4s var(--ease-out);
}
body.call-min .chat-head {
  padding-top: calc(var(--safe-t) + 58px);
}
.chat-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}
.chat-title b {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* El nombre (con su flechita) abre las opciones; dos toques lo editan. */
.chat-title-row.tap {
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  gap: 2px;
}
.chat-title-row.tap b[contenteditable='plaintext-only'] {
  -webkit-user-select: text;
  user-select: text;
  cursor: text;
}
.title-chev {
  display: inline-flex;
  flex: none;
  color: var(--faint);
}
.chat-title b[contenteditable='plaintext-only'] {
  outline: none;
  text-overflow: clip;
  border-bottom: 1px solid var(--faint);
}
.chat-title small {
  font: 12px var(--mono);
  color: var(--faint);
}
.chat-title-row,
.chat-sub-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}
.chat-title-row b {
  min-width: 0;
}
.chat-sub-row {
  gap: 6px;
}
.chat-sub-row small {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sub-row small:empty {
  display: none;
}
.pane .chat-title-row,
.pane .chat-sub-row,
.btw-pane .chat-title-row,
.btw-pane .chat-sub-row {
  justify-content: flex-start;
}
/* El worktree en que trabaja la conversa: al lado del título (compu) o en la línea de abajo (celu). */
.wt-chip {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 300px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px 2px 6px;
  border: 1px solid color-mix(in srgb, var(--sky) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--sky) 12%, transparent);
  color: var(--sky);
  font: 500 11px/1.3 var(--mono);
  cursor: pointer;
}
.wt-chip[hidden] {
  display: none;
}
.wt-chip svg {
  flex: none;
}
.wt-chip span {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-sub-row .wt-chip {
  max-width: 62%;
  padding: 1px 7px 1px 5px;
  font-size: 10.5px;
}
.wt-chip:hover {
  background: color-mix(in srgb, var(--sky) 20%, transparent);
}
.chat-head.busy .chat-title small {
  color: var(--sky);
}

.scroller {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 6px 18px 18px;
  overscroll-behavior: contain;
}
.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  color: var(--muted);
  background: rgba(143, 125, 255, 0.08);
  border: 1px solid rgba(143, 125, 255, 0.25);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 4px 0 16px;
}
.banner svg {
  flex: none;
  color: var(--violet);
  margin-top: 2px;
}
.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
/* Abriendo una conversa: un aro que gira mientras baja, y si falla, el aviso con Reintentar. */
.conv-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28vh 20px 0;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  animation: fade-in 0.3s 0.15s both;
}
.conv-loading-spin {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid var(--line-2);
  border-top-color: var(--blue-2);
  animation: spin 0.8s linear infinite;
}
.conv-loading.failed {
  animation: none;
  gap: 6px;
}
.conv-loading.failed > p:first-child {
  color: var(--text);
  font-weight: 600;
}
.conv-loading-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.conv-loading-actions .btn {
  height: 44px;
  border-radius: 14px;
  font-size: 15px;
}
/* Mientras carga (o si falló) no se ven las respuestas sugeridas: no hay a qué responder todavía. */
.messages:has(> .conv-loading) ~ .replies {
  display: none;
}

.hint-empty {
  text-align: center;
  color: var(--faint);
  font: italic 22px/1.3 var(--display);
  padding: 30vh 20px 0;
}

.msg {
  animation: rise 0.45s var(--ease-out) both;
  overflow-wrap: anywhere;
}
.msg.still,
.steps.still {
  animation: none;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
.msg.user {
  /* Mantener apretado abre el menú del mensaje (rama, copiar), no el de iOS. */
  -webkit-touch-callout: none;
  align-self: flex-end;
  max-width: 86%;
  padding: 11px 16px;
  border-radius: 22px 22px 6px 22px;
  background: linear-gradient(135deg, rgba(90, 150, 255, 0.24), rgba(36, 84, 248, 0.13));
  border: 1px solid rgba(90, 150, 255, 0.28);
  white-space: pre-wrap;
  line-height: 1.45;
}
.msg-time {
  float: right;
  position: relative;
  top: 9px;
  margin: 0 -6px 0 12px;
  font-size: 11px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  opacity: 0.5;
  user-select: none;
}
.msg.user .via {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 6px;
  vertical-align: -3px;
  border-radius: 50%;
  background: rgba(90, 150, 255, 0.25);
  color: var(--ice);
}
.msg.claude {
  align-self: stretch;
  line-height: 1.62;
  font-size: 16px;
}
.msg-recap {
  align-self: stretch;
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: var(--faint);
}
.msg.claude.error {
  color: #ff9aa4;
}
.msg.claude > :first-child {
  margin-top: 0;
}
.msg.claude > :last-child {
  margin-bottom: 0;
}
.msg.claude p {
  margin: 0 0 0.7em;
}
.msg.claude a {
  color: var(--ice);
}
.msg.claude strong {
  font-weight: 650;
}
.msg.claude code {
  font: 0.86em var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 5px;
}
.msg.claude pre {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  overflow-x: auto;
  font-size: 13px;
}
pre.copyable {
  position: relative;
  cursor: copy;
  padding-top: 28px !important;
  -webkit-tap-highlight-color: transparent;
}
pre.copyable::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 10px;
  width: 16px;
  height: 16px;
  background: var(--muted);
  -webkit-mask: var(--copy-icon) center / contain no-repeat;
  mask: var(--copy-icon) center / contain no-repeat;
  pointer-events: none;
}
pre.copyable {
  --copy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
}
pre.copyable.copied {
  animation: copied 0.6s ease-out;
  --copy-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
pre.copyable.copied::after {
  background: rgb(90, 150, 255);
}
/* Un correo o un mensaje para copiar (```text) se lee entero, sin scroll de lado. */
.msg.claude pre:has(> code.language-text) {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
}
.msg.claude pre:has(> code.language-text) code {
  font-family: inherit;
}
@keyframes copied {
  from {
    border-color: rgba(90, 150, 255, 0.8);
    background: rgba(90, 150, 255, 0.16);
  }
}
.msg.claude pre code {
  background: none;
  border: 0;
  padding: 0;
}
/* Un mensaje de WhatsApp listo para mandar (link wa.me con texto): el texto como burbuja y el botón para abrirlo. */
.wa-card {
  margin: 0.4em 0 0.9em;
  max-width: 520px;
  border: 1px solid rgba(37, 211, 102, 0.22);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.07), rgba(255, 255, 255, 0.025));
  padding: 12px;
}
.wa-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.wa-card-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #25d366;
  color: #062b14;
}
.wa-card-to {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.wa-card-to small {
  font-size: 12px;
  color: var(--muted);
}
.wa-card-to b {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.wa-card-bubble {
  background: #144d37;
  color: #eef7f1;
  border-radius: 14px 14px 4px 14px;
  padding: 10px 12px;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  user-select: text;
  -webkit-user-select: text;
}
.wa-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.msg.claude a.wa-card-send,
.wa-card-send {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 12px;
  background: #25d366;
  color: #062b14;
  font-weight: 650;
  font-size: 15px;
  text-decoration: none;
  transition: transform 0.15s var(--ease-out), filter 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.wa-card-copy {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: 500 14px var(--font);
  cursor: pointer;
  transition: transform 0.15s var(--ease-out), background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.wa-card-send:active,
.wa-card-copy:active {
  transform: scale(0.97);
}
@media (hover: hover) {
  .wa-card-send:hover {
    filter: brightness(1.08);
  }
  .wa-card-copy:hover {
    background: var(--surface-2);
  }
}
.msg.claude ul,
.msg.claude ol {
  padding-left: 1.3em;
  margin: 0 0 0.7em;
}
.msg.claude li {
  margin: 0.2em 0;
}
.msg.claude table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
}
.msg.claude th,
.msg.claude td {
  border: 1px solid var(--line);
  padding: 6px 9px;
}
.msg.claude blockquote {
  margin: 0 0 0.7em;
  padding-left: 12px;
  border-left: 3px solid var(--line-2);
  color: var(--muted);
}

.steps {
  align-self: flex-start;
  max-width: 100%;
  animation: rise 0.4s var(--ease-out) both;
}
.steps summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px 7px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.steps summary::-webkit-details-marker {
  display: none;
}
.steps-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.steps-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--violet);
  box-shadow: 0 0 10px var(--violet);
}
.steps summary svg {
  flex: none;
  transition: transform 0.25s var(--ease-out);
}
.steps[open] summary svg {
  transform: rotate(90deg);
}
.steps-list {
  margin: 8px 0 0 14px;
  padding: 2px 0 2px 16px;
  border-left: 1px solid var(--line-2);
  font: 12.5px/1.5 var(--mono);
  color: var(--muted);
  list-style: none;
}
.steps-list li {
  padding: 3px 0;
  overflow-wrap: anywhere;
}

.working {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  font-size: 14px;
  animation: rise 0.4s var(--ease-out) both;
}
.working .txt {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spark {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: conic-gradient(from var(--spin), var(--violet), var(--teal), var(--blue), var(--violet));
  -webkit-mask: radial-gradient(closest-side, transparent 55%, #000 58%);
  mask: radial-gradient(closest-side, transparent 55%, #000 58%);
  animation: border-spin 1.2s linear infinite;
}
.call-menu-btn {
  width: 100%;
  margin-bottom: 14px;
}
.ctx-pct {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: var(--muted);
  border: 1px solid var(--line-2);
}
.stop:active {
  background: var(--surface-2);
}

.composer {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 12px calc(var(--safe-b) + 10px);
  background: linear-gradient(transparent, var(--bg) 35%);
}
.to-bottom {
  position: absolute;
  z-index: 2;
  bottom: calc(100% + 4px);
  left: 50%;
  width: 40px;
  height: 40px;
  margin-left: -20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text);
  background: rgba(30, 27, 38, 0.85);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid var(--line-2);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(8px) scale(0.8);
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.3s var(--spring);
}
.to-bottom.on {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.to-bottom:active {
  transform: scale(0.92);
}
.composer {
  flex-wrap: wrap;
}
.composer-row {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
body.kb-open .composer {
  padding-bottom: 10px;
}
.input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  min-height: 52px;
  padding: 6px 6px 6px 18px;
  border-radius: 26px;
  background: rgba(30, 26, 38, 0.8);
  border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  transition: border-color 0.2s;
}
.input-wrap:focus-within {
  border-color: rgba(90, 150, 255, 0.5);
}
.input-wrap textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  resize: none;
  background: none;
  color: var(--text);
  font: 16px/1.4 var(--font);
  padding: 9px 0;
  max-height: 140px;
}
.input-wrap {
  flex-wrap: wrap;
  padding-left: 6px;
}
.attach {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.attach-tray {
  flex-basis: 100%;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 6px 2px;
}
.attach-tray[hidden] {
  display: none;
}
.attach-thumb {
  position: relative;
  flex: none;
}
.attach-thumb img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}
.attach-doc {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 64px;
  max-width: 190px;
  padding: 0 12px 0 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}
.attach-doc .file-icon {
  width: 32px;
  height: 40px;
}
.attach-doc-name {
  font-size: 13px;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}
.attach-x {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(20, 18, 26, 0.92);
  border: 1px solid var(--line);
}
.msg-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.msg-images img {
  max-width: 220px;
  max-height: 260px;
  border-radius: 14px;
  display: block;
}
.msg-images video {
  width: 100%;
  max-width: 300px;
  max-height: 420px;
  border-radius: 14px;
  display: block;
  background: #000;
}
.msg.claude.shown .msg-images {
  margin-bottom: 4px;
}
.msg.claude.shown .msg-images img {
  max-width: 100%;
  max-height: 420px;
}
.msg-chart {
  margin: 0;
  width: 100%;
  max-width: 420px;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.ch-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
}
.ch-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ch-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  margin-right: 5px;
}
.ch-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.ch-grid {
  stroke: var(--line);
}
.ch-zero {
  stroke: var(--line-2);
}
.ch-ax {
  fill: var(--faint);
  font: 10px var(--font);
}
.ch-val {
  fill: var(--text);
  font: 600 10px var(--font);
}
.ch-note {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.msg-files {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 6px;
}
.file-card {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 340px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}
.msg a.file-open {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px 10px 12px;
  color: inherit;
  text-decoration: none;
}
.file-icon {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 46px;
  color: #ff6b5e;
}
.file-icon b {
  position: absolute;
  bottom: 2px;
  padding: 0 3px;
  border-radius: 3px;
  font-size: 9px;
  letter-spacing: 0.04em;
  color: #fff;
  background: #e5483b;
}
.file-icon.other {
  color: #7fb2ff;
}
.file-icon.other b {
  background: #3b6fe5;
}
.msg.user .file-card {
  min-width: 220px;
}
.file-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-size {
  font-size: 13px;
  color: var(--muted);
}
.file-share {
  flex: none;
  align-self: stretch;
  width: 48px;
  display: grid;
  place-items: center;
  color: inherit;
  background: none;
  border: 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
}
.pdf-viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #07060a;
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.pdf-viewer.open {
  opacity: 1;
}
.pdf-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(var(--safe-t) + 10px) 14px 10px;
}
.pdf-title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-pages {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 10px calc(var(--safe-b) + 24px);
}
.pdf-pages.zoomed {
  align-items: flex-start;
  overflow-x: auto;
}
.pdf-page {
  width: calc(100% * var(--z, 1));
  max-width: calc(900px * var(--z, 1));
  flex: none;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}
.pdf-page canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.pdf-status {
  margin: auto;
  color: var(--muted);
}
.pdf-fallback {
  margin: 0 auto auto;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: none;
  color: inherit;
  font: inherit;
}
.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-t) + 64px) 12px 24px;
  background: rgba(4, 3, 6, 0.96);
  opacity: 0;
  transition: opacity 0.25s var(--ease-out);
}
.viewer.open {
  opacity: 1;
}
.viewer img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}
.viewer-x {
  position: absolute;
  top: calc(var(--safe-t) + 10px);
  right: 14px;
}
.input-wrap textarea::placeholder {
  color: var(--faint);
}
.send {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--blue);
  transform: scale(0);
  opacity: 0;
  transition:
    transform 0.3s var(--spring),
    opacity 0.2s;
}
.has-text .send {
  transform: scale(1);
  opacity: 1;
}
/* ---------- hojas ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s;
}
.sheet-backdrop.open {
  opacity: 1;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-sheet) + 1);
  max-width: 720px;
  margin: 0 auto;
  max-height: 88dvh;
  overflow-y: auto;
  padding: 10px 20px calc(var(--safe-b) + 22px);
  border-radius: 30px 30px 0 0;
  background: rgba(20, 17, 27, 0.94);
  border-top: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(30px) saturate(1.4);
  backdrop-filter: blur(30px) saturate(1.4);
  transform: translateY(105%);
  transition: transform 0.5s var(--ease-out);
}
.sheet.open {
  transform: translateY(0);
}
.grabber {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-2);
  margin: 0 auto 14px;
}
.sheet h2 {
  font: 400 32px/1.1 var(--display);
  margin: 4px 0 6px;
}
.sheet .label {
  display: block;
  margin: 22px 0 6px;
  font: 600 12px var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.sheet .row {
  display: flex;
  gap: 10px;
}
.roots {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.root {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 14px;
  border-radius: 14px;
  font: 500 14px var(--mono);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.2s var(--ease-out);
}
.root[aria-pressed='true'] {
  color: var(--ice);
  border-color: rgba(90, 150, 255, 0.6);
  background: rgba(60, 123, 255, 0.12);
}
.root-hint {
  min-height: 21px;
  margin: 12px 2px 0;
  color: var(--faint);
  font-size: 14px;
}
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}
.sheet-actions.single {
  grid-template-columns: 1fr;
  margin-top: 12px;
}
.voices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.voice {
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.2s var(--ease-out);
}
.voice-name {
  font-weight: 600;
}
.voice-desc {
  grid-column: 1;
  font-size: 13px;
  color: var(--muted);
}
.voice-check {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--blue);
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.3s var(--spring);
}
.voice[aria-pressed='true'] {
  border-color: rgba(90, 150, 255, 0.6);
  background: rgba(60, 123, 255, 0.1);
}
.voice[aria-pressed='true'] .voice-check {
  opacity: 1;
  transform: scale(1);
}

/* ---------- llamada ---------- */

.call {
  position: fixed;
  inset: 0;
  z-index: var(--z-call);
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(120% 75% at 50% 38%, #171026 0%, #0b0911 55%, #050408 100%);
  opacity: 0;
  transform: scale(1.04);
  transition:
    opacity 0.5s var(--ease-out),
    transform 0.6s var(--ease-out);
  overflow: hidden;
}
.call.open {
  opacity: 1;
  transform: none;
}
.call.minimized {
  opacity: 0;
  transform: scale(0.92) translateY(-12%);
  pointer-events: none;
}
.call::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(60% 40% at 50% 40%, var(--glow, rgba(60, 123, 255, 0.16)), transparent 70%);
  transition: background 1s var(--ease-io);
}
.call[data-state='thinking'] {
  --glow: rgba(143, 125, 255, 0.2);
}
.call[data-state='speaking'] {
  --glow: rgba(100, 175, 255, 0.2);
}
.call[data-state='muted'],
.call[data-state='connecting'] {
  --glow: rgba(160, 150, 190, 0.1);
}

.orb-canvas {
  position: absolute;
  left: 50%;
  top: 38%;
  width: min(125vw, 680px);
  height: min(125vw, 680px);
  transform: translate(-50%, -50%);
}
.orb-canvas.orb-fallback {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #eef5ff, #7fb2ff 30%, #2454f8 60%, #0a1f5c);
  animation: breathe 3s var(--ease-io) infinite;
}
.call-top {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 720px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-t) + 8px) 10px 0;
}
.call-title {
  text-align: center;
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}
.call-title b {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 64vw;
}
.call-title small {
  font: 13px var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.call-stage {
  flex: 1;
}
.call-bottom {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 560px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.call-label {
  min-height: 36px;
  margin: 0 0 8px;
  font: italic 400 30px/1.2 var(--display);
  color: var(--text);
  transition: opacity 0.3s;
}
.call-label:empty {
  opacity: 0;
}
.captions {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
}
.captions p {
  margin: 0;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.35s var(--ease-out),
    transform 0.35s var(--ease-out);
}
.captions p.show {
  opacity: 1;
  transform: none;
}
.cap-user {
  font-size: 15px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cap-model {
  font-size: 19px;
  line-height: 1.4;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.call-activity {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  height: 38px;
  margin-top: 14px;
  padding: 0 14px 0 8px;
  border-radius: 999px;
  background: rgba(143, 125, 255, 0.1);
  border: 1px solid rgba(143, 125, 255, 0.25);
  font-size: 14px;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition:
    opacity 0.35s var(--ease-out),
    transform 0.35s var(--ease-out);
}
.call-activity.show {
  opacity: 1;
  transform: none;
}
.call-activity .txt {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 30px;
  padding: 24px 0 calc(var(--safe-b) + 28px);
}
.ctl {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  transition:
    transform 0.25s var(--ease-out),
    background 0.25s,
    color 0.25s;
}
.ctl:active {
  transform: scale(0.9);
}
.ctl[aria-pressed='true'] {
  background: var(--text);
  color: #111;
}
.ctl.hangup {
  width: 78px;
  height: 78px;
  border: 0;
  background: var(--red);
  color: #fff;
  box-shadow: 0 14px 36px -10px rgba(255, 77, 94, 0.8);
}

.call-pill {
  position: fixed;
  top: calc(var(--safe-t) + 8px);
  left: 50%;
  z-index: var(--z-pill);
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px 0 8px;
  border-radius: 999px;
  background: rgba(22, 18, 30, 0.88);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.8);
  font-size: 14px;
  font-weight: 600;
  transform: translate(-50%, -160%);
  transition: transform 0.5s var(--spring);
}
.call-pill.show {
  transform: translate(-50%, 0);
}
.mini-orb {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9cc7ff, var(--blue-2) 60%, #0f2a7a);
  box-shadow: 0 0 16px rgba(60, 123, 255, 0.6);
  animation: breathe 2.2s var(--ease-io) infinite;
}
.call-pill[data-state='thinking'] .mini-orb {
  background: radial-gradient(circle at 35% 30%, #e9fffa, #8f7dff 45%, #3b2a9a);
  box-shadow: 0 0 16px rgba(143, 125, 255, 0.7);
}
.pill-time {
  font: 13px var(--mono);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- avisos ---------- */

#toasts {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--safe-b) + 100px);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  max-width: 440px;
  padding: 12px 18px;
  border-radius: 18px;
  background: rgba(30, 26, 38, 0.95);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  font-size: 15px;
  text-align: center;
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition:
    opacity 0.35s var(--ease-out),
    transform 0.35s var(--ease-out);
}
.toast.show {
  opacity: 1;
  transform: none;
}

/* ---------- pantallas grandes: la app queda centrada como un teléfono ---------- */

@media (min-width: 760px) {
  .hello {
    font-size: 56px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .aurora i {
    animation: none;
  }
}

.btn-danger {
  background: linear-gradient(135deg, #ff5f6d, #e5384a);
  color: #ffffff;
  box-shadow: 0 10px 30px -10px rgba(229, 56, 74, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
/* El switch que da el toque háptico en iOS: fuera de la pantalla, pero presente. */
.haptic {
  position: fixed;
  left: -100px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

/* Conversa cuyo objetivo ya se logró: borde verde con brillo suave, lista para archivar. */
.conv-done {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  display: none;
}
.conv.is-done .conv-done {
  display: inline;
}
.conv.is-done {
  border-color: transparent;
  background:
    linear-gradient(#0c1410, #0c1410) padding-box,
    linear-gradient(135deg, #4ade80, rgba(74, 222, 128, 0.25) 45%, rgba(92, 225, 198, 0.2) 70%, #5ce1c6) border-box;
  box-shadow:
    0 0 0 1px rgba(74, 222, 128, 0.06),
    0 6px 24px -10px rgba(74, 222, 128, 0.45);
}
.conv.is-done:active {
  background:
    linear-gradient(#111c16, #111c16) padding-box,
    linear-gradient(135deg, #4ade80, rgba(74, 222, 128, 0.25) 45%, rgba(92, 225, 198, 0.2) 70%, #5ce1c6) border-box;
}

/* Conversa que espera algo de Martín (un sí, una respuesta, una prueba): borde amarillo. */
.conv-wait {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  display: none;
}
.conv.is-waiting .conv-wait {
  display: inline;
}
.conv.is-waiting {
  border-color: transparent;
  background:
    linear-gradient(#15130a, #15130a) padding-box,
    linear-gradient(135deg, #facc15, rgba(250, 204, 21, 0.25) 45%, rgba(251, 191, 36, 0.2) 70%, #fbbf24) border-box;
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.06),
    0 6px 24px -10px rgba(250, 204, 21, 0.45);
}
.conv.is-waiting:active {
  background:
    linear-gradient(#1d1a0e, #1d1a0e) padding-box,
    linear-gradient(135deg, #facc15, rgba(250, 204, 21, 0.25) 45%, rgba(251, 191, 36, 0.2) 70%, #fbbf24) border-box;
}

/* ---------- filtro de conversas ---------- */

.filters {
  display: flex;
  gap: 6px;
  margin: -2px 4px 12px;
  /* Con cuatro filtros no caben en un iPhone angosto: se deslizan de lado. */
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar {
  display: none;
}
.filter {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font: 500 13px var(--font);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.2s var(--ease-out);
}
.filter-n {
  font: 500 11px var(--mono);
  opacity: 0.7;
}
.filter[aria-pressed='true'] {
  color: var(--ice);
  border-color: rgba(90, 150, 255, 0.6);
  background: rgba(60, 123, 255, 0.12);
}
.filter-ico {
  padding: 0 11px;
}
.filter-flagged > svg {
  color: #4ade80;
}
.filter-urgent > svg {
  color: #fbbf24;
}
.filter-awaiting > svg {
  color: #f87171;
}
.filter-looped > svg {
  color: #c4b5fd;
}
.filter-checked > svg {
  color: #7dd3fc;
}
/* La lista de atajos de teclado: la tecla a la izquierda, lo que hace a la derecha. */
.keys-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 16px;
  align-items: center;
  margin: 8px 0 4px;
}
.keys-list dt {
  justify-self: end;
}
.keys-list dd {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.keys-list kbd {
  font: 500 12px/1 var(--font);
  color: var(--text);
  padding: 4px 6px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
/* Las marcas dentro de «Todas»: prendidas se ven en su color; apagadas, tachadas y grises. */
.filter-marks {
  display: inline-flex;
  gap: 2px;
}
.filter-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  cursor: pointer;
  position: relative;
}
.filter-mark-flagged {
  color: #4ade80;
}
.filter-mark-looped {
  color: #c4b5fd;
}
.filter-mark-checked {
  color: #7dd3fc;
}
.filter-mark-awaiting {
  color: #f87171;
}
.filter-mark.is-off {
  color: var(--muted);
  opacity: 0.45;
}
.filter-mark.is-off::after {
  content: '';
  position: absolute;
  width: 16px;
  border-top: 1.5px solid currentColor;
  transform: rotate(-45deg);
}
.desk .filter-mark {
  width: 18px;
  height: 18px;
}
.filter-empty {
  margin: 6px 8px 14px;
  font-size: 14px;
}

/* ---------- wali, la sesión padre: violeta y verde agua, una esfera con satélites ---------- */

.wali-hero {
  position: relative;
  margin: 10px 0 4px;
  border-radius: 30px;
  isolation: isolate;
  animation: rise 0.55s var(--ease-out) both;
}
/* Un borde que respira en violeta y verde agua: la distingue de cualquier conversa. */
.wali-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--spin), rgba(143, 125, 255, 0.55), rgba(92, 225, 198, 0.45), rgba(100, 175, 255, 0.35), rgba(143, 125, 255, 0.55));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: border-spin 9s linear infinite;
  z-index: -1;
}
.wali-hero.is-thinking::before {
  animation-duration: 2.4s;
}
.wali-hero-main {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  padding: 18px 76px 18px 16px;
  border-radius: inherit;
  background:
    radial-gradient(130% 150% at 0% 0%, rgba(143, 125, 255, 0.3), transparent 55%),
    radial-gradient(120% 160% at 100% 110%, rgba(92, 225, 198, 0.17), transparent 60%),
    rgba(18, 14, 30, 0.75);
  box-shadow:
    0 24px 60px -28px rgba(130, 110, 255, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.09);
  transition: transform 0.25s var(--ease-out);
}
.wali-hero-main:active {
  transform: scale(0.985);
}
.wali-text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.wali-eyebrow {
  font: 600 10.5px/1 var(--font);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(200, 190, 255, 0.75);
}
.wali-name {
  font: italic 400 40px/1 var(--display);
  letter-spacing: -0.01em;
  background: linear-gradient(100deg, #e9e4ff, #a99bff 45%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 2px 0 4px;
}
.wali-line {
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wali-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.wali-sub:empty {
  display: none;
}
.wali-hero-call {
  position: absolute;
  right: 14px;
  top: 50%;
  translate: 0 -50%;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #a194ff, #6a55f0 55%, #3fc6ae);
  box-shadow:
    0 12px 30px -10px rgba(120, 100, 255, 0.85),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 0.2s var(--ease-out);
}
.wali-hero-call:active {
  transform: scale(0.92);
}

/* La esfera: núcleo violeta con la carita, un halo que gira y los satélites (las sesiones que trabajan). */
.wali-orb {
  position: relative;
  flex: none;
  width: 78px;
  height: 78px;
}
.wali-orb .core {
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 27%, #fff 0 5%, #d9d1ff 14%, #9a88ff 38%, #4b35c9 72%, #170f4a 100%);
  box-shadow:
    0 0 34px rgba(143, 125, 255, 0.6),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35);
  animation: breathe 4.5s var(--ease-io) infinite;
}
.wali-orb .halo {
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 40%, rgba(92, 225, 198, 0.9) 60%, transparent 72%, rgba(169, 155, 255, 0.85) 88%, transparent 100%);
  -webkit-mask: radial-gradient(closest-side, transparent 88%, #000 90%);
  mask: radial-gradient(closest-side, transparent 88%, #000 90%);
  animation: spin 7s linear infinite;
}
.is-thinking .wali-orb .halo,
.is-padre.thinking .mini-orb::after {
  animation-duration: 1.4s;
}
.wali-orb .sats {
  position: absolute;
  inset: 0;
  animation: spin 16s linear infinite;
}
.wali-orb .sats i {
  --h: 220;
  position: absolute;
  top: 50%;
  left: 50%;
  width: 9px;
  height: 9px;
  margin: -4.5px;
  border-radius: 50%;
  background: hsl(var(--h) 95% 68%);
  box-shadow: 0 0 10px hsl(var(--h) 95% 60%);
  transform: rotate(var(--a)) translateX(41px);
}
.wali-orb .sats i.rama {
  background: var(--teal);
  box-shadow: 0 0 10px var(--teal);
}
.wali-badge {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font: 700 12px/1 var(--font);
  color: #1b1405;
  background: #ffc861;
  box-shadow: 0 0 0 3px rgba(18, 14, 30, 0.9);
  animation: rise 0.4s var(--spring) both;
}
.wali-badge:empty {
  display: none;
}
.wali-orb.big {
  width: 120px;
  height: 120px;
  margin: 0 auto 18px;
}
.wali-orb.big .core {
  inset: 16px;
}

/* Las sesiones que abrió wali llevan una brújula chica en el avatar. */
.from-wali-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #a194ff, #5b47e6);
  box-shadow: 0 0 0 2.5px var(--bg);
}

/* ---------- la conversa con wali ---------- */

body.padre-mode .aurora i:nth-child(1) {
  background: radial-gradient(closest-side, rgba(143, 125, 255, 0.34), transparent 72%);
}
body.padre-mode .aurora i:nth-child(3) {
  background: radial-gradient(closest-side, rgba(92, 225, 198, 0.2), transparent 72%);
}
.padre-title {
  color: inherit;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out);
}
.padre-title:active {
  transform: scale(0.96);
}
.padre-title {
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 10px;
}
.padre-title-txt {
  display: flex;
  flex-direction: column;
  text-align: left;
  min-width: 0;
}
.padre-title b {
  font: italic 400 24px/1 var(--display);
  background: linear-gradient(100deg, #e9e4ff, #a99bff 50%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 2px;
}
.padre-head .chat-title small {
  white-space: nowrap;
  font: 11.5px var(--font);
  color: var(--muted);
}
.mini-orb {
  position: relative;
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 27%, #fff 0 5%, #d9d1ff 14%, #9a88ff 38%, #4b35c9 72%, #170f4a 100%);
  box-shadow: 0 0 18px rgba(143, 125, 255, 0.55);
}
.mini-orb::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, transparent 0 55%, rgba(92, 225, 198, 0.95) 75%, transparent 90%);
  -webkit-mask: radial-gradient(closest-side, transparent 84%, #000 87%);
  mask: radial-gradient(closest-side, transparent 84%, #000 87%);
  opacity: 0;
  transition: opacity 0.4s;
}
.padre-head.busy .mini-orb::after {
  opacity: 1;
  animation: spin 1.4s linear infinite;
}
.padre-reset-btn {
  width: 100%;
}

.wali-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 16px 12px;
  scrollbar-width: none;
  position: relative;
  z-index: 2;
  mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 22px), transparent);
}
.wali-strip::-webkit-scrollbar {
  display: none;
}
.wali-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 200px;
  height: 32px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  animation: rise 0.35s var(--ease-out) both;
}
.wali-pill .t {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wali-pill .k {
  font: 600 10px/1 var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c9bfff;
}
.wali-pill.topic {
  background: rgba(143, 125, 255, 0.16);
  border-color: rgba(143, 125, 255, 0.4);
}
.wali-pill.news {
  color: #ffd98f;
  background: rgba(255, 200, 97, 0.1);
  border-color: rgba(255, 200, 97, 0.35);
}
/* Con un tema abierto, las novedades esperan: se ven quietas, en pausa. */
.wali-pill.news.held {
  opacity: 0.75;
  border-style: dashed;
}
.wali-pill .st {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
}
.wali-pill.st-run .st {
  background: hsl(var(--h) 95% 68%);
  box-shadow: 0 0 0 0 hsl(var(--h) 95% 68% / 0.6);
  animation: sess-ping 1.8s var(--ease-out) infinite;
}
.wali-pill.st-queue .st {
  background: transparent;
  border: 1.5px solid var(--sky);
}
.wali-pill.st-news .st {
  background: #ffc861;
}
.wali-pill.st-wait .st {
  background: #ffc861;
  opacity: 0.6;
}
.wali-pill.st-done .st {
  background: var(--teal);
}
@keyframes sess-ping {
  0% {
    box-shadow: 0 0 0 0 hsl(var(--h) 95% 68% / 0.6);
  }
  80%,
  100% {
    box-shadow: 0 0 0 7px hsl(var(--h) 95% 68% / 0);
  }
}

.msg.notice {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 92%;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: #ffd98f;
  background: rgba(255, 200, 97, 0.08);
  border: 1px solid rgba(255, 200, 97, 0.25);
}
.msg.user.from-wali {
  background: linear-gradient(135deg, rgba(143, 125, 255, 0.24), rgba(92, 70, 230, 0.12));
  border-color: rgba(143, 125, 255, 0.35);
}
.from-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
  font: italic 400 16px/1 var(--display);
  color: #c9bfff;
}
.banner.banner-wali {
  background: rgba(143, 125, 255, 0.1);
}
.banner a {
  color: #c9bfff;
  font-weight: 600;
}
.hint-empty.padre-empty {
  padding-top: 14vh;
  font-style: normal;
}
.padre-empty p:first-of-type {
  font: 400 34px/1.1 var(--display);
  color: var(--text);
  margin: 0 0 10px;
}
.padre-empty em {
  background: linear-gradient(100deg, #e9e4ff, #a99bff 50%, var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.padre-empty .muted {
  font: 15px/1.5 var(--font);
  max-width: 300px;
  margin: 0 auto;
}
@media (prefers-reduced-motion: reduce) {
  .wali-hero::before,
  .wali-orb .halo,
  .wali-orb .sats,
  .wali-orb .core {
    animation: none;
  }
}

/* Mantener apretada una tarjeta abre sus opciones: sin la burbuja ni la selección de texto de iOS. */
.conv {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ---------- lectura en voz alta (reading.js): el texto se revela al ritmo de la voz ---------- */
/* Lo que todavía no se leyó, atenuado pero legible (5,3:1 sobre el fondo). */
::highlight(wv-unread) {
  color: #858090;
}
.msg.claude.rd-on {
  position: relative;
}
.msg.claude > .rd-mark + * {
  margin-top: 0;
}
/* Hasta dónde se escuchó: una raya fina sobre el texto, que no empuja nada. */
.rd-mark {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  margin-left: 1px;
  border-radius: 2px;
  background: var(--sky);
  box-shadow: 0 0 0 3px rgba(100, 175, 255, 0.16);
  pointer-events: none;
}
.rd-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  margin-top: -6px;
  font-size: 13px;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  transition:
    opacity 0.25s var(--ease-out),
    min-height 0.3s var(--ease-out),
    margin 0.3s var(--ease-out);
}
.rd-foot.rd-gone {
  opacity: 0;
  min-height: 0;
  margin-top: -14px;
}
.rd-live,
.rd-cut-txt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.rd-live::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sky);
  animation: rd-pulse 1.4s ease-in-out infinite;
}
.rd-cut-txt::before {
  content: '';
  flex: none;
  width: 2px;
  height: 14px;
  border-radius: 2px;
  background: var(--sky);
}
.rd-more {
  flex: none;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 17px;
  border: 1px solid rgba(100, 175, 255, 0.35);
  background: rgba(100, 175, 255, 0.12);
  color: var(--ice);
  font: 600 13px var(--font);
}
.rd-more:active {
  background: rgba(100, 175, 255, 0.22);
}
.rd-more:disabled {
  opacity: 0.6;
}
@keyframes rd-pulse {
  50% {
    opacity: 0.35;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rd-live::before {
    animation: none;
  }
  .rd-foot {
    transition: none;
  }
}

/* ---------- notas de voz ---------- */
/* Con el cuadro vacío está el micrófono; al escribir o adjuntar, la flecha toma su lugar. */
.act {
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
}
.act .send,
.mic-btn {
  position: absolute;
  inset: 0;
}
.mic-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  transition:
    transform 0.3s var(--spring),
    opacity 0.2s;
}
.mic-btn:active {
  color: var(--text);
  background: var(--surface-2);
}
.has-text .mic-btn {
  transform: scale(0);
  opacity: 0;
  pointer-events: none;
}
.input-wrap:not(.has-text) .act .send {
  pointer-events: none;
}

/* La sugerencia del próximo mensaje: tenue y en cursiva en el cuadro vacío, y a la izquierda del micrófono
   el botón que la pasa al cuadro. */
.sug-btn {
  display: none;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  place-items: center;
  color: var(--blue);
}
.sug-btn:active {
  background: var(--surface-2);
}
.input-wrap.has-sug .sug-btn {
  display: grid;
  animation: sug-in 0.3s var(--spring);
}
.input-wrap.has-sug textarea::placeholder {
  font-style: italic;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes sug-in {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .input-wrap.has-sug .sug-btn {
    animation: none;
  }
}

/* Grabando: la barra ocupa todo el cuadro. */
.input-wrap.recording > :not(.rec-bar):not(.attach-tray) {
  display: none;
}
.input-wrap.recording {
  border-color: rgba(255, 77, 94, 0.45);
}
.rec-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}
.rec-bar[hidden] {
  display: none;
}
.rec-cancel {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.rec-cancel:active {
  color: var(--red);
  background: rgba(255, 77, 94, 0.12);
}
.rec-dot {
  width: 10px;
  height: 10px;
  flex: none;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px rgba(255, 77, 94, 0.8);
  animation: rec-blink 1.2s ease-in-out infinite;
}
@keyframes rec-blink {
  50% {
    opacity: 0.25;
  }
}
.rec-time {
  flex: none;
  font: 600 15px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 36px;
}
.rec-levels {
  flex: 1;
  min-width: 0;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  overflow: hidden;
}
.rec-levels i {
  flex: none;
  width: 3px;
  height: 100%;
  border-radius: 2px;
  background: var(--ice);
  opacity: 0.85;
  transform: scaleY(0.12);
  transition: transform 0.1s linear;
}
.rec-send {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
}
.rec-send:active {
  transform: scale(0.92);
}

/* La burbuja: reproductor arriba y lo que se transcribió debajo, más chico. */
.msg.user.has-voice {
  min-width: 220px;
}
.voice-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
}
.voice-note audio {
  display: none;
}
.vn-play {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--blue);
}
.vn-play:active {
  transform: scale(0.92);
}
.vn-track {
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}
.vn-track::before {
  content: '';
  position: absolute;
  inset: -14px 0;
}
.vn-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: 2px;
  background: var(--ice);
}
.vn-time {
  flex: none;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  min-width: 30px;
  text-align: right;
}
.vn-text {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
}
.msg.user.voice-pending {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  white-space: normal;
}
.voice-pending .spark {
  width: 18px;
  height: 18px;
}
.voice-pending .vn-time {
  min-width: 0;
  text-align: left;
}
.voice-pending.failed {
  border-color: rgba(255, 77, 94, 0.45);
}
.voice-pending.failed .spark {
  display: none;
}
.vn-retry {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text);
  border: 1px solid var(--line);
}
@media (prefers-reduced-motion: reduce) {
  .rec-dot {
    animation: none;
  }
  .rec-levels i {
    transition: none;
  }
}

/* Las conversas que abren las pruebas automáticas: un TEST antes del nombre, para que no asusten. */
.conv-test {
  display: none;
  flex: none;
  align-self: center;
  font: 700 10px/1 var(--mono);
  letter-spacing: 0.06em;
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  border-radius: 4px;
  padding: 3px 5px;
}
.conv.is-test .conv-test {
  display: inline-flex;
}
/* Bandera verde que Martín pone a mano: «ya estoy listo con esto». Sólo un recordatorio suyo. */
.conv-flag {
  display: none;
  flex: none;
  align-self: center;
  color: #4ade80;
}
.conv.is-flagged .conv-flag {
  display: inline-flex;
}
.mark-row {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}
.mark-row .btn {
  flex: 1;
}
.flag-toggle {
  color: #4ade80;
  border-color: rgba(74, 222, 128, 0.35);
}
.flag-toggle[aria-pressed='true'] {
  background: rgba(74, 222, 128, 0.12);
}
/* La marca «loop», también sólo de Martín: va al lado de la bandera. */
.conv-loop {
  display: none;
  flex: none;
  align-self: center;
  color: #c4b5fd;
}
.conv.is-looped .conv-loop {
  display: inline-flex;
}
.loop-toggle {
  color: #c4b5fd;
  border-color: rgba(196, 181, 253, 0.35);
}
.loop-toggle[aria-pressed='true'] {
  background: rgba(196, 181, 253, 0.12);
}
/* El 🎧 de soporte (atención al cliente), también sólo de Martín. */
.conv-urgent {
  display: none;
  flex: none;
  align-self: center;
  color: #fbbf24;
}
.conv.is-urgent .conv-urgent {
  display: inline-flex;
}
/* El teléfono del usuario de soporte. */
.conv-phones {
  display: contents;
}
.conv-phone {
  flex: none;
  padding: 1px 7px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 999px;
  background: rgba(251, 191, 36, 0.08);
  color: #fcd34d;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
}
.urgent-toggle {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}
.urgent-toggle[aria-pressed='true'] {
  background: rgba(251, 191, 36, 0.12);
}
/* La ✋ de «esperando respuesta del usuario», igual. */
.conv-awaiting {
  display: none;
  flex: none;
  align-self: center;
  color: #f87171;
}
.conv.is-awaiting .conv-awaiting {
  display: inline-flex;
}
.awaiting-toggle {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.35);
}
.awaiting-toggle[aria-pressed='true'] {
  background: rgba(248, 113, 113, 0.12);
}
/* La marca «check», igual: sólo puede haber una de las tres. */
.conv-check {
  display: none;
  flex: none;
  align-self: center;
  color: #7dd3fc;
}
.conv.is-checked .conv-check {
  display: inline-flex;
}
.check-toggle {
  color: #7dd3fc;
  border-color: rgba(125, 211, 252, 0.35);
}
.check-toggle[aria-pressed='true'] {
  background: rgba(125, 211, 252, 0.12);
}

/* Pospuestas y programadas: cuándo vuelven, en el pie de la tarjeta; y en las opciones, los chips de días. */
.conv-when {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 500 12px var(--font);
  color: var(--ice);
}
.conv-when:empty {
  display: none;
}
.chat-when {
  align-self: center;
  white-space: nowrap;
}
.pane .chat-when,
.btw-pane .chat-when {
  align-self: flex-start;
}
.when-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.when-chip {
  height: 38px;
  font-family: var(--font);
}
.when-date {
  position: relative;
}
.when-date-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}
.later-now {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--ice);
  font-size: 14px;
}
.later-now > span {
  flex: 1;
  min-width: 0;
}
.later-task > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.later-task.tap {
  cursor: pointer;
}
.later-edit {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}
.later-move {
  margin: -4px 0 12px 23px;
}
.later-text {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.later-undo {
  height: auto;
  flex: none;
  font-size: 13px;
  padding: 6px 10px;
}
.field.area {
  height: auto;
  min-height: 84px;
  padding: 14px 18px;
  margin-bottom: 10px;
  resize: none;
  line-height: 1.4;
}
.later-go {
  width: 100%;
  margin-top: 12px;
}

/* ---------- la compu: lista fija a la izquierda y la conversa a la derecha, como Claude Code ---------- */

body.desk-mode .aurora {
  opacity: 0.32;
}
.desk {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: var(--side-w, 340px) 1fr;
}
.side,
.pane {
  position: relative;
  min-width: 0;
  min-height: 0;
}
.side-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  right: -1px;
  width: 7px;
  z-index: 20;
  cursor: col-resize;
  touch-action: none;
}
.side-resizer::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  right: 0;
  width: 2px;
  background: var(--sky);
  opacity: 0;
  transition: opacity 0.15s;
}
.side-resizer:hover::after,
.is-resizing .side-resizer::after {
  opacity: 0.6;
}
.todo-resizer {
  display: none;
  right: auto;
  left: calc(100% - var(--todo-w, 320px) - 4px);
}
.todo-resizer::after {
  right: auto;
  left: 3px;
}
body.is-resizing {
  cursor: col-resize;
  user-select: none;
}
.side {
  border-right: 1px solid var(--line);
  background: rgba(12, 10, 17, 0.72);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
}
.desk .view {
  max-width: none;
}
.view.enter-fade {
  animation: fade-in 0.22s var(--ease-out) both;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.desk kbd,
.welcome kbd,
.composer-hint kbd {
  font: 500 11px/1 var(--font);
  color: var(--faint);
  padding: 3px 5px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.desk .list,
.desk .scroller {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.14) transparent;
}
.desk button:not(:disabled):hover {
  cursor: pointer;
}

/* La barra: marca, nueva conversa, buscador y el resumen. */
.side-head {
  padding: 14px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 0 6px;
}
.side-top .icon-btn {
  width: 34px;
  height: 34px;
  color: var(--muted);
}
.side-top .icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}
/* La fila de íconos: el elegido queda prendido; el embudo lleva un punto si hay un filtro puesto. */
.side-tools {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
}
.side-top .side-tool {
  position: relative;
  width: 30px;
  height: 30px;
  border-radius: 9px;
}
.side-top .side-tool[aria-pressed='true'] {
  color: #cfe0ff;
  background: rgba(90, 150, 255, 0.18);
}
.side-tool.is-set::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5a96ff;
}
.side-head [hidden] {
  display: none;
}
.side-new,
.side-search {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 10px 0 12px;
  border-radius: 11px;
  font-size: 14px;
}
.side-new {
  width: 100%;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, rgba(90, 150, 255, 0.32), rgba(36, 84, 248, 0.2));
  border: 1px solid rgba(90, 150, 255, 0.4);
  transition: background 0.2s;
}
.side-new:hover {
  background: linear-gradient(135deg, rgba(90, 150, 255, 0.42), rgba(36, 84, 248, 0.3));
}
.side-new span,
.side-search input {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.side-search {
  color: var(--faint);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: text;
  transition: border-color 0.2s;
}
.side-search:focus-within {
  border-color: rgba(90, 150, 255, 0.5);
}
.side-search input {
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font: 14px var(--font);
}
.side-search input::-webkit-search-cancel-button {
  display: none;
}
.side-search input::placeholder {
  color: var(--faint);
}
.side-head .summary {
  font-size: 12.5px;
  padding: 2px 6px 0;
  color: var(--faint);
}

.desk .list {
  padding: 4px 8px 24px;
  mask-image: linear-gradient(transparent 0, #000 10px);
}
.desk .section-label {
  margin: 16px 6px 6px;
  font-size: 10.5px;
}
.desk .filters {
  flex-wrap: wrap;
  overflow: visible;
  margin: 2px 2px 8px;
  gap: 4px;
}
.desk .filter {
  height: 26px;
  padding: 0 9px;
  font-size: 12px;
  gap: 5px;
}
.desk .filter:hover {
  color: var(--text);
  border-color: var(--line-2);
}
.desk .filter-empty {
  font-size: 13px;
}
.desk .more {
  height: 36px;
  font-size: 13px;
  border-radius: 10px;
}
.desk .more:hover {
  color: var(--text);
  background: var(--surface);
}

/* Las conversas en la barra: filas compactas; la elegida con una raya a la izquierda. */
.desk .conv-swipe {
  margin-bottom: 3px;
  border-radius: 12px;
}
.desk .conv-swipe-bg {
  display: none;
}
.desk .conv {
  gap: 10px;
  padding: 9px 10px 9px 10px;
  border-radius: 12px;
  animation: none;
  transition: background 0.15s, filter 0.15s;
}
/* Sin estado, la fila es plana; trabajando, completada o esperando conservan su borde de color. */
:where(.desk) .conv {
  background: transparent;
  border-color: transparent;
}
.desk .conv.is-running {
  animation: border-spin 3.2s linear infinite;
}
.desk .conv.is-other {
  background: transparent;
  border-color: transparent;
}
.desk .conv.is-other:hover {
  background: var(--surface);
}
:where(.desk) .conv:not(.is-running, .is-done, .is-waiting):hover {
  background: var(--surface);
}
.desk .conv.is-running:hover,
.desk .conv.is-done:hover,
.desk .conv.is-waiting:hover {
  filter: brightness(1.3);
}
.desk .conv:active {
  transform: none;
}
:where(.desk) .conv.is-active:not(.is-running, .is-done, .is-waiting) {
  background-color: var(--surface-2);
  border-color: var(--line-2);
}
.desk .conv.is-active::before,
.desk .wali-hero.is-active::after {
  content: '';
  position: absolute;
  left: -5px;
  top: 50%;
  width: 3px;
  height: 22px;
  translate: 0 -50%;
  border-radius: 3px;
  background: var(--ice);
  box-shadow: 0 0 10px var(--sky);
}
.desk .conv.is-done,
.desk .conv.is-waiting {
  box-shadow: none;
}
.desk .conv-lead {
  width: auto;
  align-self: flex-start;
  margin-top: 1px;
}
.desk .avatar,
.desk .glyph {
  width: 30px;
  height: 30px;
}
.desk .glyph {
  border-radius: 9px;
}
.desk .glyph svg {
  width: 16px;
  height: 16px;
}
.desk .from-wali-badge,
.desk .branch-badge {
  transform: scale(0.8);
  transform-origin: bottom right;
}
.desk .conv-body {
  gap: 1px;
}
.desk .conv-top {
  align-items: center;
  gap: 6px;
}
.desk .conv-title {
  font-size: 14px;
}
.desk .conv-top .chip-cwd {
  flex: none;
  max-width: 84px;
  font-size: 9.5px;
  padding: 2px 5px;
}
.desk .conv-time {
  font-size: 11.5px;
}
.desk .conv-sub {
  font-size: 12.5px;
  -webkit-line-clamp: 1;
}
.desk .conv-foot {
  margin-top: 2px;
  font-size: 12px;
}
.desk .unread-dot {
  width: 8px;
  height: 8px;
  align-self: center;
}

/* wali arriba de la barra, en chico. */
.desk .wali-hero {
  margin: 6px 0 2px;
  border-radius: 16px;
  animation: none;
}
.desk .wali-hero-main {
  gap: 10px;
  padding: 8px 54px 8px 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.desk .wali-hero-main:hover {
  filter: brightness(1.2);
}
.desk .wali-hero-main:active {
  transform: none;
}
.desk .wali-orb {
  width: 50px;
  height: 50px;
}
.desk .wali-orb .core {
  inset: 7px;
}
.desk .wali-orb .sats i {
  width: 6px;
  height: 6px;
  margin: -3px;
  transform: rotate(var(--a)) translateX(25px);
}
.desk .wali-eyebrow {
  display: none;
}
.desk .wali-name {
  font-size: 26px;
  padding: 0 0 2px;
}
.desk .wali-line {
  font-size: 12.5px;
  -webkit-line-clamp: 1;
}
.desk .wali-sub {
  font-size: 11.5px;
}
.desk .wali-hero-call {
  width: 38px;
  height: 38px;
  right: 10px;
}
.desk .wali-hero-call svg {
  width: 17px;
  height: 17px;
}

/* La conversa: encabezado fino, texto en una columna cómoda de leer y el cuadro abajo, centrado. */
.pane .chat-head,
.btw-pane .chat-head {
  padding: 10px 16px 10px 22px;
  gap: 8px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 9, 14, 0.55);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
body.call-min .pane .chat-head {
  padding-top: 58px;
}
.pane .chat-head > .icon-btn:first-child,
.btw-pane .chat-head > .icon-btn:first-child {
  display: none;
}
.pane .chat-title,
.btw-pane .chat-title {
  text-align: left;
}
.pane .chat-title b,
.btw-pane .chat-title b {
  font-size: 15px;
}
.pane .padre-title,
.btw-pane .padre-title {
  justify-content: flex-start;
}
.pane .chat-head .icon-btn:hover,
.btw-pane .chat-head .icon-btn:hover {
  background: var(--surface);
}
.pane .wali-strip,
.btw-pane .wali-strip {
  padding: 10px 22px;
  border-bottom: 1px solid var(--line);
  mask-image: none;
  flex-wrap: wrap;
}
.pane .scroller,
.btw-pane .scroller {
  padding: 28px 32px 28px;
}
.pane .scroller > *,
.btw-pane .scroller > * {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}
.pane .messages,
.btw-pane .messages {
  gap: 18px;
}
.pane .msg.claude,
.btw-pane .msg.claude {
  font-size: 15.5px;
  line-height: 1.65;
}
.pane .msg.user,
.btw-pane .msg.user {
  max-width: 78%;
  font-size: 15.5px;
}
.pane .msg-images img,
.btw-pane .msg-images img {
  cursor: zoom-in;
}
.pane .hint-empty,
.btw-pane .hint-empty {
  padding-top: 22vh;
}
.pane .composer,
.btw-pane .composer {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 32px 14px;
}
.pane .composer-row,
.btw-pane .composer-row,
.composer-hint {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}
.pane .composer-row,
.btw-pane .composer-row {
  flex: none;
}
.pane .input-wrap,
.btw-pane .input-wrap {
  min-height: 58px;
  border-radius: 18px;
  padding: 8px 8px 8px 8px;
  background: rgba(24, 21, 31, 0.9);
}
.pane .input-wrap textarea,
.btw-pane .input-wrap textarea {
  font-size: 15.5px;
  max-height: 280px;
}
.composer-hint {
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  font-size: 11.5px;
  color: var(--faint);
}
.pane .chat.is-drop .input-wrap,
.btw-pane .chat.is-drop .input-wrap {
  border-color: var(--sky);
  box-shadow: 0 0 0 4px rgba(100, 175, 255, 0.18);
}
.pane .chat.is-drop .scroller,
.btw-pane .chat.is-drop .scroller {
  outline: 2px dashed rgba(100, 175, 255, 0.45);
  outline-offset: -12px;
  border-radius: 20px;
}
.pane .steps summary:hover,
.btw-pane .steps summary:hover {
  background: var(--surface-2);
}

/* Sin conversa abierta: el cuadro para empezar y los atajos. */
.welcome {
  overflow-y: auto;
  justify-content: center;
}
.welcome-in {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 40px 32px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.welcome .empty-orb {
  width: 88px;
  height: 88px;
  margin: 0 0 22px;
}
.welcome-title {
  font: 400 46px/1.02 var(--display);
  letter-spacing: -0.012em;
  text-align: center;
  margin: 0 0 26px;
}
.welcome-title em {
  font-style: italic;
  background: linear-gradient(100deg, var(--ice), var(--blue) 60%, var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.welcome-card {
  width: 100%;
  border-radius: 20px;
  background: rgba(24, 21, 31, 0.9);
  border: 1px solid var(--line-2);
  box-shadow: 0 30px 80px -40px rgba(60, 123, 255, 0.55);
  transition: border-color 0.2s;
}
.welcome-card:focus-within {
  border-color: rgba(90, 150, 255, 0.55);
}
.welcome-card textarea {
  display: block;
  width: 100%;
  min-height: 92px;
  resize: none;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font: 16px/1.5 var(--font);
  padding: 16px 18px 6px;
}
.welcome-card .attach-tray {
  padding: 14px 16px 0;
}
.welcome-card.is-drop {
  border-color: rgba(90, 150, 255, 0.8);
  border-style: dashed;
}
.welcome-bar .attach {
  width: 34px;
  height: 34px;
}
.welcome-card textarea::placeholder {
  color: var(--faint);
}
.welcome-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 10px 12px;
}
.welcome-bar .roots {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
}
.welcome-bar .root {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  gap: 6px;
}
.welcome-bar .root:hover {
  border-color: var(--line-2);
  color: var(--text);
}
.welcome-call {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid var(--line);
}
.welcome-call:hover {
  color: var(--text);
  background: var(--surface);
}
.welcome-card .act .send {
  width: 38px;
  height: 38px;
}
.welcome-card:not(.has-text) .act .send {
  pointer-events: none;
}
/* El micrófono va suelto, a la izquierda de llamar, y no se esconde al escribir; la flecha queda
   siempre en su lugar, apagada mientras no hay nada que mandar. */
.welcome-card:not(.has-text) .act .send {
  opacity: 0.35;
  transform: none;
}
/* Grabando la nota de voz con que empieza: la barra ocupa el lugar de la fila de abajo. */
.welcome-card.recording > :not(.rec-bar):not(.attach-tray) {
  display: none;
}
.welcome-card.recording {
  border-color: rgba(255, 77, 94, 0.45);
}
.welcome-card > .rec-bar {
  padding: 10px 10px 10px 8px;
}
.welcome-hint {
  margin: 12px 0 34px;
  font-size: 13px;
  color: var(--faint);
}
.shortcuts {
  display: grid;
  grid-template-columns: auto auto;
  gap: 9px 14px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.shortcuts dt {
  text-align: right;
}
.shortcuts dd {
  margin: 0;
}

/* Las hojas del celu son ventanas centradas en la compu. */
body.desk-mode .sheet {
  top: 50%;
  bottom: auto;
  left: 50%;
  right: auto;
  width: min(560px, calc(100vw - 48px));
  max-height: 84vh;
  margin: 0;
  padding: 24px 28px 26px;
  border-radius: 24px;
  border: 1px solid var(--line-2);
  box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translate(-50%, -47%) scale(0.97);
  transition:
    transform 0.28s var(--ease-out),
    opacity 0.2s ease;
}
body.desk-mode .sheet.open {
  opacity: 1;
  transform: translate(-50%, -50%);
}
body.desk-mode .grabber {
  display: none;
}
body.desk-mode .root:hover,
body.desk-mode .voice:hover {
  border-color: var(--line-2);
}
body.desk-mode #toasts {
  bottom: 110px;
}

/* Menú del clic derecho en la compu: chico, pegado al cursor, como los de escritorio. */
.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 196px;
  padding: 5px;
  border-radius: 10px;
  background: rgba(30, 26, 38, 0.97);
  border: 1px solid var(--line-2);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.75);
  font-size: 13.5px;
  outline: none;
  opacity: 0;
  transform: scale(0.98);
  transform-origin: top left;
  transition: opacity 0.08s ease-out, transform 0.08s ease-out;
}
.ctx-menu.open {
  opacity: 1;
  transform: none;
}
.ctx-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: default;
  outline: none;
}
.ctx-item > svg {
  flex: none;
  width: 15px;
  color: var(--muted);
}
.ctx-item > span {
  flex: 1;
}
.ctx-item:hover,
.ctx-item:focus-visible,
.ctx-item:focus,
.ctx-has-sub.sub-open {
  background: var(--blue-2);
}
.ctx-item:hover > svg,
.ctx-item:focus > svg,
.ctx-has-sub.sub-open > svg {
  color: var(--text);
}
.ctx-item.danger {
  color: #ff8a95;
}
.ctx-item.danger:hover,
.ctx-item.danger:focus {
  background: var(--red);
  color: #fff;
}
.ctx-sep {
  height: 1px;
  margin: 5px 6px;
  background: var(--line-2);
}
.ctx-sub {
  display: none;
  position: absolute;
  top: -6px;
  left: calc(100% + 4px);
  min-width: 150px;
  opacity: 1;
  transform: none;
}
.ctx-menu.sub-left .ctx-sub {
  left: auto;
  right: calc(100% + 4px);
}
.ctx-has-sub.sub-open > .ctx-sub {
  display: block;
}
/* Puente invisible sobre el hueco, para que el mouse llegue al submenú sin cerrarlo. */
.ctx-sub::before {
  content: '';
  position: absolute;
  inset: 0 -8px;
  z-index: -1;
}

/* Ramas: conversas que salieron de otra (una copia con lo conversado, o una hija con un encargo).
   Van en verde agua, para no confundirse con lo de wali (violeta). */
.branch-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  z-index: 2;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #06261f;
  background: linear-gradient(135deg, #9af3df, #2fbf9f);
  box-shadow: 0 0 0 2.5px var(--bg);
}
/* En la lista cuelgan de su conversa, corridas a la derecha, con una línea que las une. */
.conv-swipe.is-branch {
  margin-left: calc(var(--depth, 1) * 20px);
}
.conv-swipe.is-branch::before {
  content: '';
  position: absolute;
  left: -13px;
  top: -10px;
  width: 10px;
  height: calc(50% + 10px);
  border-left: 1.5px solid rgba(92, 225, 198, 0.45);
  border-bottom: 1.5px solid rgba(92, 225, 198, 0.45);
  border-bottom-left-radius: 10px;
  pointer-events: none;
}
.conv-swipe.is-branch.is-swiping::before {
  display: none;
}
.conv-branch {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  font: 500 12px var(--font);
  color: var(--teal);
}
.conv-branch {
  cursor: pointer;
}
.conv-branch span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-branch svg {
  flex: none;
}
.conv-branch:empty {
  display: none;
}
/* «⇄ reactivada por …»: otra sesión la despertó del archivo. Va en su línea, bajo la descripción. */
.conv-woke {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  margin-top: 3px;
  font: 500 12px var(--font);
  color: var(--teal);
  cursor: pointer;
}
.conv-woke span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conv-woke:empty {
  display: none;
}
/* Cuántas ramas tiene; se toca para plegarlas. */
.conv-kids {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin: -2px 0;
  border-radius: 999px;
  font: 500 12px var(--font);
  color: var(--teal);
  background: rgba(92, 225, 198, 0.1);
  border: 1px solid rgba(92, 225, 198, 0.3);
  cursor: pointer;
}
.conv-kids.is-folded {
  background: rgba(92, 225, 198, 0.18);
}
.conv-kids:empty {
  display: none;
}
.banner.banner-branch {
  background: rgba(92, 225, 198, 0.08);
  border-color: rgba(92, 225, 198, 0.3);
}
.banner.banner-branch svg {
  color: var(--teal);
}
.banner.banner-branch a {
  color: var(--teal);
}
.msg.user.from-branch {
  background: linear-gradient(135deg, rgba(92, 225, 198, 0.2), rgba(47, 191, 159, 0.08));
  border-color: rgba(92, 225, 198, 0.35);
}
.from-branch .from-label {
  color: var(--teal);
}
/* Lo que manda otra sesión (@título): en ámbar, con el título de la que escribe. */
.msg.user.from-peer {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.18), rgba(245, 158, 11, 0.06));
  border-color: rgba(251, 191, 36, 0.35);
}
.from-peer .from-label {
  color: #fcd34d;
}
.wali-pill.branch-k {
  color: var(--teal);
  background: rgba(92, 225, 198, 0.1);
  border-color: rgba(92, 225, 198, 0.35);
}
.wali-pill.branch-k .k {
  color: var(--teal);
}
.branch-btn {
  width: 100%;
  margin-top: 10px;
  color: var(--teal);
  border-color: rgba(92, 225, 198, 0.35);
}

/* Volviste a un punto anterior y todavía no mandaste nada: se puede deshacer. */
.banner.banner-rewind {
  background: rgba(255, 200, 97, 0.08);
  border-color: rgba(255, 200, 97, 0.3);
}
.banner.banner-rewind svg,
.banner.banner-rewind a {
  color: #ffd98f;
}

/* ---------- subagentes ---------- */
/* La fila en vivo: encabezado con cuántos trabajan y un chip por agente. */
.agents-bar {
  margin-top: 14px;
  animation: rise 0.35s var(--ease-out) both;
}
.agents-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  font: 600 14px var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
}
.agents-line > svg {
  color: var(--faint);
}
.agents-dots {
  display: inline-flex;
  gap: 5px;
}
.agents-dots .agent-dot {
  width: 8px;
  height: 8px;
}
.agent-meta:empty {
  display: none;
}
.agents-head {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px 8px;
  font: 600 14px var(--font);
  color: var(--text);
  cursor: pointer;
}
.agents-all {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
}
.agent-chips {
  display: flex;
  gap: 8px;
}
.agent-chips > .agent-chip {
  flex: 1 1 0;
  min-width: 0;
}
.agent-chip,
.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 9px 11px;
  border-radius: 14px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  cursor: pointer;
  transition:
    background 0.2s,
    opacity 0.3s;
}
.agent-chip:active,
.agent-card:active {
  background: rgba(255, 255, 255, 0.07);
}
.agent-chip-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.agent-title {
  font: 600 13px/1.25 var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-act,
.agent-meta {
  font-size: 12px;
  line-height: 1.25;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-meta {
  font-family: var(--mono);
  font-size: 11px;
}
.agent-more {
  flex: none;
  min-width: 48px;
  min-height: 48px;
  border-radius: 14px;
  font: 600 14px var(--font);
  color: var(--ice);
  border: 1px dashed var(--line);
  cursor: pointer;
}
/* El punto: late mientras trabaja, verde agua listo, rojo si falló. */
.agent-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: hsl(var(--h) 95% 68%);
}
.st-running .agent-dot {
  box-shadow: 0 0 0 0 hsl(var(--h) 95% 68% / 0.6);
  animation: sess-ping 1.8s var(--ease-out) infinite;
}
.st-done .agent-dot {
  background: var(--teal);
}
.st-error .agent-dot {
  background: #ff7a7a;
}
.st-background .agent-dot {
  background: transparent;
  border: 1.5px solid var(--sky);
}
.agent-chip.st-done,
.agent-chip.st-background {
  opacity: 0.6;
}
/* En el historial: los agentes lanzados juntos van en un bloque. */
.agents-team {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: rise 0.4s var(--ease-out) both;
}
.agent-card {
  width: 100%;
}
.agent-card > svg {
  flex: none;
  color: var(--faint);
}
.agent-state {
  flex: none;
  font: 600 12px var(--font);
  color: var(--muted);
}
.agent-card.st-running .agent-state {
  color: var(--ice);
}
.agent-card.st-done .agent-state {
  color: var(--teal);
}
.agent-card.st-error .agent-state {
  color: #ff9a9a;
}
.agent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.agent-sheet h2 {
  font-size: 24px;
  line-height: 1.2;
}
.agent-report {
  margin-top: 14px;
  line-height: 1.55;
}
.agent-steps {
  margin-top: 16px;
}
.agent-steps summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}
/* En la lista: un satélite por agente trabajando alrededor del avatar. */
.agent-sats {
  position: absolute;
  inset: 0;
  pointer-events: none;
  animation: spin 12s linear infinite;
}
.agent-sats i {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px;
  border-radius: 50%;
  background: hsl(var(--h) 95% 70%);
  box-shadow: 0 0 6px hsl(var(--h) 95% 60%);
  transform: rotate(var(--a)) translateX(23px);
}
/* Las ramas que trabajan van en teal, como sus badges, y un poco más grandes: son conversas enteras. */
.agent-sats i.rama {
  width: 7px;
  height: 7px;
  margin: -3.5px;
  background: var(--teal);
  box-shadow: 0 0 7px var(--teal);
}
.conv-agents {
  font: 600 12px var(--font);
  color: var(--ice);
}
.conv-agents:empty {
  display: none;
}

/* Subagentes que trabajan solos (claude -p en tmux): una tarjeta por cada uno, en tono terminal,
   para no confundirlos con las ramas (verde agua) ni con los agentes del turno (puntos). */
/* La barra va fija arriba del chat (no al final): un resumen y, debajo, lo que te necesita. */
.subs-bar {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 10px;
  position: relative;
  z-index: 2;
  animation: rise 0.35s var(--ease-out) both;
}
.subs-sum,
.subs-alert {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px 0 8px;
  border-radius: 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}
.subs-sum:active,
.subs-alert:active {
  background: rgba(255, 255, 255, 0.07);
}
.subs-sum > svg,
.subs-alert > svg {
  flex: none;
  margin-left: auto;
  color: var(--faint);
}
/* Todo terminado: queda a mano pero sin llamar la atención. */
.subs-sum.is-quiet {
  opacity: 0.7;
  background: transparent;
}
.subs-ico {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  color: var(--ice);
  background: rgba(100, 175, 255, 0.12);
}
.subs-sum.is-quiet .subs-ico {
  color: var(--teal);
  background: rgba(92, 225, 198, 0.1);
}
.subs-sum.is-working .subs-ico::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 11px;
  border: 1.5px solid transparent;
  background: conic-gradient(from var(--spin), var(--sky), transparent 40%, var(--sky)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  animation: border-spin 1.6s linear infinite;
}
.subs-k {
  flex: none;
  font: 600 13px var(--font);
}
.subs-segs {
  display: flex;
  gap: 9px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.subs-seg {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 4px;
  font-size: 12.5px;
  color: var(--muted);
}
.subs-seg i,
.subs-alert > i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
}
.subs-seg.st-working {
  color: var(--ice);
}
.subs-seg.st-working i {
  background: var(--sky);
  animation: sess-ping 1.8s var(--ease-out) infinite;
  --h: 210;
}
.subs-seg.st-waiting {
  color: #ffd98f;
}
.subs-seg.st-waiting i,
.subs-alert.st-waiting > i {
  background: #ffc861;
}
.subs-seg.st-dead {
  color: #ff9a9a;
}
/* Esperando algo (un cron, un deploy): lavanda, quieto. No es una pregunta (ámbar) ni trabajo (celeste). */
.subs-seg.st-holding {
  color: #cdbfff;
}
.subs-seg.st-holding i,
.subs-alert.st-holding > i {
  background: #a993ff;
}
.subs-seg.st-dead i,
.subs-alert.st-dead > i {
  background: #ff6b7a;
}
.subs-seg.st-done i {
  background: var(--teal);
}
.subs-seg.st-done svg {
  color: var(--teal);
}
/* Una línea por cada uno que te necesita: se toca y abre ése. */
.subs-alert {
  min-height: 40px;
  padding-left: 14px;
  font-size: 13px;
}
.subs-alert.st-waiting {
  color: #ffd98f;
  background: rgba(255, 200, 97, 0.08);
  border-color: rgba(255, 200, 97, 0.35);
}
.subs-alert.st-holding {
  color: #cdbfff;
  background: rgba(169, 147, 255, 0.08);
  border-color: rgba(169, 147, 255, 0.3);
}
.subs-alert.st-holding span {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subs-alert.st-dead {
  color: #ff9a9a;
  background: rgba(255, 77, 94, 0.08);
  border-color: rgba(255, 77, 94, 0.3);
}
.subs-alert b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  color: var(--text);
}
.subs-alert span {
  flex: none;
}
.subs-list .agent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subs-ended {
  display: flex;
  flex-direction: column;
}
.sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 4px;
  text-align: left;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.sub-row:active {
  background: rgba(255, 255, 255, 0.05);
}
.sub-row-ico {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: var(--teal);
  background: rgba(92, 225, 198, 0.1);
}
.sub-row-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.sub-row-meta {
  flex: none;
  font-size: 12px;
  color: var(--faint);
}
.sub-row > svg {
  flex: none;
  color: var(--faint);
}
.sub-card {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border-radius: 16px;
  text-align: left;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  cursor: pointer;
}
.sub-card:active {
  background: rgba(255, 255, 255, 0.07);
}
.sub-card > svg {
  flex: none;
  color: var(--faint);
}
.sub-ico {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--ice);
  background: rgba(100, 175, 255, 0.12);
}
.sub-card.st-working .sub-ico::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: conic-gradient(from var(--spin), var(--sky), transparent 40%, var(--sky)) border-box;
  -webkit-mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  mask: linear-gradient(#000 0 0) padding-box exclude, linear-gradient(#000 0 0);
  animation: border-spin 1.6s linear infinite;
}
.sub-card.st-waiting {
  border-color: rgba(255, 200, 97, 0.35);
}
.sub-card.st-waiting .sub-ico {
  color: #ffd98f;
  background: rgba(255, 200, 97, 0.12);
}
.sub-card.st-holding {
  border-color: rgba(169, 147, 255, 0.3);
}
.sub-card.st-holding .sub-ico {
  color: #cdbfff;
  background: rgba(169, 147, 255, 0.12);
}
.sub-card.is-quiet .sub-state {
  color: var(--muted);
}
.sub-card.st-done .sub-ico {
  color: var(--teal);
  background: rgba(92, 225, 198, 0.1);
}
.sub-card.st-dead .sub-ico {
  color: #ff9a9a;
  background: rgba(255, 77, 94, 0.12);
}
.sub-card.st-done,
.sub-card.st-dead {
  opacity: 0.75;
}
.sub-foot {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.sub-state {
  flex: none;
  font: 600 12px var(--font);
  color: var(--ice);
}
.st-waiting .sub-state,
.sub-state.st-waiting {
  color: #ffd98f;
}
.st-holding .sub-state,
.sub-state.st-holding {
  color: #cdbfff;
}
/* La hoja de uno que espera: qué espera, desde cuándo, y debajo el cuadro para decirle algo. */
.sub-hold {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 13.5px;
  background: rgba(169, 147, 255, 0.08);
  border: 1px solid rgba(169, 147, 255, 0.3);
}
.sub-hold b {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #e3dbff;
}
.sub-hold-cmd {
  display: block;
  margin-top: 4px;
  font: 11.5px var(--mono);
  color: var(--muted);
  white-space: pre-wrap;
  word-break: break-all;
}
.sub-say {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 4px;
}
.sub-say textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  font: 15px var(--font);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  resize: vertical;
}
.sub-say .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.st-done .sub-state,
.sub-state.st-done {
  color: var(--teal);
}
.st-dead .sub-state,
.sub-state.st-dead {
  color: #ff9a9a;
}
.sub-sheet h3 {
  margin: 18px 0 6px;
  font: 600 14px var(--font);
  color: var(--muted);
}
.sub-question {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  line-height: 1.5;
  background: rgba(255, 200, 97, 0.08);
  border: 1px solid rgba(255, 200, 97, 0.3);
  max-height: 40vh;
  overflow: auto;
}
.sub-question :is(h1, h2, h3, h4) {
  margin: 6px 0 4px;
  font: 600 16px/1.35 var(--font);
}
.sub-question code {
  overflow-wrap: anywhere;
  white-space: normal;
}
.sub-question > b {
  display: block;
  margin-bottom: 4px;
  color: #ffd98f;
}
.sub-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sub-steps li {
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.sub-steps li.k-tool {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}
.sub-steps li.k-result {
  font-size: 12px;
  color: var(--teal);
}
.sub-steps li.k-text {
  max-height: 14em;
  overflow: auto;
}
.sub-where {
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.conv-subs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: 600 12px var(--font);
  color: var(--ice);
}
.conv-subs.is-asking {
  color: #ffd98f;
}
.conv-subs.is-holding {
  color: #cdbfff;
}
.conv-subs:empty {
  display: none;
}
/* Sólo un subagente trabajando: no hay turno que detener. */
.working.only-subs .stop,
.working.only-subs .btw-ask {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .sub-card.st-working .sub-ico::after,
  .subs-sum.is-working .subs-ico::after,
  .subs-seg.st-working i,
  .agent-sats,
  .st-running .agent-dot {
    animation: none;
  }
}

/* ---------- pendientes ---------- */
/* Arriba a la derecha, en el encabezado de la conversa. */
.todo-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px;
  border-radius: 12px;
  font: 600 12px var(--mono);
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  cursor: pointer;
}
/* El anillo se llena con lo hecho. */
.todo-ring {
  --p: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(var(--teal) calc(var(--p) * 360deg), rgba(255, 255, 255, 0.12) 0);
  -webkit-mask: radial-gradient(closest-side, transparent 58%, #000 62%);
  mask: radial-gradient(closest-side, transparent 58%, #000 62%);
}
.todo-panel {
  display: none;
}
.todo-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.todo-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 15px;
}
.todo-head .muted {
  font: 500 12px var(--mono);
}
.todo-bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.todo-bar i {
  display: block;
  height: 100%;
  background: var(--teal);
  border-radius: inherit;
  transition: width 0.4s var(--ease-out);
}
.todo-list {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.todo {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  border-radius: 10px;
  animation: rise 0.3s var(--ease-out) both;
}
.todo:not(.is-sub) + .todo:not(.is-sub),
.todo.is-sub + .todo:not(.is-sub) {
  margin-top: 6px;
}
.todo.is-sub {
  padding-left: calc(24px * var(--d, 1));
  min-height: 36px;
}
.todo-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--text);
}
.todo-num {
  margin-right: 6px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.todo:not(.is-sub) > .todo-text {
  font-weight: 600;
}
.todo.is-done > .todo-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(255, 255, 255, 0.25);
}
/* El check: 44 px de área para el dedo, 20 de caja. */
.todo-check {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.todo-check::before {
  content: '';
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1.5px solid var(--faint);
}
.todo-check svg {
  grid-area: 1 / 1;
  color: #06261f;
  z-index: 1;
}
.todo.is-done .todo-check::before {
  background: var(--teal);
  border-color: var(--teal);
}
/* En curso: la caja se vuelve un circulito que gira (el arco en teal sobre un anillo tenue). */
.todo.is-active .todo-check::before {
  border-radius: 50%;
  border: 2px solid rgba(92, 225, 198, 0.2);
  border-top-color: var(--teal);
  border-right-color: var(--teal);
  animation: todo-spin 0.8s linear infinite;
}
.todo.is-active > .todo-text {
  color: var(--text);
}
@keyframes todo-spin {
  to {
    transform: rotate(360deg);
  }
}
/* En el celu, el anillo del botón respira mientras hay algo en curso. */
.todo-pill.is-active .todo-ring {
  animation: todo-breathe 1.6s ease-in-out infinite;
}
@keyframes todo-breathe {
  50% {
    opacity: 0.45;
  }
}
.todo-x {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  color: var(--faint);
  border-radius: 8px;
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.15s;
}
.todo:hover .todo-x,
.todo-x:focus-visible,
.todo-sheet .todo-x {
  opacity: 1;
}
.todo-add {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 10px;
  border-radius: 12px;
  color: var(--muted);
  border: 1px dashed var(--line);
}
.todo-add-input {
  flex: 1;
  min-width: 0;
  font: 400 14px var(--font);
  color: var(--text);
  background: none;
  border: 0;
  outline: none;
}
.todo-empty {
  line-height: 1.5;
}
/* En la compu ancha, la lista vive en un panel a la derecha de la conversa. */
@media (min-width: 1180px) {
  .desk .view.chat.has-todos {
    padding-right: var(--todo-w, 320px);
  }
  .desk .view.chat.has-todos .todo-resizer {
    display: block;
  }
  .desk .view.chat.has-todos .todo-panel {
    display: block;
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: var(--todo-w, 320px);
    overflow-y: auto;
    padding: 22px 18px;
    border-left: 1px solid var(--line);
    background: rgba(12, 10, 17, 0.5);
  }
  .desk .view.chat.has-todos .todo-pill {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .todo,
  .todo-bar i,
  .todo.is-active .todo-check::before,
  .todo-pill.is-active .todo-ring {
    animation: none;
    transition: none;
  }
}

/* Esconder la lista de pendientes (opcional; por defecto se ve). */
.todo-head {
  gap: 8px;
}
.todo-head .muted {
  margin-left: auto;
}
.todo-hide {
  flex: none;
  width: 32px;
  height: 32px;
  margin: -6px -6px -6px 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--faint);
  cursor: pointer;
}
.todo-hide:hover {
  color: var(--text);
}
.todos-btn {
  color: var(--ice);
  border-color: var(--line);
}
.todo-toggle {
  display: none !important;
}
body.todos-off .todo-panel,
body.todos-off .todo-resizer,
body.todos-off .todo-pill {
  display: none !important;
}
@media (min-width: 1180px) {
  body.todos-off .desk .view.chat.has-todos {
    padding-right: 0;
  }
  body.todos-off .desk .view.chat.has-todos .todo-toggle {
    display: grid !important;
  }
}

/* ---------- créditos de Claude (inicio) ---------- */
.usage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 420px;
  margin-top: 14px;
  padding: 0;
  text-align: left;
  cursor: pointer;
}
.usage-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.usage-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.usage-k {
  font: 600 11px var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.usage-v {
  font: 600 13px var(--mono);
  color: var(--text);
}
.usage-bar {
  position: relative;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
}
.usage-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sky), var(--teal));
  transition: width 0.6s var(--ease-out);
}
.lv-warm .usage-bar i {
  background: #ffc861;
}
.lv-hot .usage-bar i {
  background: #ff7a7a;
}
.lv-warm .usage-v {
  color: #ffd98f;
}
.lv-hot .usage-v {
  color: #ff9a9a;
}
/* La marca de cuánto de la semana ya pasó. */
.usage-bar b {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.55);
}
.usage-reset {
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-head .usage {
  margin: 10px 2px 0;
  max-width: none;
}
/* Los tokens de hoy, al lado de la semana: sin barra, el número va solo. */
.usage-today .usage-reset {
  margin-top: 11px;
}
/* Hoy hora por hora, en chiquitito: ocupa el alto de la barra y el «renueva» de al lado. */
.usage-hours {
  display: flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.usage-hours > span {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 1.5px 1.5px 0 0;
  overflow: hidden;
}
.usage-hours i {
  display: block;
  flex: none;
}
/* La cuenta de Claude, chiquita bajo «wali». */
.acct {
  margin: 6px 0 0 17px;
  font: 400 11px/1.2 var(--font);
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-head .acct {
  margin: 0 8px 2px 23px;
}

/* El detalle del uso de tokens (openTokens) y la tarjeta de Opciones (tokensCard). */
.tok-acct {
  margin-top: -4px;
}
.usage.tok-week {
  grid-template-columns: 1fr;
  max-width: none;
  cursor: default;
}
.tok-periods {
  display: flex;
  gap: 8px;
  margin: 18px 0 14px;
}
.tok-periods .root {
  height: 34px;
  font-size: 13px;
}
.tok {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tok-total {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tok-total strong {
  font: 400 34px/1.1 var(--display);
  color: var(--text);
}
.tok-chart {
  display: flex;
  align-items: stretch;
  gap: 3px;
  height: 130px;
  padding-top: 4px;
}
.tok-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: stretch;
  gap: 4px;
  padding: 0;
  cursor: pointer;
}
.tok-col small {
  font: 400 9.5px var(--mono);
  color: var(--faint);
  text-align: center;
}
.tok-stack {
  display: flex;
  flex-direction: column;
  min-height: 2px;
  border-radius: 4px 4px 1px 1px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.tok-col:hover .tok-stack,
.tok-col:focus-visible .tok-stack {
  filter: brightness(1.25);
}
.t-main {
  background: var(--sky);
}
.t-agents {
  background: var(--violet);
}
.t-other {
  background: rgba(255, 255, 255, 0.28);
}
.tok-stack i {
  display: block;
  flex: none;
}
.tok-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--muted);
}
.tok-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tok-legend i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.tok-note {
  min-height: 1.3em;
}
.tok-sessions .res-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tok-mini {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: var(--sky);
  opacity: 0.6;
}
.tok-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  text-align: left;
  color: var(--text);
  font: inherit;
}
.tok-card-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.tok-card-top strong {
  font: 600 17px var(--mono);
}
.tok-card-more {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  color: var(--sky);
}
.tok-card-line {
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
}
.tok-card-line.faint {
  color: var(--faint);
}
/* El gasto de una conversa en el tiempo (openConvTokens): barras de ancho fijo que se desplazan de lado. */
.tok-scroll {
  position: relative;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.tok-scroll::-webkit-scrollbar {
  display: none;
}
.tok-max {
  position: sticky;
  left: 0;
  display: block;
  height: 0;
  font: 400 9.5px var(--mono);
  color: var(--faint);
}
.tok-chart.tok-time {
  gap: 2px;
  width: max-content;
  min-width: 100%;
  padding-top: 14px;
}
.tok-time .tok-col {
  flex: 1 0 9px;
  max-width: 24px;
}
.tok-time .tok-col.is-sel .tok-stack {
  filter: brightness(1.35);
  box-shadow: 0 0 0 1.5px var(--text);
}
.tok-time .tok-col small {
  width: 0;
  overflow: visible;
  white-space: nowrap;
  text-align: left;
  height: 12px;
}
.tok-time .tok-stack {
  border-radius: 2px 2px 1px 1px;
}
.tok-empty {
  cursor: default;
}
.tok-empty .tok-stack {
  min-height: 1px;
  opacity: 0.5;
}
.tok-gap {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 30px;
  margin: 0 2px;
  padding-bottom: 16px;
  border-left: 1px dashed var(--line);
  border-right: 1px dashed var(--line);
}
.tok-gap small {
  font: 400 9px var(--mono);
  color: var(--faint);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}
@media (prefers-reduced-motion: reduce) {
  .usage-bar i {
    transition: none;
  }
}

/* ---------- recursos de la VM (Ajustes) ---------- */
.usage.vm {
  grid-template-columns: auto 1fr 1fr 1fr;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
}
.vm-ic {
  display: grid;
  place-items: center;
  height: 28px;
  color: var(--muted);
}
.vm .usage-reset {
  display: none;
}
.side-head .usage.vm {
  margin: 10px 2px 0;
}
.res {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}
.res .res-bars {
  max-width: none;
  margin: 4px 0 2px;
  cursor: default;
}
.res-h {
  margin: 10px 0 0;
  font: 600 12px var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.res-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.res-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.res-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
}
button.res-row {
  cursor: pointer;
}
.res-list li:has(> .res-row) {
  display: block;
}
.res-browse {
  margin-top: 6px;
}
.files-crumbs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  white-space: nowrap;
  font: 13px var(--mono);
  color: var(--faint);
  scrollbar-width: none;
}
.files-crumbs button {
  padding: 4px 3px;
  color: var(--muted);
  font: inherit;
}
.files-crumbs button:last-child {
  color: var(--text);
}
.res-name.is-dir {
  color: var(--text);
}
.res-name svg {
  vertical-align: -2px;
  color: var(--muted);
}
.res-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.res-name.mono,
.res-num {
  font-family: var(--mono);
  font-size: 13px;
}
.res-name small {
  color: var(--faint);
}
.res-num {
  flex: none;
  color: var(--muted);
}

/* ---------- /btw: pregunta al margen ---------- */
.btw-ask {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #cfc6ff;
  border: 1px solid rgba(143, 125, 255, 0.35);
  background: rgba(143, 125, 255, 0.08);
}
.btw-ask:active {
  background: rgba(143, 125, 255, 0.18);
}
.btw-chip {
  flex: none;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 8px 0 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: #e3dcff;
  background: rgba(143, 125, 255, 0.2);
  border: 1px solid rgba(143, 125, 255, 0.45);
  animation: btw-pop 0.25s var(--spring) both;
}
.btw-row {
  flex-basis: 100%;
  display: flex;
  padding: 2px 0 0 6px;
}
.btw-row[hidden] {
  display: none;
}
.input-wrap.is-btw textarea {
  padding-left: 12px;
}
.btw-chip svg:last-child {
  opacity: 0.6;
}
@keyframes btw-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
}
.input-wrap.is-btw,
.input-wrap.is-btw:focus-within {
  border-color: rgba(143, 125, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(143, 125, 255, 0.14);
}
/* Al margen no se adjuntan imágenes ni notas de voz: se manda con la flecha. */
.input-wrap.is-btw .attach,
.input-wrap.is-btw .mic-btn {
  display: none;
}
.input-wrap.is-btw .act .send {
  background: var(--violet);
  transform: scale(1);
  opacity: 0.35;
}
.input-wrap.is-btw.has-text .act .send {
  opacity: 1;
}

.slash-menu,
.btw-card {
  position: absolute;
  z-index: 3;
  left: 12px;
  right: 12px;
  bottom: calc(100% - 4px);
  background: #1a1622;
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  border: 1px solid var(--line-2);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.slash-menu[hidden],
.btw-card[hidden] {
  display: none;
}
.slash-menu {
  padding: 6px;
  border-radius: 18px;
  animation: rise 0.2s var(--ease-out) both;
}
.slash-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  color: var(--text);
}
.slash-item.on {
  background: rgba(143, 125, 255, 0.14);
}
.slash-ico {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #d9d0ff;
  background: rgba(143, 125, 255, 0.22);
}
.slash-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}
.slash-txt b {
  font: 600 14px var(--mono);
}
.slash-txt.is-at b {
  font: 600 14px var(--font);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.slash-txt span {
  font-size: 13px;
  color: var(--muted);
}
.slash-item kbd {
  font: 11px var(--mono);
  color: var(--faint);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 2px 6px;
}

.btw-card {
  display: flex;
  flex-direction: column;
  max-height: min(58vh, 520px);
  padding: 4px 16px 12px;
  border-radius: 22px;
  border-color: rgba(143, 125, 255, 0.35);
  touch-action: pan-x;
  transition:
    transform 0.2s var(--ease-out),
    opacity 0.2s;
  animation: btw-in 0.32s var(--ease-out) both;
}
.btw-card.leaving {
  opacity: 0;
  transform: translateY(14px) scale(0.98);
}
@keyframes btw-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
}
.btw-grip {
  width: 36px;
  height: 4px;
  margin: 6px auto 2px;
  border-radius: 2px;
  background: var(--line-2);
}
.btw-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btw-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cfc6ff;
}
.btw-close {
  width: 36px;
  height: 36px;
  margin-right: -10px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.btw-close:hover,
.btw-act:hover {
  background: var(--surface-2);
}
.btw-q {
  margin: 0 0 10px;
  padding-left: 10px;
  border-left: 2px solid rgba(143, 125, 255, 0.5);
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.btw-body {
  flex: 1 1 auto;
  min-height: 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  font-size: 15px;
}
.btw-body.error .btw-err {
  color: #ff9aa4;
  margin: 0;
}
.btw-wait {
  display: inline-flex;
  gap: 5px;
  padding: 8px 0;
}
.btw-wait i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cfc6ff;
  animation: btw-dot 1.2s ease-in-out infinite;
}
.btw-wait i:nth-child(2) {
  animation-delay: 0.15s;
}
.btw-wait i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes btw-dot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
.btw-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.btw-note {
  flex: 1;
  font-size: 12px;
  color: var(--faint);
}
.btw-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
}
.btw-act[hidden] {
  display: none;
}
.btw-act:active {
  background: var(--surface-2);
}
.pane .slash-menu,
.pane .btw-card {
  left: 32px;
  right: 32px;
  max-width: 800px;
  margin: 0 auto;
  bottom: calc(100% - 2px);
}
@media (prefers-reduced-motion: reduce) {
  .btw-card,
  .slash-menu,
  .btw-chip,
  .btw-wait i {
    animation: none;
  }
}

/* ---------- inicio: créditos y VM plegables ---------- */
/* Debajo del saludo, la fila de íconos de las herramientas (sin el resumen en palabras). */
.summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-left: -5px;
}
.stats-toggle {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  color: var(--faint);
  transition: color 0.2s, background 0.2s;
}
.stats-toggle:hover {
  color: var(--text);
  background: var(--surface);
}
.stats-toggle[aria-pressed='true'] {
  color: #cfe0ff;
  background: rgba(90, 150, 255, 0.18);
}
/* ---------- ordenar la lista arrastrando ---------- */
.conv-swipe.is-lifted {
  z-index: 5;
  transition: none;
  background: var(--bg-2);
}
.conv-swipe.drag-hidden {
  display: none;
}
.conv-swipe.is-lifted > .conv {
  transform: scale(1.02);
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.75);
  transition: transform 0.15s var(--ease-out);
}
.desk .conv-swipe.is-lifted > .conv {
  cursor: grabbing;
}
/* Llevando varias: el número en la esquina. */
.conv-swipe.is-lifted[data-count]::before {
  content: attr(data-count);
  position: absolute;
  top: -8px;
  right: -6px;
  z-index: 2;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font: 700 13px/1 var(--font);
  color: #fff;
  background: var(--blue);
  box-shadow: 0 4px 14px rgba(36, 84, 248, 0.6);
}
/* Dónde cae: una línea azul arriba o abajo de la hermana. */
.conv-swipe.drop-before::after,
.conv-swipe.drop-after::after {
  content: '';
  position: absolute;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 2px;
  background: var(--sky);
  box-shadow: 0 0 10px rgba(100, 175, 255, 0.7);
  pointer-events: none;
}
.conv-swipe.drop-before::after {
  top: -7px;
}
.conv-swipe.drop-after::after {
  bottom: -7px;
}
.desk .conv-swipe.drop-before::after {
  top: -4px;
}
.desk .conv-swipe.drop-after::after {
  bottom: -4px;
}

/* ---------- inicio en el celu: un solo scroll ---------- */
/* El encabezado y la lista corren juntos: nada cambia de alto mientras se baja, así el dedo no pelea con la lista. */
.home-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
.home-scroll > .list {
  flex: none;
  overflow: visible;
  mask-image: none;
  padding-top: 4px;
}
/* La ruedita de tirar para recargar: espera escondida arriba y baja con el dedo. */
.ptr {
  position: absolute;
  z-index: 2;
  top: calc(var(--safe-t) - 34px);
  left: 50%;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  opacity: 0;
  pointer-events: none;
}
.ptr-spin {
  display: block;
  width: 100%;
  height: 100%;
  border: 2.5px solid color-mix(in srgb, var(--text) 18%, transparent);
  border-top-color: var(--text);
  border-radius: 50%;
}
.ptr.is-ready .ptr-spin {
  border-top-color: var(--sky);
}
.ptr.is-busy .ptr-spin {
  animation: spin 0.8s linear infinite;
}
/* La barra fina de arriba: aparece cuando el saludo sale de la vista (sólo opacidad y desplazamiento). */
.home-bar {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(var(--safe-t) + 6px) 14px 8px 22px;
  background: #0a090f;
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, 0.8);
  border-bottom: 1px solid var(--line);
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition:
    opacity 0.2s var(--ease-out),
    transform 0.25s var(--ease-out);
}
.home.is-condensed .home-bar {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.home-bar-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 40px;
  text-align: left;
}
.home-bar-sum {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--muted);
}
.home-bar .icon-btn {
  width: 40px;
  height: 40px;
}
/* El buscador del celu: aparece entre el título de la lista y los filtros al tocar la lupa. */
.home-search {
  margin: 2px 0 12px;
  height: 42px;
}
.home-search[hidden] {
  display: none;
}
.home-search input {
  font-size: 16px; /* con menos, Safari hace zoom al enfocar */
}
.home-search-x {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: -4px;
  border-radius: 50%;
  color: var(--muted);
}
/* «Nueva conversa» se hunde y se desvanece al bajar por la lista, y vuelve con un rebote al subir. */
.fab {
  transition:
    transform 0.25s var(--ease-out),
    translate 0.5s var(--spring),
    scale 0.5s var(--spring),
    opacity 0.3s var(--ease-out);
}
.home.fab-hide .fab {
  translate: 0 calc(100% + var(--safe-b) + 30px);
  scale: 0.85;
  opacity: 0;
  pointer-events: none;
  transition:
    transform 0.25s var(--ease-out),
    translate 0.35s var(--ease-out),
    scale 0.35s var(--ease-out),
    opacity 0.25s 0.05s;
}
/* Mientras se desliza, lo que gira o respira se queda quieto: el scroll no compite con repintar. */
.home.is-scrolling *,
.home.is-scrolling *::before,
.home.is-scrolling *::after {
  animation-play-state: paused !important;
}
/* Los filtros que no tienen ninguna conversa no se muestran (salvo el elegido): la fila queda corta y clara. */
.home-scroll .filter.is-empty:not([aria-pressed='true']) {
  display: none;
}
.home-scroll .filters {
  scroll-snap-type: x proximity;
  scroll-padding: 0 8px;
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.home-scroll .filter {
  scroll-snap-align: start;
}
/* La entrada animada de una tarjeta va una sola vez (si cambia de lugar no vuelve a subir). */
.conv-swipe.seen > .conv,
.wali-hero.seen {
  animation: none;
}
.conv-swipe.seen > .conv.is-running {
  animation: border-spin 3.2s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .home-bar,
  .fab {
    transition: none;
  }
}
/* El botón tocado mientras se abre la conversa: queda entero y con un brillo que corre (el otro se apaga). */
.btn.is-busy:disabled {
  opacity: 1;
  position: relative;
  overflow: hidden;
}
.btn.is-busy::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.18) 50%, transparent 70%);
  animation: busy-sheen 1.1s linear infinite;
}
@keyframes busy-sheen {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

/* ---------- @menciones como caja en el cuadro ---------- */
/* El textarea va encima, transparente cuando hay una mención; detrás, la misma letra pintada con la caja. */
.ta-box {
  flex: 1;
  min-width: 0;
  position: relative;
  display: flex;
}
.ta-box textarea {
  position: relative;
  width: 100%;
  overflow-wrap: break-word;
  white-space: pre-wrap;
}
.ta-box.has-at textarea {
  color: transparent;
  caret-color: var(--text);
}
.ta-marks {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  box-sizing: border-box;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  color: var(--text);
  pointer-events: none;
}
.ta-box.has-at .ta-marks {
  display: block;
}
.at-chip {
  color: #d8e6ff;
  font-weight: inherit;
  background: rgba(90, 150, 255, 0.26);
  border-radius: 7px;
  box-shadow:
    0 0 0 3px rgba(90, 150, 255, 0.26),
    0 0 0 4px rgba(120, 170, 255, 0.35);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- «btw!»: la rama al margen ---------- */
/* En la compu ancha: la pantalla se parte y la rama queda a la derecha (el borde se arrastra). */
body.has-aside .desk {
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--aside-w, 480px);
}
.btw-pane {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-left: 1px solid rgba(92, 225, 198, 0.22);
  background: rgba(12, 10, 17, 0.6);
  animation: fade-in 0.22s var(--ease-out) both;
}
.aside-resizer {
  right: auto;
  left: -4px;
}
.aside-resizer::after {
  right: auto;
  left: 3px;
  background: var(--teal);
}
.aside-mark {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--teal);
}
.view.is-aside .banner {
  display: none;
}
/* Con la rama al lado, los pendientes de la principal pasan al anillo: no hay espacio para su panel. */
@media (min-width: 1180px) {
  body.has-aside .desk .pane .view.chat.has-todos {
    padding-right: 0;
  }
  body.has-aside .desk .pane .view.chat.has-todos .todo-panel,
  body.has-aside .desk .pane .view.chat.has-todos .todo-resizer {
    display: none;
  }
  body.has-aside .desk .pane .view.chat.has-todos .todo-pill {
    display: inline-flex;
  }
}

/* En el celu: una hoja que sube sobre la conversa, a pantalla completa o achicada a una píldora arriba. */
.btw-sheet {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--vvt, 0px) + var(--vvh, 100dvh) * 0.36);
  height: calc(var(--vvh, 100dvh) * 0.64);
  z-index: calc(var(--z-sheet) - 1);
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  border-top: 1px solid rgba(92, 225, 198, 0.3);
  background: rgba(16, 13, 23, 0.97);
  -webkit-backdrop-filter: blur(24px);
  backdrop-filter: blur(24px);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
  transform: translateY(105%);
  transition:
    transform 0.32s var(--ease-out),
    top 0.32s var(--ease-out),
    height 0.32s var(--ease-out);
}
.btw-sheet.open {
  transform: none;
}
.btw-sheet[data-mode='full'],
body.kb-open .btw-sheet[data-mode='half'] {
  top: calc(var(--vvt, 0px) + var(--safe-t) + 8px);
  height: calc(var(--vvh, 100dvh) - var(--safe-t) - 8px);
}
.btw-sheet > .view {
  top: 12px;
}
.btw-sheet .chat-head,
body.call-min .btw-sheet .chat-head {
  padding-top: 4px;
  background: none;
}
.btw-sheet-grip {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 40px;
  height: 5px;
  margin-left: -20px;
  border-radius: 3px;
  background: var(--line-2);
  z-index: 3;
}
.aside-mini {
  display: none;
}
.btw-sheet[data-mode='min'] {
  top: calc(var(--vvt, 0px) + var(--vvh, 100dvh) - var(--below, 90px) - 48px);
  left: auto;
  right: 12px;
  height: 40px;
  max-width: 72vw;
  border-radius: 20px;
  border: 1px solid rgba(92, 225, 198, 0.35);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5);
}
.btw-sheet[data-mode='min'] > .view,
.btw-sheet[data-mode='min'] .btw-sheet-grip {
  display: none;
}
.btw-sheet[data-mode='min'] .aside-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  padding: 0 14px;
  color: var(--text);
  font: 500 14px/1 var(--font);
  white-space: nowrap;
  cursor: pointer;
}
.aside-mini b {
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}
.aside-mini small {
  flex: none;
  color: var(--muted);
}
.aside-mini-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal);
}
.aside-mini.is-working .aside-mini-dot {
  animation: aside-pulse 1.4s ease-in-out infinite;
}
@keyframes aside-pulse {
  50% {
    opacity: 0.3;
  }
}
@media (prefers-reduced-motion: reduce) {
  .btw-sheet {
    transition: none;
  }
  .aside-mini.is-working .aside-mini-dot {
    animation: none;
  }
}

/* ---------- el emulador de la app de SaveMoney (emu.js) ---------- */
/* El ícono del celular en la cabecera: un punto verde agua cuando su emulador está corriendo. */
.emu-btn {
  position: relative;
  color: var(--muted);
}
.emu-btn.is-on,
.emu-btn.is-open {
  color: var(--text);
}
.emu-dot {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px var(--bg);
  display: none;
}
.emu-btn.is-on .emu-dot {
  display: block;
}
.emu-btn.is-busy .emu-dot {
  animation: emu-blink 1s ease-in-out infinite;
}
@keyframes emu-blink {
  50% {
    opacity: 0.25;
  }
}
/* En la compu: una columna más a la derecha de la conversa. */
body.has-emu .desk {
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--emu-w, 440px);
}
body.has-emu.has-aside .desk {
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--aside-w, 480px) var(--emu-w, 440px);
}
@media (min-width: 1180px) {
  body.has-emu .desk .pane .view.chat.has-todos,
  body.has-web .desk .pane .view.chat.has-todos {
    padding-right: 0;
  }
  body.has-emu .desk .pane .view.chat.has-todos .todo-panel,
  body.has-emu .desk .pane .view.chat.has-todos .todo-resizer,
  body.has-web .desk .pane .view.chat.has-todos .todo-panel,
  body.has-web .desk .pane .view.chat.has-todos .todo-resizer {
    display: none;
  }
  /* Con el emulador o el navegador al lado no hay ancho para la lista: queda el anillo de la cabecera. */
  body.has-emu .desk .pane .view.chat.has-todos .todo-pill,
  body.has-web .desk .pane .view.chat.has-todos .todo-pill {
    display: inline-flex;
  }
}
.emu-pane,
.emu-sheet {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #050407;
}
.emu-pane {
  position: relative;
  border-left: 1px solid var(--line);
  animation: fade-in 0.22s var(--ease-out) both;
}
/* En el celu: una hoja a pantalla completa que sube desde abajo. */
.emu-sheet {
  position: fixed;
  inset: 0;
  z-index: var(--z-sheet);
  padding: var(--safe-t) 0 var(--safe-b);
  transform: translateY(100%);
  transition: transform 0.32s var(--ease-out);
}
.emu-sheet.open {
  transform: none;
}
.emu-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 4px 16px;
}
.emu-head .icon-btn {
  width: 38px;
  height: 38px;
  color: var(--muted);
}
.emu-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.emu-title b {
  font-size: 14px;
}
.emu-info {
  font: 11.5px var(--mono);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emu-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 2px 12px 8px;
}
.emu-seg {
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.emu-seg button {
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.emu-seg button.on {
  background: var(--surface-2);
  color: var(--text);
}
.emu-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.emu-wt {
  max-width: 220px;
  padding: 5px 8px;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
}
.emu-screen {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  overflow: hidden;
}
.emu-canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  background: #fff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  box-shadow: 0 0 0 1px var(--line-2), 0 18px 40px rgba(0, 0, 0, 0.5);
}
.emu-pane[data-format='desktop'] .emu-canvas,
.emu-sheet[data-format='desktop'] .emu-canvas {
  border-radius: 6px;
}
.emu-pane:not(.has-frame) .emu-canvas,
.emu-sheet:not(.has-frame) .emu-canvas,
.is-off .emu-canvas {
  visibility: hidden;
}
.emu-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: rgba(5, 4, 7, 0.55);
}
.emu-status[hidden] {
  display: none;
}
.emu-status p {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}
.emu-status .is-error {
  color: var(--red);
}
.emu-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}
.emu-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 4px 14px 8px;
  font-size: 12.5px;
}
.emu-ctl {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.emu-who {
  color: var(--faint);
}
.emu-who.is-martin {
  color: var(--teal);
  font-weight: 600;
}
.emu-release,
.emu-kbd-btn {
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  font-size: 12.5px;
}
.emu-hint {
  color: var(--sky);
}
/* El input que recibe el teclado: invisible pero enfocable (16 px: así el iPhone no hace zoom). */
.emu-kbd {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  font-size: 16px;
  border: 0;
  padding: 0;
  caret-color: transparent;
  pointer-events: none;
}
.emu-kbd-btn[hidden] {
  display: none;
}
/* En el celu la barra va en una sola línea: el formato es sólo su ícono. */
.emu-sheet .emu-bar {
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.emu-sheet .emu-chip span {
  display: none;
}
.emu-sheet .emu-seg button {
  padding: 5px 9px;
}
.emu-btn[hidden] {
  display: none;
}

/* El WhatsApp de soporte (wa.js): el mismo panel que el emulador, con la página del tamaño de su pantalla. */
.wa-screen {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.wa-panel .wa-canvas {
  position: absolute;
  inset: 0;
  max-width: none;
  max-height: none;
  border-radius: 0;
  box-shadow: none;
  background: #f7f5f3;
}
.wa-panel .emu-head {
  padding-left: 12px;
}
.wa-panel .wa-back {
  margin-left: -6px;
  color: var(--text);
}
.wa-back[hidden] {
  display: none;
}
/* Qué sesión tiene tomado el WhatsApp y quién espera en fila. */
.wa-turn {
  padding: 6px 16px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}
.wa-turn[hidden] {
  display: none;
}
.wa-turn p {
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wa-turn b {
  color: var(--text);
  font-weight: 600;
}
.wa-turn-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--teal);
  vertical-align: 1px;
}
.wa-turn-line {
  margin-top: 2px !important;
}
.wa-btn[aria-pressed='true'] {
  color: var(--teal);
}

/* El navegador de wali (web.js): una herramienta aparte del WhatsApp. En la compu, su propia columna (la última);
   en el celu, una hoja que se apila sobre lo que haya. Dos vistas: la grilla de pestañas y una pestaña en vivo. */
body.has-web .desk {
  --web-w: min(50vw, 900px);
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--web-w);
}
body.has-web.has-emu .desk {
  --web-w: min(36vw, 640px);
  --emu-w: min(30vw, 520px);
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--emu-w) var(--web-w);
}
body.has-web.has-aside .desk {
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--aside-w, 480px) var(--web-w);
}
body.has-web.has-emu.has-aside .desk {
  grid-template-columns: var(--side-w, 340px) minmax(0, 1fr) var(--aside-w, 480px) var(--emu-w) var(--web-w);
}
.web-panel.emu-pane {
  order: 10;
}
.web-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.web-panel[data-mode='grid'] .web-tab-view,
.web-panel[data-mode='tab'] .web-grid-view {
  display: none;
}
.web-btn {
  position: relative;
}
.web-btn[aria-pressed='true'] {
  color: var(--sky);
}
.web-count {
  position: absolute;
  top: -2px;
  right: -4px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  color: var(--text);
  font: 700 9px/12px var(--font);
  text-align: center;
  pointer-events: none;
}
.web-count[hidden] {
  display: none;
}
/* Alguna sesión está navegando: el número se pone verde y late. */
.web-btn.is-working .web-count {
  background: var(--teal);
  border-color: var(--teal);
  color: #04221c;
  animation: web-beat 1.6s ease-in-out infinite;
}
@keyframes web-beat {
  50% {
    box-shadow: 0 0 0 4px rgba(92, 225, 198, 0.25);
  }
}
.web-head {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 6px 6px 6px;
}
.web-head .emu-title {
  padding-left: 4px;
}
.web-head .icon-btn,
.web-bar .icon-btn {
  flex: none;
  width: 38px;
  height: 38px;
  color: var(--muted);
}
.web-bar .icon-btn:disabled,
.web-new:disabled {
  opacity: 0.3;
}

/* La grilla de pestañas. */
.web-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  align-content: start;
  gap: 12px;
  padding: 6px 14px 20px;
}
.web-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s var(--ease-out);
}
.web-card:active {
  transform: scale(0.98);
}
.web-card.is-working {
  border-color: rgba(92, 225, 198, 0.55);
  box-shadow: 0 0 0 1px rgba(92, 225, 198, 0.2), 0 8px 24px rgba(92, 225, 198, 0.08);
}
.web-thumb {
  position: relative;
  max-height: 300px;
  background: #fff;
  overflow: hidden;
}
.web-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.web-thumb-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--bg-2);
}
.web-thumb-empty .web-fav {
  width: 28px;
  height: 28px;
}
.web-live {
  position: absolute;
  left: 7px;
  top: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 7px;
  border-radius: 999px;
  background: rgba(4, 34, 28, 0.86);
  color: var(--teal);
  font-size: 10.5px;
  font-weight: 700;
}
.web-live i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  animation: web-pulse 1s ease-in-out infinite alternate;
}
.web-live.is-inline {
  position: static;
  padding: 1px 7px 1px 6px;
  background: rgba(92, 225, 198, 0.12);
}
@keyframes web-pulse {
  to {
    opacity: 0.3;
  }
}
.web-card-x {
  position: absolute;
  right: 6px;
  top: 6px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 8, 14, 0.72);
  color: #fff;
}
.web-card-foot {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px 10px;
}
.web-card-title {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}
.web-card-title > span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.web-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.web-host {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font: 10.5px var(--mono);
  color: var(--faint);
}
.web-fav {
  flex: none;
  width: 15px;
  height: 15px;
  border-radius: 3px;
  display: grid;
  place-items: center;
  color: var(--faint);
}
/* De qué sesión es (o «Tuya» si la abrió Martín). */
.web-owner {
  flex: none;
  max-width: 110px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(143, 125, 255, 0.16);
  color: var(--violet);
  font-size: 10.5px;
  font-weight: 600;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.web-owner[onclick],
.web-card .web-owner:not(.is-mine) {
  cursor: pointer;
}
/* La de la conversa abierta resalta en la vista de todas. */
.web-owner.is-here {
  background: rgba(92, 225, 198, 0.16);
  color: var(--teal);
}
.web-owner.is-mine {
  background: var(--surface-2);
  color: var(--muted);
}
.web-empty {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 60px 24px;
  text-align: center;
  color: var(--muted);
}
.web-empty p {
  margin: 0;
}
.web-empty .muted {
  font-size: 13px;
  color: var(--faint);
}

/* Una pestaña en vivo. */
.web-to-grid {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 1px;
  height: 34px;
  padding: 0 9px 0 4px;
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}
.web-tab-title b {
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.web-tab-info {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 2px;
}
.web-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px 8px;
}
.web-url {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.15s;
}
.web-url:focus-within {
  border-color: var(--sky);
  background: var(--surface-2);
}
.web-lock {
  flex: none;
  display: grid;
  color: var(--faint);
}
.web-lock.is-insecure {
  color: var(--red);
}
.web-url-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--text);
  font: 16px var(--font); /* 16 px: el iPhone no hace zoom */
  outline: none;
  text-overflow: ellipsis;
}
.web-url-input::placeholder {
  color: var(--faint);
}
/* Escribiendo una dirección: los botones de al lado se esconden y la barra toma el ancho. */
.web-panel.is-typing .web-bar > .icon-btn,
.web-panel.is-typing .web-bar > .emu-kbd-btn {
  display: none;
}
.web-bar .emu-kbd-btn {
  flex: none;
  margin-left: 4px;
  padding: 6px 10px;
}
.web-panel .web-canvas {
  background: #fff;
}
.web-panel:not(.has-frame) .web-canvas {
  visibility: hidden;
}
.web-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  z-index: 2;
}
.web-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--sky);
  animation: web-load 1.1s var(--ease-io) infinite;
}
.web-progress[hidden] {
  display: none;
}
@keyframes web-load {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(250%);
  }
}
.web-toast {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: calc(12px + var(--safe-b));
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(16, 13, 23, 0.92);
  border: 1px solid var(--line-2);
  color: var(--text);
  font-size: 13px;
  z-index: 3;
}
.web-toast[hidden] {
  display: none;
}

/* El modelo y el esfuerzo de la conversa: chip bajo el título, selector (hoja en el celu, globo en la
   compu) y la raya en el historial donde cambiaron. */
.engine-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px 1px 6px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 500 10.5px/1.5 var(--mono);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.engine-chip[hidden] {
  display: none;
}
.engine-chip svg {
  flex: none;
  color: var(--violet);
}
.engine-chip:hover {
  background: var(--surface-2);
  color: var(--text);
}
.engine-chip.chosen {
  border-color: color-mix(in srgb, var(--violet) 45%, transparent);
  background: color-mix(in srgb, var(--violet) 12%, transparent);
  color: #cfc7ff;
}
.engine-chip.flash {
  animation: engine-flash 1.2s var(--ease-out);
}
@keyframes engine-flash {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--violet) 70%, transparent);
    background: color-mix(in srgb, var(--violet) 35%, transparent);
  }
  100% {
    box-shadow: 0 0 0 8px transparent;
  }
}
.engine-effort-txt {
  color: var(--faint);
}
.engine-chip.chosen .engine-effort-txt {
  color: inherit;
  opacity: 0.75;
}
body:not(.desk-mode) .engine-effort-txt {
  display: none;
}
.padre-head > .engine-chip {
  align-self: center;
}
.effort-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 1.5px;
  height: 10px;
}
.effort-bars i {
  width: 2.5px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.25;
}
.effort-bars i:nth-child(1) { height: 3px; }
.effort-bars i:nth-child(2) { height: 4.5px; }
.effort-bars i:nth-child(3) { height: 6px; }
.effort-bars i:nth-child(4) { height: 8px; }
.effort-bars i:nth-child(5) { height: 10px; }
.effort-bars i.on {
  opacity: 1;
}
.engine-chip .effort-bars i.on {
  background: var(--violet);
}

.engine-pop {
  width: 340px;
  max-height: min(760px, calc(100dvh - 24px));
  overflow-y: auto;
  padding: 4px 12px 12px;
  border-radius: 14px;
  transform-origin: top center;
}
.engine-pick .label {
  display: block;
  margin: 14px 2px 6px;
  font: 600 11px var(--font);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}
.engine-sheet .engine-pick .label {
  margin-top: 20px;
}
.engine-models {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.engine-model {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.engine-model:hover:not(:disabled) {
  background: var(--surface);
}
.engine-model.on {
  border-color: color-mix(in srgb, var(--violet) 40%, transparent);
  background: color-mix(in srgb, var(--violet) 12%, transparent);
}
.engine-model.on svg {
  color: var(--violet);
}
.engine-model:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.engine-model-txt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.engine-model-txt b {
  font: 600 14px var(--font);
}
.engine-model-txt small {
  font-size: 12px;
  color: var(--faint);
}
.engine-sheet .engine-model {
  padding: 12px;
}
.engine-sheet .engine-model-txt b {
  font-size: 16px;
}
.engine-sheet .engine-model-txt small {
  font-size: 13px;
}
.engine-more,
.engine-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  font: 500 12.5px var(--font);
  cursor: pointer;
}
.engine-more:hover,
.engine-reset:hover {
  background: var(--surface);
  color: var(--text);
}
.engine-efforts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface);
}
.engine-efforts button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 8px 2px 7px;
  border: none;
  border-radius: 9px;
  background: none;
  color: var(--muted);
  font: 500 11.5px var(--font);
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.engine-efforts button:hover {
  color: var(--text);
}
.engine-efforts button.on {
  background: color-mix(in srgb, var(--violet) 26%, transparent);
  color: var(--text);
}
.engine-efforts button.on .effort-bars i.on {
  background: var(--violet);
}
.engine-sheet .engine-efforts button {
  padding: 11px 2px 10px;
  font-size: 12.5px;
}
.engine-foot {
  margin: 10px 2px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--faint);
}

.engine-note {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  animation: engine-note-in 0.5s var(--ease-out);
}
.engine-note.still {
  animation: none;
}
.engine-note::before,
.engine-note::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--violet) 45%, transparent));
}
.engine-note::after {
  background: linear-gradient(270deg, transparent, color-mix(in srgb, var(--violet) 45%, transparent));
}
.engine-note-pill {
  flex: none;
  max-width: 80%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 13px;
  border: 1px solid color-mix(in srgb, var(--violet) 35%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--violet) 10%, transparent);
  text-align: center;
}
.engine-note-now {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: #cfc7ff;
}
.engine-note-now svg {
  color: var(--violet);
}
.engine-note-now b {
  font-weight: 600;
  color: var(--text);
}
.engine-note-pill small {
  font-size: 11px;
  color: var(--faint);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--faint) 50%, transparent);
}
@keyframes engine-note-in {
  from {
    opacity: 0;
    transform: scaleX(0.6);
  }
}

/* El modelo y el esfuerzo de un subagente, en su tarjeta. */
.agent-engine {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-right: 6px;
  padding: 0 6px 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font: 500 10px/1.6 var(--mono);
  color: var(--muted);
  vertical-align: 1px;
}
.agent-engine[hidden] {
  display: none;
}
.agent-engine svg {
  color: var(--violet);
}
.agent-engine .effort-bars {
  height: 8px;
}
.agent-engine .effort-bars i.on {
  background: var(--violet);
}
.agent-engine .effort-bars i:nth-child(5) { height: 8px; }
.agent-engine .effort-bars i:nth-child(4) { height: 6.5px; }
.agent-engine .effort-bars i:nth-child(3) { height: 5px; }
.agent-engine .effort-bars i:nth-child(2) { height: 3.5px; }
.agent-engine .effort-bars i:nth-child(1) { height: 2px; }

/* La raya de un caso nuevo de soporte: como la del modelo, en amarillo. */
.case-note::before {
  background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.5));
}
.case-note::after {
  background: linear-gradient(270deg, transparent, rgba(251, 191, 36, 0.5));
}
.case-note .engine-note-pill {
  border-color: rgba(251, 191, 36, 0.4);
}
.case-note .engine-note-now {
  color: #fde68a;
}
.case-note .engine-note-now svg {
  color: #fbbf24;
}

/* La conversa se programó desde los botones: raya azul con cuándo y para cuándo. */
.planned-note::before {
  background: linear-gradient(90deg, transparent, rgba(60, 123, 255, 0.6));
}
.planned-note::after {
  background: linear-gradient(270deg, transparent, rgba(60, 123, 255, 0.6));
}
.planned-note .engine-note-pill {
  border-color: rgba(60, 123, 255, 0.45);
  background: rgba(60, 123, 255, 0.1);
}
.planned-note .engine-note-now {
  color: #c7d8ff;
}
.planned-note .engine-note-now svg {
  color: var(--blue);
}

/* La conversa se archivó: raya morada con la hora. */
.closed-note::before {
  background: linear-gradient(90deg, transparent, rgba(143, 125, 255, 0.6));
}
.closed-note::after {
  background: linear-gradient(270deg, transparent, rgba(143, 125, 255, 0.6));
}
.closed-note .engine-note-pill {
  border-color: rgba(143, 125, 255, 0.45);
  background: rgba(143, 125, 255, 0.1);
}
.closed-note .engine-note-now {
  color: #d4ccff;
  white-space: nowrap;
}
.closed-note .engine-note-now svg {
  color: var(--violet);
}

/* Las opciones de respuesta bajo el último mensaje de Claude: la primera (recomendada) en azul con su
   confianza; las irreversibles llevan un candado. */
.replies {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  padding: 4px 16px 14px;
  animation: sug-in 0.3s var(--ease-out);
}
.replies[hidden] {
  display: none;
}
.reply {
  display: block;
  max-width: 88%;
  padding: 9px 14px;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.35;
  text-align: left;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
  transition: transform 0.12s var(--ease-out), background 0.12s;
}
.reply * {
  -webkit-user-select: none;
  user-select: none;
}
.reply:active {
  transform: scale(0.97);
  background: var(--surface-2);
}
.reply.rec {
  border-color: rgba(60, 123, 255, 0.55);
  background: rgba(60, 123, 255, 0.16);
}
.reply-conf {
  display: inline-block;
  margin-right: 6px;
  vertical-align: 1px;
  padding: 1px 7px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.reply-lock {
  display: inline-block;
  margin-right: 5px;
  vertical-align: -1px;
  color: #ffb547;
}
.reply.archive .reply-lock {
  color: var(--teal);
}
.reply.wait .reply-lock {
  color: var(--muted);
}
.reply.schedule .reply-lock,
.reply-when {
  color: var(--blue);
}
.reply-when {
  font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
  .replies {
    animation: none;
  }
}

/* El ▶︎ bajo la última respuesta de Claude: chico y tenue, se enciende mientras lee. */
.msg.claude > .msg-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}
.msg-foot > .msg-time {
  float: none;
  top: 0;
  margin: 0;
}
.msg.claude .msg-foot > .msg-speak {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin: 0 0 0 -6px;
  border-radius: 50%;
  color: var(--muted);
  transition: color 0.15s, background 0.15s;
}
.msg-speak:active {
  transform: scale(0.9);
}
.msg-speak[data-state='playing'] {
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 14%, transparent);
}
/* Generando el audio (Gemini tarda de 3 a 10 s en soltar el primer pedazo): un anillo que gira alrededor del ■,
   para que se note que viene y no parezca que el botón no hizo nada. */
.msg-speak[data-state='loading'] {
  position: relative;
  color: var(--blue);
}
.msg-speak[data-state='loading']::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--blue) 22%, transparent);
  border-top-color: var(--blue);
  animation: spin 0.8s linear infinite;
}

/* Deslizar desde el borde izquierdo para volver a la lista (edgeSwipeBack). */
.view.is-swiping {
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.25);
  will-change: transform;
}
.view.swipe-settle {
  transition: transform 0.26s var(--ease-out);
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.25);
}

/* ---------- los commits de todos los repos (commits.js) ---------- */
.commits-btn {
  position: relative;
}
.commits-btn[aria-pressed='true'] {
  color: var(--sky);
}
.commits-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--teal);
  pointer-events: none;
}
.commits-dot[hidden] {
  display: none;
}
/* En la compu: un cajón fijo a la derecha, encima de lo demás. */
.commits-panel.is-desk {
  left: auto;
  width: min(460px, 100vw);
  padding: 0;
  border-left: 1px solid var(--line-2);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(100%);
}
.commits-panel.is-desk.open {
  transform: none;
}
.commits-panel .icon-btn.is-spinning svg {
  animation: commits-spin 0.9s linear infinite;
}
@keyframes commits-spin {
  to {
    transform: rotate(360deg);
  }
}
.commits-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 2px 12px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  /* Sin esto, en el WebView del iPhone el dedo no desliza la fila. */
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: none;
}
.commits-chips::-webkit-scrollbar {
  display: none;
}
.commits-chips-sep {
  flex: none;
  width: 1px;
  height: 18px;
  background: var(--line-2);
}
.commits-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 13px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  font: 600 12px var(--font);
  white-space: nowrap;
  touch-action: pan-x;
}
.commits-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}
.commits-chip[aria-pressed='true'] {
  background: var(--text);
  border-color: var(--text);
  color: #111;
}
/* El menú de repos: casillas, uno por fila, flotando bajo su botón. */
.commits-drop svg {
  margin-right: -3px;
  opacity: 0.7;
}
.commits-menu {
  position: absolute;
  z-index: 5;
  width: 240px;
  max-height: min(420px, 60vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #16131c;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55);
}
.commits-menu hr {
  margin: 4px 6px;
  border: 0;
  border-top: 1px solid var(--line);
}
.commits-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 8px;
  border-radius: 8px;
  color: var(--text);
  font: 500 14px var(--font);
  cursor: pointer;
}
@media (hover: hover) {
  .commits-opt:hover {
    background: var(--surface-2);
  }
}
.commits-opt input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--sky);
}
.commits-opt i {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
.commits-opt span {
  flex: 1;
  min-width: 0;
}
.commits-opt small {
  color: var(--faint);
  font-size: 12px;
}
.commits-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 0 calc(16px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.commits-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
}
/* El día como en Slack: una raya de lado a lado con la fecha en una píldora al centro. La raya es de la
   sección y se queda en su lugar; sólo la píldora se pega arriba mientras se ven los commits de ese día. */
.commits-sec {
  position: relative;
}
.commits-sec::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 26px;
  border-top: 1px solid var(--line);
}
.commits-day {
  position: sticky;
  top: 6px;
  z-index: 2;
  display: flex;
  justify-content: center;
  margin: 14px 0 6px;
  pointer-events: none;
}
.commits-day span {
  position: relative;
  padding: 3px 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: #0d0b11;
  color: var(--text);
  font: 700 12px var(--font);
}
.commits-day span::first-letter {
  text-transform: uppercase;
}
/* Un mensaje: foto a la izquierda y el cuerpo al lado, como el bot de GitHub en el canal. */
.commits-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  column-gap: 10px;
  padding: 8px 14px 6px;
  color: var(--text);
}
.commits-row.is-cont {
  padding-top: 2px;
}
@media (hover: hover) {
  .commits-row:hover {
    background: rgba(255, 255, 255, 0.03);
  }
  .commits-row:hover .commits-hover-time {
    visibility: visible;
  }
  .commits-title:hover {
    text-decoration: underline;
    text-decoration-color: var(--line-2);
  }
}
.commits-gutter {
  padding-top: 2px;
}
.commits-ava {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 20px;
  object-fit: cover;
}
.commits-hover-time {
  display: block;
  visibility: hidden;
  padding-top: 3px;
  color: var(--faint);
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}
.commits-head {
  display: flex;
  align-items: baseline;
  gap: 6px;
  line-height: 1.3;
}
.commits-head b {
  font: 800 15px var(--font);
}
.commits-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.commits-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  margin-top: 1px;
  font-size: 15px;
  line-height: 1.45;
}
.commits-top b {
  font-weight: 800;
}
.commits-repo-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--repo);
}
.commits-tail {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.commits-sep {
  color: var(--muted);
}
.commits-br {
  padding: 0 4px;
  border: 1px solid var(--line-2);
  border-radius: 4px;
  background: var(--surface-2);
  color: #e8912d;
  font: 13px var(--mono);
  white-space: nowrap;
}
.commits-br.is-staging {
  border-color: rgba(255, 181, 71, 0.35);
  background: rgba(255, 181, 71, 0.12);
  color: #ffb547;
}
.commits-br.is-staging.is-in {
  border-color: rgba(92, 225, 198, 0.35);
  background: rgba(92, 225, 198, 0.1);
  color: var(--teal);
}
.commits-n,
.commits-pr {
  color: var(--sky);
  text-decoration: none;
  white-space: nowrap;
}
.commits-lines {
  margin: 1px 0 0;
  padding: 0 0 0 18px;
  list-style: disc;
}
.commits-lines li {
  padding-left: 2px;
  font-size: 15px;
  line-height: 1.45;
}
.commits-lines li::marker {
  color: var(--text);
}
.commits-title {
  color: var(--text);
  text-decoration: none;
  -webkit-touch-callout: none;
  overflow-wrap: anywhere;
}
.commits-title:active {
  opacity: 0.6;
}
/* El CI como una reacción de Slack, debajo del mensaje. */
.commits-reacts {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.commits-ci {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1;
}
.commits-ci small {
  color: var(--muted);
  font: 600 12px var(--font);
}
.commits-ci.is-fail {
  border-color: rgba(255, 77, 94, 0.45);
  background: rgba(255, 77, 94, 0.1);
  color: var(--red);
  font-weight: 800;
}
.commits-ci.is-run {
  color: #ffb547;
  animation: web-beat 1.6s ease-in-out infinite;
}

/* /autoN: lo que se aceptó solo va en ámbar con un rayo (el mensaje, la raya de archivar o programar),
   el chip del modo prendido sobre el cuadro y, en la lista, un círculo con las que todavía no viste. */
.msg.user.is-auto {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.1));
  border: 1px dashed rgba(245, 158, 11, 0.6);
}
.auto-label {
  color: #fbbf24;
}
.engine-note.is-auto::before {
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.6));
}
.engine-note.is-auto::after {
  background: linear-gradient(270deg, transparent, rgba(245, 158, 11, 0.6));
}
.engine-note.is-auto .engine-note-pill {
  border-color: rgba(245, 158, 11, 0.5);
  background: rgba(245, 158, 11, 0.1);
}
.engine-note.is-auto .engine-note-now {
  color: #fde3a7;
}
.engine-note.is-auto .engine-note-now svg {
  color: #fbbf24;
}
.auto-chip {
  color: #fde3a7;
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
}
.auto-row + .btw-row {
  padding-top: 4px;
}
.auto-badge {
  flex: none;
  align-self: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-right: 6px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1a1206;
  background: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.55);
}
.auto-badge[hidden] {
  display: none;
}

/* /autoN prendido en la lista: wali en piloto automático, con los ojos ámbar y el rayo con el número
   en la esquina de arriba (las insignias de rama van abajo). Dormida o archivada manda su propia cara. */
.conv.is-auto:not(.is-asleep):not(.is-archived) .ai-eyes i {
  background: #fbbf24;
  box-shadow:
    0 0 6px rgba(251, 191, 36, 0.9),
    0 0 2px #fde68a;
}
.avatar-auto {
  position: absolute;
  z-index: 2;
  top: -6px;
  right: -9px;
  display: flex;
  align-items: center;
  gap: 1px;
  height: 15px;
  padding: 0 4px 0 2px;
  border-radius: 8px;
  background: #1c1206;
  border: 1px solid rgba(251, 191, 36, 0.75);
  color: #fbbf24;
  font: 700 9.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.45);
  animation: auto-zap 2.4s ease-in-out infinite;
}
.avatar-auto svg {
  fill: currentColor;
}
.avatar-auto[hidden],
.is-archived .avatar-auto {
  display: none;
}
@keyframes auto-zap {
  0%,
  100% {
    box-shadow: 0 0 4px rgba(245, 158, 11, 0.35);
  }
  50% {
    box-shadow: 0 0 9px rgba(245, 158, 11, 0.8);
  }
}

/* El modo fast: en el chip, el rayo en ámbar; en el selector, un interruptor. */
.engine-chip.fast > svg:first-child {
  color: #fbbf24;
}
.engine-fast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.engine-fast > svg {
  flex: none;
  color: var(--faint);
}
.engine-fast.on {
  border-color: color-mix(in srgb, #fbbf24 45%, transparent);
  background: color-mix(in srgb, #fbbf24 10%, transparent);
}
.engine-fast.on > svg {
  color: #fbbf24;
}
.engine-switch {
  flex: none;
  position: relative;
  width: 36px;
  height: 21px;
  border-radius: 999px;
  background: var(--line-2);
  transition: background 0.15s;
}
.engine-switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s var(--ease-out);
}
.engine-fast.on .engine-switch {
  background: #fbbf24;
}
.engine-fast.on .engine-switch::after {
  transform: translateX(15px);
}
.engine-sheet .engine-fast {
  padding: 12px;
}
.new-engine {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.welcome-engine {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--faint);
}
.welcome-engine .engine-chip {
  font-size: 11.5px;
  padding: 2px 10px 2px 8px;
}

/* ---------- carpetas de la lista ---------- */
.section-label.with-add {
  justify-content: flex-start;
  align-items: center;
  gap: 6px;
}
.section-label.with-add .hint {
  margin-left: auto;
}
.folder-add {
  width: 28px;
  height: 28px;
  margin: -6px -6px -6px 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.folder-add[hidden] {
  display: none;
}
.folder-add:hover,
.folder-add:active {
  color: var(--text);
  background: var(--surface-2);
}
.folder-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin: 14px 0 8px;
  padding: 0 6px 0 8px;
  border-radius: 14px;
  color: var(--muted);
  font: 600 15px var(--font);
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}
.folder-head:first-of-type,
.section-label + .folder-head,
.filters + .folder-head {
  margin-top: 4px;
}
.folder-head:active {
  background: var(--surface);
}
.folder-head:focus-visible {
  outline: 2px solid var(--sky);
  outline-offset: -2px;
}
.folder-head.is-open,
.folder-head.has-active {
  color: var(--text);
}
.folder-chev {
  display: grid;
  place-items: center;
  width: 16px;
  color: var(--faint);
  transition: transform 0.2s var(--ease-out);
}
.folder-head.is-open .folder-chev {
  transform: rotate(90deg);
}
.folder-ico {
  display: grid;
  place-items: center;
  color: var(--sky);
}
.folder-head.is-loose .folder-ico {
  color: var(--faint);
}
.folder-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--sky);
  background: var(--bg-2);
  color: var(--text);
  font: inherit;
  outline: none;
}
.folder-live {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: 500 12px var(--font);
  color: var(--sky);
}
.folder-live:empty {
  display: none;
}
.folder-live::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sky);
  animation: rec-blink 1.4s ease-in-out infinite;
}
.folder-n {
  flex: none;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font: 600 11.5px/1 var(--font);
  font-variant-numeric: tabular-nums;
  color: var(--faint);
  background: var(--surface);
}
.folder-n:empty {
  display: none;
}
/* Cerrada con algo sin leer: el número se prende. */
.folder-head.is-unread .folder-n {
  color: #fff;
  background: var(--blue);
}
.folder-head.has-active {
  background: var(--surface);
}
.folder-more {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--faint);
}
.folder-more:active {
  background: var(--surface-2);
  color: var(--text);
}
/* Soltando encima: la cabecera se ilumina. Recién soltada en una cerrada, destella. */
.folder-head.drop-into {
  color: var(--text);
  background: rgba(100, 175, 255, 0.14);
  box-shadow: inset 0 0 0 2px var(--sky);
}
.folder-head.flash {
  animation: folder-flash 0.9s var(--ease-out);
}
@keyframes folder-flash {
  0% {
    background: rgba(100, 175, 255, 0.3);
  }
  100% {
    background: transparent;
  }
}
.desk .folder-head {
  min-height: 32px;
  margin: 10px 0 4px;
  padding: 0 4px 0 6px;
  border-radius: 8px;
  font-size: 13px;
  gap: 6px;
}
.desk .folder-head:hover {
  background: var(--surface);
}
.desk .folder-more {
  width: 26px;
  height: 26px;
  opacity: 0;
}
.desk .folder-head:hover .folder-more,
.desk .folder-more:focus-visible {
  opacity: 1;
}
.desk .folder-more:hover {
  color: var(--text);
  background: var(--surface-2);
}
.desk .folder-n {
  height: 18px;
  font-size: 11px;
}

/* Elegidas para moverlas juntas: borde azul y un check en la esquina. */
.conv-swipe.is-picked > .conv {
  border-color: var(--sky);
  background: rgba(100, 175, 255, 0.1);
  box-shadow: inset 0 0 0 1px var(--sky);
}
.conv-swipe.is-picked::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: 50%;
  left: -6px;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  background: var(--blue) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 12px no-repeat;
  box-shadow: 0 0 0 2px var(--bg);
  pointer-events: none;
}
/* Eligiendo en el celu: las no elegidas muestran un círculo vacío donde iría el check. */
.home:not(.side-home) .list.is-picking .conv-swipe:not(.is-picked) > .conv[data-id]::before {
  content: '';
  position: absolute;
  z-index: 2;
  top: 50%;
  left: -6px;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  border-radius: 50%;
  border: 2px solid var(--line-2);
  background: var(--bg);
  box-sizing: border-box;
}
.desk .conv-swipe.is-picked::before {
  left: -4px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  background-size: 10px;
}

/* La barra de las elegidas: abajo de la lista en la compu; flotando abajo en el celu, en vez del botón de nueva conversa. */
.pick-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.pick-bar[hidden] {
  display: none;
}
.pick-n {
  flex: 1;
  min-width: 0;
  font: 600 13px var(--font);
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-x {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.pick-x:hover,
.pick-x:active {
  color: var(--text);
  background: var(--surface-2);
}
.pick-move {
  flex: none;
  height: 32px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  font: 600 13px var(--font);
  color: #fff;
  background: var(--blue);
}
.pick-move:disabled {
  opacity: 0.4;
}
.pick-move:active {
  transform: scale(0.96);
}
.home:not(.side-home) .pick-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(var(--safe-b) + 18px);
  z-index: var(--z-fab);
  padding: 10px 10px 10px 8px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: rgba(22, 18, 31, 0.92);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, 0.8);
  animation: fab-in 0.4s var(--spring) backwards;
}
.home:not(.side-home) .pick-n {
  font-size: 15px;
}
.home:not(.side-home) .pick-x {
  width: 40px;
  height: 40px;
}
.home:not(.side-home) .pick-move {
  height: 42px;
  padding: 0 18px;
  font-size: 15px;
}
.home.is-picking .fab {
  display: none;
}

/* Mover a carpeta, en el celu. */
.folder-pick {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.folder-pick-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: 500 16px var(--font);
  text-align: left;
}
.folder-pick-btn svg {
  flex: none;
  color: var(--sky);
}
.folder-pick-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-pick-btn.is-now {
  border-color: var(--sky);
  background: rgba(100, 175, 255, 0.1);
}
.folder-pick-btn:active {
  background: var(--surface-2);
}
.folder-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.folder-row > :only-child {
  grid-column: 1 / -1;
}
.folder-row .branch-btn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Nueva conversa en el celu: escribir o llamar (el audio se manda desde el chat). */
.sheet-actions.new-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sheet-actions.new-actions .btn {
  min-width: 0;
  padding-left: 8px;
  padding-right: 8px;
  gap: 8px;
}
.folder-row .branch-btn {
  padding-left: 10px;
  padding-right: 10px;
  font-size: 15px;
}
.folder-row .branch-btn svg {
  flex: none;
  width: 18px;
  height: 18px;
}

/* El 🌐 de la cabecera de cada conversa: sus pestañas; sólo se ve si tiene alguna. */
.web-conv-btn[hidden] {
  display: none !important;
}
.web-conv-btn.is-working svg {
  animation: conv-web-spin 2.4s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .web-conv-btn.is-working svg {
    animation: none;
  }
}
/* Con el panel mirando una sesión: pasar a ver las de todas. */
.web-all {
  flex: none;
  margin-left: auto;
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font: 600 11.5px/1 var(--font);
  cursor: pointer;
}
.web-all:hover {
  color: var(--text);
}
.web-all[hidden] {
  display: none;
}

/* El detalle del contexto activo (arriba de los tokens en el tiempo). */
.ctxd-h {
  margin: 14px 0 6px;
  font: 600 12px/1 var(--mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--faint);
}
.ctxd {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}
.ctxd-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
}
.ctxd-bar i {
  display: block;
  flex: none;
  min-width: 1px;
}
.ctxd-sub {
  margin: 4px 0 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.ctxd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}
.ctxd-list li {
  display: grid;
  grid-template-columns: 9px 1fr auto 3.6em;
  align-items: center;
  gap: 8px;
}
.ctxd-list li > i {
  width: 9px;
  height: 9px;
  border-radius: 3px;
}
.ctxd-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ctxd-tok,
.ctxd-pct {
  font: 400 12px var(--mono);
  color: var(--muted);
  text-align: right;
}
.ctxd-pct {
  color: var(--faint);
}

/* Un aviso con botón («Ver»): el botón se puede tocar aunque la franja de avisos deje pasar los toques. */
.toast.has-action {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  pointer-events: auto;
}
.toast-action {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ice);
  font: 600 14px var(--font);
}

/* ---------- La terminal de wali-vm (term.js) ---------- */
/* En el celu ocupa sólo lo que el teclado deja visible, para que la línea en que se escribe no quede tapada. */
.term-panel {
  top: var(--vvt, 0px);
  bottom: auto;
  height: var(--vvh, 100dvh);
}
.kb-open .term-panel {
  padding-bottom: 0;
}
.term-panel.is-desk {
  top: 0;
  height: 100%;
  left: auto;
  width: min(760px, 100vw);
  padding: 0;
  border-left: 1px solid var(--line-2);
  box-shadow: -18px 0 40px rgba(0, 0, 0, 0.45);
  transform: translateX(100%);
}
.term-panel.is-desk.open {
  transform: none;
}
.term-panel .web-head {
  gap: 2px;
}
.term-panel .web-head .icon-btn {
  width: 34px;
}
.term-panel .term-font {
  font: 600 12.5px var(--mono);
}
.term-panel .web-head .term-paste {
  width: auto;
  padding: 0 8px;
  font-family: inherit;
}
.term-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  padding: 2px 4px 4px 8px;
}
.term-screen {
  width: 100%;
  height: 100%;
  touch-action: none;
}
.term-screen .xterm {
  height: 100%;
}
.term-screen .xterm-viewport {
  background: transparent !important;
}
.term-status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  background: rgba(5, 4, 7, 0.82);
  color: var(--muted);
  text-align: center;
}
.term-status[hidden] {
  display: none;
}
.term-status-btn {
  padding: 9px 18px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font: inherit;
}
/* La fila de teclas del celu: se desliza de lado si no caben. */
.term-keys {
  flex: none;
  display: flex;
  gap: 6px;
  padding: 6px 8px;
  overflow-x: auto;
  scrollbar-width: none;
  border-top: 1px solid var(--line);
  background: #0b0a0f;
  -webkit-user-select: none;
  user-select: none;
}
.term-keys::-webkit-scrollbar {
  display: none;
}
.term-key {
  flex: none;
  min-width: 42px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text, #e9e6ef);
  font: 500 14px var(--mono);
  touch-action: manipulation;
}
.term-key:active,
.term-key.on {
  background: #64afff;
  border-color: #64afff;
  color: #050407;
}

/* Se archivó o se programó sola: el aviso en la tarjeta y al pie de la conversa, con «Entendido». */
.conv-away {
  display: block;
  /* La esquina (sonido, tokens, contexto) va abajo a la derecha: que quede bajo el aviso, no encima. */
  padding-bottom: 14px;
}
.conv-away:empty {
  display: none;
}
.away-notice {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 4px 4px 9px;
  border-radius: 14px;
  font: 500 12px var(--font);
  color: var(--ice);
  background: rgba(125, 211, 252, 0.1);
  border: 1px solid rgba(125, 211, 252, 0.3);
  max-width: 100%;
}
.away-notice > span:not(.away-ok) {
  flex: 1;
  min-width: 0;
  line-height: 1.3;
}
.away-notice > svg {
  flex: none;
}
.away-ok {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 0;
  font: 600 12px var(--font);
  color: #0b1220;
  background: var(--ice);
  cursor: pointer;
}
.away-ok svg,
.banner.banner-away .away-ok svg {
  color: inherit;
}
.banner.banner-away {
  flex-wrap: wrap;
  align-items: center;
  color: var(--text);
  background: rgba(125, 211, 252, 0.08);
  border-color: rgba(125, 211, 252, 0.35);
  margin: 16px 0 4px;
}
.banner.banner-away svg {
  color: var(--ice);
  margin-top: 0;
}
.banner-away .away-text {
  flex: 1 1 160px;
  min-width: 0;
  font-weight: 500;
}
.banner-away .away-actions {
  flex: none;
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
.banner-away .away-ok {
  font-size: 14px;
  padding: 6px 12px;
}

/* La carita de la conversa en el encabezado: la misma de la lista, con su estado (trabajando, dormida,
   archivada) y, como acá no hay borde de tarjeta, un anillo verde si está lista y amarillo si espera. */
.head-face {
  flex: none;
  display: grid;
  place-items: center;
  padding: 3px;
  margin: 0 2px;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.head-face:empty {
  display: none;
}
.head-face .avatar,
.head-face .glyph {
  width: 32px;
  height: 32px;
}
.head-face .glyph {
  border-radius: 10px;
}
.desk .head-face .avatar,
.desk .head-face .glyph {
  width: 30px;
  height: 30px;
}
.head-face .avatar,
.head-face .glyph {
  transition: box-shadow 0.3s;
}
.head-face.is-done .avatar {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 3.5px #4ade80,
    0 0 14px -2px rgba(74, 222, 128, 0.6);
}
.head-face.is-waiting .avatar {
  box-shadow:
    0 0 0 2px var(--bg),
    0 0 0 3.5px #facc15,
    0 0 14px -2px rgba(250, 204, 21, 0.6);
}
.head-face:active .avatar {
  transform: scale(0.92);
}
.head-face.big .avatar,
.head-face.big .glyph {
  width: 52px;
  height: 52px;
}
.head-face.big .is-asleep .ai-eyes::after,
.head-face.big.is-asleep .ai-eyes::after {
  font-size: 14px;
}
/* En el celu, como en WhatsApp: atrás, la carita y el nombre a su lado (alineado a la izquierda). El
   contexto, los tokens y para cuándo vuelve quedan en el estado que abre la carita. */
body:not(.desk-mode) .chat-head:not(.padre-head) .chat-title {
  text-align: left;
}
body:not(.desk-mode) .chat-head:not(.padre-head) .chat-title-row,
body:not(.desk-mode) .chat-head:not(.padre-head) .chat-sub-row {
  justify-content: flex-start;
}
body:not(.desk-mode) .chat-head:not(.padre-head) > .icon-btn:first-child {
  margin-right: -6px;
}
body:not(.desk-mode) .chat-when {
  display: none;
}

/* El estado de la conversa (tocar su carita). */
.conv-state-sheet {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 4px 8px;
}
.state-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 12px;
}
.state-hero > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.state-hero b {
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.state-now {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}
.state-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
}
.state-row svg {
  color: var(--faint);
  flex: none;
}
.state-k {
  flex: 1;
  color: var(--muted);
}
.state-v {
  font-family: var(--mono);
  font-size: 13px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
button.state-row {
  cursor: pointer;
}
button.state-row .state-v::after {
  content: ' ›';
  color: var(--faint);
}
.conv-state-sheet > .btn {
  margin-top: 8px;
}

/* Ramas en el flujo del chat. En la hija: una raya donde se partió, y lo heredado atenuado arriba. */
.branch-sep {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
}
.branch-sep::before,
.branch-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: color-mix(in srgb, var(--teal) 35%, transparent);
}
.branch-sep-pill {
  flex: none;
  max-width: 88%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--muted);
  background: color-mix(in srgb, var(--teal) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 28%, transparent);
}
.branch-sep-pill svg {
  flex: none;
  color: var(--teal);
}
.branch-sep-t {
  min-width: 0;
}
.branch-sep-t a {
  color: var(--teal);
  text-decoration: none;
  font-weight: 600;
}
.branch-sep-t a:hover {
  text-decoration: underline;
}
.inherited {
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0.6;
}
.inherited[hidden] {
  display: none;
}
.inherited-fold {
  align-self: stretch;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.inherited-fold:hover {
  background: var(--surface-2);
}
.inherited-fold svg {
  transition: transform 0.2s var(--ease-out);
}
.inherited-fold[aria-expanded='true'] svg {
  transform: rotate(90deg);
}
/* En la madre: de acá salió una rama. */
.kid-mark {
  align-self: center;
  max-width: 92%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 18px;
  text-align: left;
  border: 1px solid color-mix(in srgb, var(--teal) 28%, transparent);
  background: color-mix(in srgb, var(--teal) 7%, transparent);
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.kid-mark:hover {
  background: color-mix(in srgb, var(--teal) 14%, transparent);
}
.kid-mark svg {
  flex: none;
  color: var(--teal);
}
.kid-mark-t {
  min-width: 0;
  overflow-wrap: anywhere;
}
.kid-mark-t b {
  font-weight: 600;
  color: var(--text);
}
.kid-mark .st {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--faint);
}
.kid-mark.st-run .st {
  background: hsl(var(--h) 95% 68%);
  animation: sess-ping 1.8s var(--ease-out) infinite;
}
.kid-mark.st-queue .st {
  background: transparent;
  border: 1.5px solid var(--sky);
}
.kid-mark.st-wait .st {
  background: #ffc861;
  opacity: 0.6;
}
.kid-mark.st-done .st {
  background: var(--teal);
}
