/* ============================================================
   FLORENT — el amigo melómano
   Dark mode cálido · acento ámbar · tienda de vinilos con gusto
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,500;12..96,600;12..96,700;12..96,800&family=Schibsted+Grotesk:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  /* — Warm dark surfaces (slight amber hue, low chroma) — */
  --bg:        oklch(0.165 0.010 64);   /* lienzo: carbón cálido */
  --bg-deep:   oklch(0.135 0.010 64);   /* sidebar / pozo */
  --surface:   oklch(0.205 0.012 66);   /* tarjetas */
  --surface-2: oklch(0.245 0.013 66);   /* hover / elevación */
  --line:      oklch(0.30 0.012 66);    /* bordes */
  --line-soft: oklch(0.255 0.011 66);

  /* — Texto cálido off-white — */
  --ink:       oklch(0.945 0.008 80);
  --ink-2:     oklch(0.78 0.012 78);
  --ink-3:     oklch(0.64 0.012 75);    /* rediseño jul-2026: +legibilidad de secundarios */
  --ink-faint: oklch(0.52 0.010 72);    /* idem: los faint eran casi invisibles sobre --bg */

  /* — Acento ámbar (tweakable) — */
  --accent:        #E0913F;
  --accent-soft:   color-mix(in oklab, var(--accent) 16%, transparent);
  --accent-line:   color-mix(in oklab, var(--accent) 38%, transparent);
  --accent-ink:    oklch(0.82 0.12 70);
  --spotify:       #1DB954;

  /* — Forma — */
  --r-xs: 7px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;

  /* — Densidad (tweakable) — */
  --gap: 28px;            /* aire entre mensajes */
  --pad: 22px;            /* padding interno de bloques */
  --thread-w: 720px;

  --shadow-card: 0 1px 0 oklch(0.32 0.012 66 / 0.6) inset, 0 14px 34px -18px rgb(0 0 0 / 0.7);
  --shadow-pop:  0 24px 60px -24px rgb(0 0 0 / 0.75);

  --ff-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --ff-body:    'Schibsted Grotesk', system-ui, sans-serif;
  --ff-mono:    'Space Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--ff-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft); color: var(--ink); }

/* subtle vignette/grain on canvas */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(120% 90% at 78% -8%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 46%),
    radial-gradient(90% 70% at 8% 110%, oklch(0.22 0.02 60 / 0.5), transparent 50%);
}

#root { position: relative; z-index: 1; height: 100%; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 296px 1fr;
  grid-template-rows: 100%;   /* clampa la fila a la altura del contenedor; si no, la fila
                                 auto-crece al contenido y .thread no scrollea (queda recortado) */
  height: 100%;
  min-height: 0;
  overflow: hidden;
}
.app.sidebar-collapsed { grid-template-columns: 0 1fr; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  background: var(--bg-deep);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0; overflow: hidden;
}
.sb-head {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 18px 16px;
}
.brand { display: flex; align-items: center; gap: 11px; cursor: default; }
.brand .wordmark {
  font-family: var(--ff-display);
  font-weight: 700; font-size: 21px; letter-spacing: -0.02em;
  color: var(--ink);
}
.brand .wordmark b { color: var(--accent); font-weight: 700; }
.sb-collapse {
  margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: var(--r-sm); color: var(--ink-3); cursor: pointer;
  border: 1px solid transparent; background: transparent;
}
.sb-collapse:hover { background: var(--surface); color: var(--ink); }

.sb-new {
  margin: 4px 14px 14px;
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: var(--r-md);
  font-family: var(--ff-body); font-weight: 600; font-size: 14.5px;
  color: var(--bg-deep); cursor: pointer; border: 0;
  background: var(--accent);
  transition: transform .12s ease, filter .15s ease;
}
.sb-new:hover { filter: brightness(1.06); }
.sb-new:active { transform: translateY(1px); }

.sb-search {
  margin: 0 14px 12px; position: relative;
}
.sb-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.sb-search input {
  width: 100%; background: var(--bg); border: 1px solid var(--line-soft);
  border-radius: var(--r-md); color: var(--ink); font-family: var(--ff-body);
  font-size: 13.5px; padding: 9px 12px 9px 34px; outline: none;
}
.sb-search input::placeholder { color: var(--ink-faint); }
.sb-search input:focus { border-color: var(--accent-line); }

