/* ============================================================
   Growly Cowork - piloto
   Dark-first. Tokens del design system de Growly.
   ============================================================ */

:root {
  color-scheme: dark;

  /* Superficies */
  --bg: #121018;
  --surface: #1B1926;
  --elev: #211E30;
  --border: #322E45;
  --border-soft: #292539;

  /* Texto */
  --text: #F2F0FA;
  --muted: #A7A3BF;

  /* Marca */
  --brand: #39008D;
  --brand-hover: #4E08B5;
  --tint: #BBA0E3;          /* indigo legible sobre fondo oscuro */
  --tint-dim: rgba(187, 160, 227, 0.14);

  /* Señal de calor / urgencia */
  --heat: #FF6B2C;
  --on-heat: #17152B;
  --heat-dim: rgba(255, 107, 44, 0.12);

  --focus: #BBA0E3;

  --r-card: 12px;
  --r-btn: 8px;

  --sidebar-w: 276px;
  --measure: 780px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* El atributo hidden debe ganarle a cualquier display de clase. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.icon { flex: none; display: block; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 100;
  background: var(--brand);
  color: #FFFFFF;
  padding: 10px 14px;
  border-radius: var(--r-btn);
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

/* ---------------- Botones ---------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--r-btn);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.btn-primary {
  background: var(--brand);
  color: #FFFFFF;
  border-color: var(--brand);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }

.btn-secondary {
  background: var(--elev);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) { background: #2A2640; border-color: #3E3958; }

.btn-ghost { color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--elev); color: var(--text); }

.btn-icon {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-sm { min-height: 40px; font-size: 13px; padding: 0 10px; }

/* ---------------- Estructura ---------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

/* ---------------- Barra lateral ---------------- */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--brand), var(--brand-hover));
  display: grid;
  place-items: center;
  color: #FFFFFF;
  flex: none;
}

.brand-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.brand-sub {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: .1em;
  line-height: 1.2;
  text-transform: uppercase;
}

.sidebar-actions { padding: 4px 12px 12px; }
.sidebar-actions .btn { width: 100%; }

.sidebar-section {
  padding: 4px 18px 6px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.conv-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px 12px;
  list-style: none;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.conv-item { margin: 0; }

.conv-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-btn);
  background: transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease;
}
.conv-btn:hover { background: var(--elev); color: var(--text); }
.conv-btn[aria-current="true"] {
  background: var(--elev);
  color: var(--text);
}
.conv-btn[aria-current="true"]::before {
  content: "";
  position: absolute;
  left: 0; top: 10px; bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--tint);
}

.conv-text { min-width: 0; flex: 1; overflow: hidden; }
.conv-title {
  display: block;
  font-size: 14px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.conv-time {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conv-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-user {
  width: 32px; height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--elev);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--tint);
}