.sb-section {
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); padding: 6px 20px 8px; margin-top: 4px;
}
.sb-list { flex: 1; overflow-y: auto; padding: 0 10px 12px; }
.sb-list::-webkit-scrollbar { width: 9px; }
.sb-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 3px solid var(--bg-deep); }

.conv {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px; border-radius: var(--r-md); cursor: pointer;
  border: 1px solid transparent;
}
.conv:hover { background: var(--surface); }
.conv.active { background: var(--surface); border-color: var(--line); }
.conv.active::before {
  content: ""; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px;
  background: var(--accent); border-radius: 3px;
}
.conv .t {
  font-size: 14px; font-weight: 500; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 22px;
}
.conv.active .t { color: var(--ink); }
.conv .d { font-size: 11.5px; color: var(--ink-faint); font-family: var(--ff-mono); }
.conv .del {
  position: absolute; right: 8px; top: 9px; width: 24px; height: 24px;
  display: none; place-items: center; border-radius: 7px; border: 0; background: transparent;
  color: var(--ink-3); cursor: pointer;
}
.conv:hover .del { display: grid; }
.conv .del:hover { background: var(--surface-2); color: var(--accent); }

/* ---------- SIDEBAR FOOTER: connection status ---------- */
.sb-foot { border-top: 1px solid var(--line-soft); padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.conn {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: var(--r-md); border: 1px solid var(--line-soft);
  background: var(--bg); cursor: pointer; transition: border-color .15s ease;
}
.conn:hover { border-color: var(--line); }
.conn .ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; background: var(--surface); flex: none; font-family: var(--ff-mono); font-weight: 700; font-size: 11px; color: var(--ink-2); }
.conn .meta { min-width: 0; flex: 1; }
.conn .meta .n { font-size: 13px; font-weight: 600; color: var(--ink); }
.conn .meta .s { font-size: 11.5px; color: var(--ink-3); font-family: var(--ff-mono); }
.conn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.conn.on .dot { background: var(--spotify); box-shadow: 0 0 0 3px color-mix(in oklab, var(--spotify) 22%, transparent); }
.conn .go { color: var(--ink-faint); flex: none; }

/* ============================================================
   MAIN
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; position: relative; }

.topbar {
  height: 58px; flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 24px; border-bottom: 1px solid var(--line-soft);
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
}
/* Hamburguesa: estilos base UNA vez; visible con sidebar colapsado (desktop) o SIEMPRE en
   móvil (el drawer arranca cerrado y este botón es la única vía de abrirlo). */