.user-meta { min-width: 0; flex: 1; overflow: hidden; }
.user-name {
  display: block;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-mail {
  display: block;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ---------------- Principal ---------------- */

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(18, 16, 24, 0.8);
  backdrop-filter: blur(8px);
}

.topbar-title {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-btn { display: none; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.status-pill[data-state="running"] { color: var(--tint); border-color: #3D3457; }
.status-pill[data-state="running"] .status-dot { background: var(--tint); animation: pulse 1.4s ease-in-out infinite; }
.status-pill[data-state="waiting"] { color: var(--heat); border-color: #4A3327; }
.status-pill[data-state="waiting"] .status-dot { background: var(--heat); }
.status-pill[data-state="reconnecting"] { color: var(--heat); border-color: #4A3327; }
.status-pill[data-state="reconnecting"] .status-dot { background: var(--heat); animation: pulse 1s ease-in-out infinite; }
.status-pill[data-state="offline"] { color: var(--heat); border-color: #4A3327; }
.status-pill[data-state="offline"] .status-dot { background: var(--heat); }

/* ---------------- Hilo ---------------- */

.thread {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 18px 4px;
  scrollbar-gutter: stable;
}

.thread-inner {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 8px;
}

.msg-user {
  align-self: flex-end;
  max-width: min(86%, 620px);
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: 12px 12px 4px 12px;
  padding: 10px 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-agent {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.avatar-agent {
  width: 28px; height: 28px;
  flex: none;
  border-radius: 8px;
  background: linear-gradient(145deg, var(--brand), var(--brand-hover));
  display: grid;
  place-items: center;
  color: #FFFFFF;
  margin-top: 2px;
}

.msg-body {
  min-width: 0;
  flex: 1;
  padding-top: 1px;
}

/* Bloques secundarios alineados bajo el texto del agente */
.aligned { margin-left: 40px; }

/* ---------------- Markdown ---------------- */

.md > *:first-child { margin-top: 0; }
.md > *:last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; overflow-wrap: anywhere; }
.md h3, .md h4, .md h5 {
  margin: 20px 0 8px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.md h3 { font-size: 18px; }
.md h4 { font-size: 16px; }
.md h5 { font-size: 14px; color: var(--muted); text-transform: none; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md li::marker { color: var(--tint); }
.md a { color: var(--tint); text-underline-offset: 2px; }
.md a:hover { color: #D3C1F0; }
.md blockquote {
  margin: 0 0 12px;
  padding: 4px 0 4px 14px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.md hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}
.md strong { font-weight: 650; }

.md code.inline {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--elev);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 1px 5px;
  overflow-wrap: anywhere;
}

.code-block {
  margin: 0 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: #161422;
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px 4px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.code-lang {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.code-block pre {
  margin: 0;
  padding: 12px 14px;
  overflow-x: auto;
}
.code-block code {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre;
  color: #E6E1F7;
}

.md-table-wrap {
  margin: 0 0 14px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
}
.md-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.md-table th, .md-table td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-soft);
  white-space: nowrap;
}
.md-table th { background: var(--surface); font-weight: 600; }
.md-table tr:last-child td { border-bottom: 0; }

/* Cursor de escritura mientras llega el stream */
.md.streaming > *:last-child::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 2px;
  vertical-align: -2px;
  background: var(--tint);
  animation: blink 1s steps(2, start) infinite;
}

/* ---------------- Actividad del agente ---------------- */

.activity {
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  overflow: hidden;
}

.activity-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}
.activity-head:hover { background: var(--elev); }

.activity-chevron { transition: transform .18s ease; color: var(--muted); }
.activity-head[aria-expanded="false"] .activity-chevron { transform: rotate(-90deg); }

.activity-label { font-size: 13px; font-weight: 500; }

.activity-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
}

.activity-summary {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.activity-body {
  list-style: none;
  margin: 0;
  padding: 4px 0 8px;
  border-top: 1px solid var(--border);
}
.activity-head[aria-expanded="false"] + .activity-body { display: none; }

.tool-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 12px;
  font-size: 13px;
}

.tool-icon { color: var(--muted); margin-top: 2px; }

.tool-main { min-width: 0; flex: 1; }

.tool-name {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text);
}

.tool-detail {
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-state {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.tool-row[data-status="start"] .tool-icon { color: var(--tint); }
.tool-row[data-status="start"] .tool-state { color: var(--tint); }
.tool-row[data-status="done"] .tool-state { color: var(--muted); }
.tool-row[data-status="ask"] .tool-icon,
.tool-row[data-status="ask"] .tool-state { color: var(--heat); }

.spinner {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--tint-dim);
  border-top-color: var(--tint);
  animation: spin .7s linear infinite;
  flex: none;
}

/* ---------------- Entregables ---------------- */

.file-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
}

.file-icon {
  width: 40px; height: 40px;
  flex: none;
  border-radius: var(--r-btn);
  background: var(--tint-dim);
  color: var(--tint);
  display: grid;
  place-items: center;
}

.file-meta-wrap { min-width: 0; flex: 1; overflow: hidden; }
.file-name {
  display: block;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-sub {
  display: block;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- Permisos ---------------- */

.ask-card {
  border: 1px solid #4A3327;
  border-left: 3px solid var(--heat);
  border-radius: var(--r-card);
  background: var(--surface);
  padding: 14px;
}

.ask-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--heat);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.ask-text { margin: 0 0 10px; font-size: 14px; }
.ask-tool { font-family: var(--mono); font-size: 13px; color: var(--tint); }

.ask-input {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #161422;
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  color: #E6E1F7;
  max-height: 220px;
  overflow: auto;
  white-space: pre;
}

.ask-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ask-resolved {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.ask-resolved[data-result="allow"] { color: var(--tint); }

/* ---------------- Estados varios ---------------- */

.error-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #4A3327;
  border-radius: var(--r-card);
  background: var(--heat-dim);
  font-size: 14px;
  color: var(--text);
}
.error-card .icon { color: var(--heat); margin-top: 2px; }

.thinking {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 40px;
  font-size: 13px;
  color: var(--muted);
}
.thinking-dots { display: inline-flex; gap: 4px; }
.thinking-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--tint);
  animation: bounce 1.2s ease-in-out infinite;
}
.thinking-dots span:nth-child(2) { animation-delay: .15s; }
.thinking-dots span:nth-child(3) { animation-delay: .3s; }

/* Estado vacío */
.empty {
  margin: auto 0;
  padding: 32px 0 24px;
  text-align: left;
}
.empty-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  background: linear-gradient(100deg, var(--tint), #E9E2FB 60%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.empty-sub { margin: 0 0 22px; color: var(--muted); font-size: 15px; max-width: 52ch; }
.suggestions { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.suggestion {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 40px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.suggestion:hover { border-color: #443C63; color: var(--text); background: var(--elev); }
.suggestion .icon { color: var(--tint); margin-top: 1px; }

/* Botón ir al final */
.jump-btn {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 118px;
  z-index: 5;
  border: 1px solid var(--border);
  background: var(--elev);
  color: var(--text);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
}
.jump-btn[hidden] { display: none; }

/* ---------------- Redactor ---------------- */

.composer {
  padding: 8px 18px 16px;
  background: linear-gradient(to top, var(--bg) 72%, rgba(18, 16, 24, 0));
}

.composer-inner { max-width: var(--measure); margin: 0 auto; }

.composer-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: var(--r-btn);
  background: var(--heat-dim);
  border: 1px solid #4A3327;
  color: var(--heat);
  font-size: 13px;
}
.composer-notice[hidden] { display: none; }

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--surface);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.composer-box:focus-within {
  border-color: var(--tint);
  box-shadow: 0 0 0 3px rgba(187, 160, 227, .16);
}
.composer-box[data-blocked="true"] { opacity: .6; }

#composer-input {
  flex: 1;
  min-height: 28px;
  max-height: 200px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  resize: none;
  outline: none;
  overflow-y: auto;
  line-height: 1.55;
}
#composer-input::placeholder { color: var(--muted); }

.composer-hint {
  margin: 8px 2px 0;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

/* ---------------- Login ---------------- */

.login-page {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(57, 0, 141, .35), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
}

.login-head { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.login-title { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.login-sub { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus {
  border-color: var(--tint);
  box-shadow: 0 0 0 3px rgba(187, 160, 227, .16);
}

.login-error {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #4A3327;
  background: var(--heat-dim);
  border-radius: var(--r-btn);
  color: var(--heat);
  font-size: 13px;
}
.login-error[hidden] { display: none; }

.login-card .btn-primary { width: 100%; margin-top: 4px; }

.login-foot { margin-top: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------------- Superposición móvil ---------------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(9, 8, 13, .6);
  z-index: 30;
  border: 0;
  padding: 0;
}
.overlay[hidden] { display: none; }

/* ---------------- Animaciones ---------------- */

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: .5; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .md.streaming > *:last-child::after { opacity: 1; }
  .spinner { border-top-color: var(--tint); }
}

/* ---------------- Barras de desplazamiento ---------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: #3A3552 transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: #3A3552;
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: #4A4468; background-clip: content-box; }

/* ---------------- Responsive ---------------- */

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 0; bottom: 0; left: 0;
    width: min(300px, 86vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, .5);
  }
  .app[data-sidebar="open"] .sidebar { transform: translateX(0); }

  .menu-btn { display: inline-flex; }

  .aligned { margin-left: 0; }
  .thinking { padding-left: 0; }

  .hint-extra { display: none; }
  .thread { padding: 16px 14px 4px; }
  .composer { padding: 8px 14px 14px; }
  .empty-title { font-size: 23px; }
  .msg-user { max-width: 92%; }
  .jump-btn { bottom: 110px; }
}