.topbar .sb-open {
  display: none; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer;
}
.app.sidebar-collapsed .topbar .sb-open { display: grid; }
.topbar .title { font-family: var(--ff-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.topbar .title small { color: var(--ink-3); font-weight: 400; font-family: var(--ff-body); }
.topbar .spacer { flex: 1; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display:grid; place-items:center; }

/* ---------- THREAD ---------- */
.thread { flex: 1; overflow-y: auto; scroll-behavior: smooth; overflow-anchor: none; }
.thread::-webkit-scrollbar { width: 11px; }
.thread::-webkit-scrollbar-thumb { background: var(--line); border-radius: 11px; border: 3px solid var(--bg); }
.thread-inner {
  max-width: var(--thread-w); margin: 0 auto; padding: 36px 28px 40px;
  display: flex; flex-direction: column; gap: var(--gap);
}

/* ---------- MESSAGE ---------- */
.msg { display: flex; gap: 16px; opacity: 1; }
.msg .av { flex: none; width: 38px; height: 38px; }
.msg.user { justify-content: flex-end; }
.msg.user .av { display: none; }

.msg .body { min-width: 0; max-width: 100%; }
.msg.assistant .body { flex: 1; }

.who { display: flex; align-items: baseline; gap: 9px; margin-bottom: 7px; }
.who .name { font-family: var(--ff-display); font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.who .tag { font-family: var(--ff-mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }

/* user bubble */
.user-bubble {
  background: var(--surface); border: 1px solid var(--line-soft);
  padding: 13px 17px; border-radius: var(--r-lg) var(--r-lg) var(--r-xs) var(--r-lg);
  font-size: 15.5px; line-height: 1.55; color: var(--ink);
  max-width: 80%;
}

/* assistant prose */
.prose { font-size: 16.5px; line-height: 1.72; color: var(--ink); letter-spacing: -0.003em; }
.prose p { margin: 0 0 0.9em; text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--ink); font-weight: 700; }
.prose em { color: var(--accent-ink); font-style: normal; font-weight: 600; }
.caret { display: inline-block; width: 9px; height: 1.05em; transform: translateY(2px); background: var(--accent); margin-left: 2px; border-radius: 1px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }

/* spotify inline chip in prose */
.spot {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: baseline;
  padding: 1px 8px 1px 6px; margin: 0 1px; border-radius: 999px;
  background: color-mix(in oklab, var(--spotify) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--spotify) 32%, transparent);
  color: oklch(0.86 0.13 152); text-decoration: none; font-weight: 600; font-size: 0.86em;
  line-height: 1.5; transition: background .15s ease;
}
.spot:hover { background: color-mix(in oklab, var(--spotify) 24%, transparent); }
.spot svg { flex: none; }

/* ---------- PRICE CARDS (ficha de tienda) ---------- */
.cards { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.cards-label {
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-3); display: flex; align-items: center; gap: 8px; margin-bottom: 2px;
}
.cards-label::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

.pcard {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 0;
  background: linear-gradient(180deg, var(--surface), color-mix(in oklab, var(--surface) 88%, #000));
  border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-card);
  transition: border-color .18s ease, transform .18s ease;
}
.pcard:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.pcard .cover {
  position: relative; width: 96px; height: 96px; align-self: stretch; min-height: 96px;
  background: repeating-linear-gradient(135deg, oklch(0.30 0.02 60), oklch(0.30 0.02 60) 6px, oklch(0.27 0.02 60) 6px, oklch(0.27 0.02 60) 12px);
  display: grid; place-items: center; overflow: hidden;
}
.pcard .cover .ph { position: absolute; left: 8px; bottom: 7px; font-family: var(--ff-mono); font-size: 8.5px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.06em; z-index: 2; }
.pcard .cover .vinyl { position: absolute; right: -26px; top: 50%; transform: translateY(-50%); width: 72px; height: 72px; border-radius: 50%; background: radial-gradient(circle at 50% 50%, var(--bg-deep) 22%, oklch(0.24 0.01 60) 23% 30%, oklch(0.17 0.01 60) 31% 100%); border: 1px solid oklch(0.30 0.01 60); box-shadow: -3px 0 10px rgb(0 0 0 / .4); }
.pcard .cover .vinyl::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: repeating-radial-gradient(circle at 50% 50%, transparent 0 2px, oklch(0.20 0.01 60 / .5) 2px 2.6px); }

.pcard .info { padding: 13px 14px 13px 18px; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.pcard .info .artist { font-size: 13px; color: var(--ink-3); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .info .album { font-family: var(--ff-display); font-weight: 600; font-size: 16.5px; letter-spacing: -0.01em; color: var(--ink); line-height: 1.2; margin: 1px 0 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard .info .meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.pcard .info .store { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.pcard .info .store .logo { width: 16px; height: 16px; border-radius: 4px; background: var(--surface-2); display:grid; place-items:center; font-family: var(--ff-mono); font-size:9px; color: var(--ink-2); font-weight:700; }
.stock { display: inline-flex; align-items: center; gap: 5px; font-family: var(--ff-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.stock .d { width: 6px; height: 6px; border-radius: 50%; }
.stock.in { color: oklch(0.80 0.13 150); } .stock.in .d { background: oklch(0.74 0.15 150); }

.pcard .buy { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 9px; padding: 13px 16px 13px 8px; }
.pcard .price { font-family: var(--ff-mono); font-weight: 700; font-size: 21px; color: var(--ink); letter-spacing: -0.02em; }
.pcard .buy-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border: 0; cursor: pointer;
  border-radius: 999px; background: var(--accent); color: var(--bg-deep); font-family: var(--ff-body);
  font-weight: 700; font-size: 13px; white-space: nowrap; transition: filter .15s ease, transform .1s ease;
}
.pcard .buy-btn:hover { filter: brightness(1.07); }
.pcard .buy-btn:active { transform: translateY(1px); }

/* ---------- DISCOGS ROW ---------- */
.discogs {
  margin-top: 6px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--r-md);
  border: 1px dashed var(--line); background: color-mix(in oklab, var(--surface) 50%, transparent);
}
.discogs .lead { font-size: 13px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; }
.discogs .lead b { color: var(--ink-2); font-weight: 600; }
.discogs .links { display: flex; gap: 8px; flex-wrap: wrap; }
.dg-link {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink-2); text-decoration: none;
  font-size: 12.5px; transition: border-color .15s ease, color .15s ease;
}
.dg-link:hover { border-color: var(--accent-line); color: var(--ink); }
.dg-link .price { font-family: var(--ff-mono); font-weight: 700; color: var(--ink); }

/* ---------- CHIPS ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-family: var(--ff-body); font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .1s ease;
}
.chip:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.chip:active { transform: translateY(1px); }
.chip svg { color: var(--ink-faint); }
.chip:hover svg { color: var(--accent); }

/* ---------- DIRECTION BUTTONS (welcome) ---------- */
.dirs { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.dir {
  flex: 1 1 160px; text-align: left; cursor: pointer;   /* 160: las 3 tarjetas caben en una fila del welcome (640px) */
  padding: 18px 18px; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface);
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.dir:hover { border-color: var(--accent-line); transform: translateY(-2px); background: var(--surface-2); }
.dir .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 11px; }
.dir .t { font-family: var(--ff-display); font-weight: 600; font-size: 16px; color: var(--ink); margin-bottom: 3px; }
.dir .s { font-size: 13px; color: var(--ink-3); line-height: 1.45; }

/* ---------- FEEDBACK ---------- */
.fb { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.fb-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--ink-faint); cursor: pointer; transition: all .14s ease; }
.fb-btn:hover { background: var(--surface); color: var(--ink-2); }
.fb-btn.on.up { color: oklch(0.78 0.14 150); background: color-mix(in oklab, oklch(0.74 0.15 150) 14%, transparent); }
.fb-btn.on.down { color: var(--accent); background: var(--accent-soft); }
.fb-sep { width: 1px; height: 18px; background: var(--line-soft); margin: 0 6px; }
.fb-act { background: transparent; border: 0; color: var(--ink-faint); cursor: pointer; width: 32px; height: 32px; display:grid; place-items:center; border-radius: 8px; }
.fb-act:hover { background: var(--surface); color: var(--ink-2); }

/* ============================================================
   WELCOME
   ============================================================ */
.welcome { max-width: 640px; margin: 0 auto; padding: 7vh 28px 40px; text-align: left; }
.welcome .mark { width: 64px; height: 64px; margin-bottom: 22px; }
.welcome h1 { font-family: var(--ff-display); font-weight: 700; font-size: clamp(30px, 4vw, 40px); letter-spacing: -0.025em; line-height: 1.04; margin: 0 0 14px; }
.welcome h1 .am { color: var(--accent); }
.welcome .lede { font-size: 18px; line-height: 1.6; color: var(--ink-2); max-width: 30em; text-wrap: pretty; }
.welcome .lede b { color: var(--ink); font-weight: 600; }
.suggest { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }

/* ============================================================
   COMPOSER
   ============================================================ */
.composer-wrap { flex: none; padding: 8px 28px 22px; background: linear-gradient(0deg, var(--bg) 62%, transparent); }
.composer {
  max-width: var(--thread-w); margin: 0 auto; position: relative;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  padding: 7px 7px 7px 20px; display: flex; align-items: flex-end; gap: 10px;
  box-shadow: var(--shadow-card); transition: border-color .18s ease;
}
.composer:focus-within { border-color: var(--accent-line); }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: transparent;
  color: var(--ink); font-family: var(--ff-body); font-size: 15.5px; line-height: 1.5;
  padding: 11px 0; max-height: 160px; min-height: 24px;
}
.composer textarea::placeholder { color: var(--ink-faint); }
.send {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--accent); color: var(--bg-deep); display: grid; place-items: center;
  transition: filter .15s ease, transform .1s ease, opacity .15s ease;
}
.send:disabled { opacity: 0.4; cursor: default; background: var(--surface-2); color: var(--ink-3); }
.send:not(:disabled):hover { filter: brightness(1.08); }
.send:not(:disabled):active { transform: scale(0.94); }
.composer-hint { max-width: var(--thread-w); margin: 9px auto 0; text-align: center; font-size: 11.5px; color: var(--ink-faint); font-family: var(--ff-mono); }

/* typing indicator */
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: bob 1.1s ease-in-out infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%,80%,100% { transform: translateY(0); opacity:.5; } 40% { transform: translateY(-4px); opacity:1; } }

/* (rediseño jul-2026) el comportamiento móvil vive en la sección RESPONSIVE del final */

/* ============================================================
   ADAPTER — clases que emite el frontend vanilla (static/app.js)
   sobre el sistema de diseño de arriba. La LÓGICA no cambió;
   esto solo viste lo que app.js escupe al DOM.
   ============================================================ */

.app { position: relative; z-index: 1; }

/* el contenedor de prosa que app.js genera lleva las dos clases:
   .prose (estilo del sistema) + .message-content (lo que querySelectorea app.js) */
.message-content { min-width: 0; }

/* ---- scroll del hilo ---- */
.thread-inner { min-height: min-content; }

/* ---- tool indicator (Wikipedia, Last.fm, Setlist.fm…) ---- */
.tool-indicator {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--ff-mono); font-size: 11px; letter-spacing: 0.03em;
  color: var(--ink-3); background: var(--surface);
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 4px 11px 4px 8px; margin-bottom: 10px;
  animation: tiFade 0.2s ease;
}
.tool-icon { font-size: 13px; line-height: 1; }
/* Frase rotativa del indicador: fade suave al cambiar de frase (sutil, ~150ms). */
.tool-phrase { transition: opacity 150ms ease; }
@keyframes tiFade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: translateY(0); } }

/* ---- typing dots (app.js usa <span>, el sistema usa <i>) ---- */
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 6px 0; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-faint); animation: bob 1.1s ease-in-out infinite; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }

/* ---- prosa: extras que el sistema no cubre (solo cubre p/strong/em) ---- */
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 0.9em; }
.prose li { margin-bottom: 0.25em; }
.prose code {
  font-family: var(--ff-mono); font-size: 0.85em;
  background: var(--bg-deep); border: 1px solid var(--line-soft);
  border-radius: var(--r-xs); padding: 1px 5px; color: var(--accent-ink);
}
.prose hr { border: 0; border-top: 1px solid var(--line-soft); margin: 1em 0; }
.prose table { border-collapse: collapse; width: 100%; margin: 0.4em 0 1em; font-size: 0.92em; }
.prose th, .prose td { border: 1px solid var(--line-soft); padding: 7px 11px; text-align: left; }
.prose th { background: var(--surface); font-family: var(--ff-display); color: var(--ink); font-weight: 600; }
.prose tr:nth-child(even) td { background: color-mix(in oklab, var(--surface) 45%, transparent); }
.prose .cover-img { max-width: 150px; border-radius: var(--r-sm); margin: 8px 0; display: block; }

/* la píldora .spot (spotify inline) ya vive en el sistema; aquí solo el caso glifo-solo */
.spot svg { display: block; }

/* ---- price cards: imagen real rellenando la carátula ---- */
.pcard .cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 2; }
.pcard .buy-btn { user-select: none; }

/* ---- feedback (app.js: .feedback-row + .fb-btn.fb-up/.fb-down.active) ---- */
.feedback-row { display: flex; align-items: center; gap: 4px; margin-top: 16px; }
.fb-btn.fb-up.active { color: oklch(0.78 0.14 150); background: color-mix(in oklab, oklch(0.74 0.15 150) 14%, transparent); }
.fb-btn.fb-down.active { color: var(--accent); background: var(--accent-soft); }

/* ---- chips de acción y de prosa (app.js: .suggestion-row / .suggestion-btn / .song-chip) ---- */
.suggestion-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.suggestion-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--ink-2); font-family: var(--ff-body); font-size: 13.5px; font-weight: 500;
  cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: border-color .15s ease, background .15s ease, color .15s ease, transform .1s ease;
}
.suggestion-btn:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.suggestion-btn:active { transform: translateY(1px); }
.song-chip { color: oklch(0.86 0.13 152); border-color: color-mix(in oklab, var(--spotify) 32%, transparent); }
.song-chip:hover { background: color-mix(in oklab, var(--spotify) 16%, transparent); color: oklch(0.9 0.13 152); }


/* ---- botón de perfil (reubicado tras el avatar) ---- */
.profile-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font-family: var(--ff-body); font-size: 12.5px; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.profile-btn:hover { background: var(--surface-2); color: var(--ink); }
.profile-btn.hidden { display: none; }

.hidden { display: none !important; }

/* el pie (conexiones) siempre abajo aunque la lista de conversaciones esté
   oculta (sin lista no hay spacer flex:1 que lo empuje) */
.sb-foot { margin-top: auto; }

/* ---- lista de conversaciones (.sb-list > #convList) ---- */
#convList { list-style: none; margin: 0; padding: 0; }
#convListSection { flex: 1; overflow-y: auto; min-height: 0; padding: 0 10px 8px; display: flex; flex-direction: column; }
#convListSection::-webkit-scrollbar { width: 9px; }
#convListSection::-webkit-scrollbar-thumb { background: var(--line); border-radius: 9px; border: 3px solid var(--bg-deep); }
.conv-item {
  position: relative; display: flex; flex-direction: column; gap: 2px; padding: 10px 12px;
  border-radius: var(--r-md); cursor: pointer; border: 1px solid transparent;
}
.conv-item:hover { background: var(--surface); }
.conv-item.active { background: var(--surface); border-color: var(--line); }
.conv-item.active::before { content: ""; position: absolute; left: -6px; top: 12px; bottom: 12px; width: 3px; background: var(--accent); border-radius: 3px; }
.conv-title { font-size: 14px; font-weight: 500; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 22px; }
.conv-item.active .conv-title { color: var(--ink); }
.conv-meta { font-size: 11.5px; color: var(--ink-faint); font-family: var(--ff-mono); }
.conv-delete {
  position: absolute; right: 8px; top: 9px; width: 24px; height: 24px; display: none;
  place-items: center; border-radius: 7px; border: 0; background: transparent; color: var(--ink-3);
  cursor: pointer; font-size: 16px; line-height: 1;
}
.conv-item:hover .conv-delete { display: grid; }
.conv-delete:hover { background: var(--surface-2); color: var(--accent); }
.delete-all-btn {
  margin: 8px 2px 2px; padding: 8px; background: transparent; border: 1px solid var(--line-soft);
  border-radius: var(--r-md); color: var(--ink-faint); font-family: var(--ff-body); font-size: 12px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.delete-all-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.logout-btn {
  width: 100%; margin-top: 8px; padding: 8px; background: transparent; border: 1px solid var(--line-soft);
  border-radius: var(--r-md); color: var(--ink-faint); font-family: var(--ff-body); font-size: 12px; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.logout-btn:hover { border-color: var(--accent-line); color: var(--accent); }
.logout-btn.hidden { display: none; }

/* ---- modales (confirm + perfil) ---- */
.confirm-modal {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center;
  background: rgb(0 0 0 / 0.55); backdrop-filter: blur(3px);
}
.confirm-modal.hidden { display: none; }
.confirm-dialog, .profile-dialog {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); padding: 22px; max-width: 440px; width: calc(100% - 40px);
}
.confirm-dialog p { margin: 0 0 18px; font-size: 15px; color: var(--ink); line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-secondary, .btn-danger {
  padding: 9px 16px; border-radius: var(--r-md); font-family: var(--ff-body); font-weight: 600;
  font-size: 13.5px; cursor: pointer; border: 1px solid var(--line);
}
.btn-secondary { background: transparent; color: var(--ink-2); }
.btn-secondary:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--accent); border-color: transparent; color: var(--bg-deep); }
.btn-danger:hover { filter: brightness(1.07); }

.profile-dialog { max-width: 520px; max-height: 80vh; overflow-y: auto; }
.profile-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.profile-header h2 { font-family: var(--ff-display); font-size: 19px; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
.profile-close { width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-3); font-size: 22px; line-height: 1; cursor: pointer; border-radius: var(--r-sm); }
.profile-close:hover { background: var(--surface-2); color: var(--ink); }
.profile-privacy { font-size: 13px; color: var(--ink-3); line-height: 1.5; margin: 0 0 14px; }
.profile-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-empty { font-size: 14px; color: var(--ink-faint); line-height: 1.5; }
.profile-empty.hidden { display: none; }
.fact-item { border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--bg); padding: 10px 12px; }
.fact-row { display: flex; align-items: center; gap: 9px; }
.fact-cat { font-family: var(--ff-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; flex: none; }
.fact-text { flex: 1; font-size: 14px; color: var(--ink); min-width: 0; }
.fact-actions { display: flex; gap: 4px; flex: none; }
.fact-edit, .fact-delete { border: 0; background: transparent; color: var(--ink-faint); cursor: pointer; border-radius: var(--r-xs); padding: 4px 7px; font-size: 14px; }
.fact-edit:hover, .fact-delete:hover { background: var(--accent-soft); color: var(--accent); }
.fact-edit-input { flex: 1; background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--r-sm); color: var(--ink); font-family: var(--ff-body); font-size: 14px; padding: 6px 9px; outline: none; }
.fact-edit-input:focus { border-color: var(--accent-line); }
.fact-save, .fact-cancel { border: 1px solid var(--line); background: transparent; color: var(--ink-2); cursor: pointer; border-radius: var(--r-sm); padding: 5px 10px; font-family: var(--ff-body); font-size: 12.5px; }
.fact-save:hover { border-color: var(--accent-line); color: var(--accent); }
.fact-cancel:hover { background: var(--surface-2); color: var(--ink); }

/* ---- composer: el textarea/botón reales mantienen sus ids ---- */
#inputMsg { flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-family: var(--ff-body); font-size: 15.5px; line-height: 1.5; padding: 11px 0; max-height: 160px; min-height: 24px; }
#inputMsg::placeholder { color: var(--ink-faint); }
#sendBtn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer; background: var(--accent); color: var(--bg-deep); display: grid; place-items: center; transition: filter .15s ease, transform .1s ease, opacity .15s ease; }
#sendBtn:disabled { opacity: 0.4; cursor: default; background: var(--surface-2); color: var(--ink-3); }
#sendBtn:not(:disabled):hover { filter: brightness(1.08); }
#sendBtn:not(:disabled):active { transform: scale(0.94); }
#sendBtn svg { width: 18px; height: 18px; }

/* (rediseño jul-2026) en móvil el toggle LLM y el perfil se REUBICAN al drawer (app.js
   relocateTopbarControls), no se esconden: eran funciones inaccesibles en móvil. */

/* ============================================================
   FLORENT SPRITE — avatar animado (sidebar) + cara en welcome y mensajes
   ============================================================ */
.sb-avatar { display: grid; place-items: center; padding: 4px 14px 8px; }
#florentCanvas { height: 132px; width: auto; max-width: 100%; display: block; }

/* welcome: Florent grande de cuerpo entero */
.welcome .mark.florent-hero { width: 96px; height: 96px; margin-bottom: 18px; }
.welcome .mark.florent-hero svg { display: block; width: 100%; height: 100%; }

/* avatar de cada mensaje: cara recortada del sprite en el círculo de 38px */
.msg .av .florent-face {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background-color: var(--surface);
  background-image: url('/static/florent_f1.png');
  background-repeat: no-repeat;
  background-size: 235%;
  background-position: 50% 6%;
  border: 1px solid var(--line);
}

/* ── Nota correctora owned-vinyl (#30 v2) ─────────────────────────────────── */
.owned-note {
  display: flex; align-items: center; gap: 9px; margin-top: 14px;
  padding: 10px 14px; border-radius: var(--r-md);
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
  color: var(--ink-2); font-size: 13.5px; line-height: 1.45;
}
.owned-note svg { color: var(--accent); flex: none; }
.owned-note b { color: var(--ink); font-weight: 600; }

/* #30 v3 — etiqueta del HUECO real de vinilo (lo que le falta al usuario de ese artista) */
.gap-tag {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  padding: 1px 7px; border-radius: 999px;
  border: 1px solid var(--accent-line); background: var(--accent-soft);
  color: var(--accent); font-family: var(--ff-mono); font-size: 9.5px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}

/* ============================================================
   REDISEÑO jul-2026 — accesibilidad, estados y RESPONSIVE/MÓVIL
   ============================================================ */

/* foco visible con teclado (no ensucia el click de ratón) */
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent-line); outline-offset: 2px;
}
.composer textarea:focus-visible { outline: none; }  /* el borde del composer ya lo señala */

/* movimiento reducido: sin bob/blink/fades para quien lo pide */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* estado vacío de RECIENTES (se oculta al haber conversaciones) */
.conv-empty {
  margin: 0 20px 8px; font-size: 12.5px; line-height: 1.5; color: var(--ink-faint);
}
.conv-empty.hidden { display: none; }

/* backdrop del drawer móvil: inerte fuera de móvil */
.sb-backdrop {
  display: none; position: fixed; inset: 0; z-index: 65;
  background: rgb(0 0 0 / 0.5); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}

/* controles reubicados al drawer en móvil (app.js los mueve al .sb-foot) */
.sb-foot .sb-foot .sb-foot .profile-btn { width: 100%; justify-content: center; }

/* ── MÓVIL (≤760px): sidebar = drawer off-canvas ── */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; height: 100dvh; }

  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; z-index: 70;
    width: min(84vw, 320px);
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 0 60px rgb(0 0 0 / 0.6);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app.sidebar-open .sidebar { transform: translateX(0); }
  .app.sidebar-open .sb-backdrop { display: block; opacity: 1; pointer-events: auto; }
  .sb-backdrop { display: block; }   /* presente para poder transicionar; inerte sin .sidebar-open */

  /* la hamburguesa SIEMPRE visible en móvil (única vía de abrir el drawer);
     el botón de colapsar del sidebar pasa a ser "cerrar drawer" (app.js) */
  .topbar .sb-open { display: grid; }

  .topbar { padding: 0 14px; gap: 10px; }
  .topbar .title small { display: none; }   /* el subtítulo no cabe con dignidad */

  .thread-inner { padding: 20px 16px 28px; }
  .welcome { padding: 3vh 4px 24px; }
  .welcome .mark.florent-hero { width: 72px; height: 72px; margin-bottom: 14px; }
  .welcome .lede { font-size: 16px; }
  .dirs { gap: 9px; margin-top: 16px; }
  .dir { flex-basis: 100%; padding: 13px 14px; display: flex; align-items: center; gap: 12px; }
  .dir .ic { margin-bottom: 0; flex: none; }
  .dir .t { margin-bottom: 1px; font-size: 15px; }
  .dir .s { font-size: 12.5px; }

  .user-bubble { max-width: 92%; }
  .msg { gap: 10px; }
  .msg .av { width: 32px; height: 32px; }
  .prose { font-size: 15.5px; }

  /* price cards: carátula más pequeña, botón compacto */
  .pcard { grid-template-columns: 76px 1fr auto; }
  .pcard .cover { width: 76px; height: 76px; min-height: 76px; }
  .pcard .info { padding: 10px 10px 10px 12px; }
  .pcard .info .album { font-size: 14.5px; }
  .pcard .price { font-size: 17px; }
  .pcard .buy { padding: 10px 12px 10px 6px; }
  .pcard .buy-btn { padding: 7px 12px; font-size: 12px; }

  .composer-wrap { padding: 6px 12px calc(12px + env(safe-area-inset-bottom)); }
  .composer { padding-left: 14px; }
  .composer-hint { margin-top: 6px; font-size: 10.5px; }
}

/* ── Onboarding abierto: cuenta ligera + modal explicativo de conexión ── */
.conn.guest .ic { color: var(--accent); background: var(--accent-soft); }
.conn.guest { border-color: var(--accent-line); }
.conn.guest:hover { border-color: var(--accent); }
.conn.guest.hidden { display: none; }

.connect-dialog h3 {
  font-family: var(--ff-display); font-size: 18px; font-weight: 700;
  letter-spacing: -0.01em; margin: 0 0 10px; color: var(--ink);
}
.connect-dialog p { font-size: 14.5px; line-height: 1.6; color: var(--ink-2); margin: 0 0 18px; }

/* ── Toast de confirmación (feedback de acciones de cuenta: invitado/conexiones) ── */
.fl-toast {
  position: absolute; top: 68px; left: 50%; transform: translateX(-50%);
  z-index: 80; max-width: min(92%, 520px);
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--accent-line);
  color: var(--ink); border-radius: 999px; padding: 10px 18px;
  font-size: 13.5px; line-height: 1.4; box-shadow: var(--shadow-pop);
  animation: toastIn .22s ease;
}
.fl-toast .tick { color: var(--accent); font-weight: 700; flex: none; }
.fl-toast.out { opacity: 0; transition: opacity .3s ease; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* chip de UI ya consumado (p.ej. cuenta ligera creada) */
.suggestion-btn.done {
  border-color: var(--accent-line); color: var(--accent); cursor: default;
  background: var(--accent-soft);
}
