/* =====================================================================
   Dashboard Ticksy para hosteleros · capa de aplicación
   Depende de css/tokens.css (Ticksy Design System 2.0). Solo se añaden
   variables app-* para lo que el TDS no nombra y clases para la
   estructura que se repite en todas las pantallas.
   ===================================================================== */

/* ---- Variables de aplicación, por tema -------------------------------- */
:root,
:root[data-theme="tpv-dark"] {
  --app-text-support: var(--text-secondary);          /* texto de apoyo con contraste sobre navy */
  --app-chart-ink: var(--text-primary);               /* trazo principal de los gráficos */
  --app-chart-accent: var(--text-accent);             /* segundo tono de los gráficos */
  --app-chart-band: var(--color-cyan-700);            /* banda del rango esperado */
  --app-chip-selected-bg: var(--color-cyan-700);      /* chip de periodo seleccionado */
  --app-status-ok-text: var(--status-success);
  --app-status-warn-text: var(--status-warning);
  --app-status-bad-text: var(--status-danger);
  --app-tip-bg: var(--bg-surface-highlight);          /* tooltip del gráfico */
}

:root[data-theme="light"],
:root[data-theme="brand"] {
  --app-text-support: var(--text-body);               /* gray/600: 4,5:1 sobre blanco */
  --app-chart-ink: var(--color-navy-800);
  --app-chart-accent: var(--color-cyan-700);
  --app-chart-band: var(--color-cyan-100);
  --app-chip-selected-bg: var(--bg-surface-highlight);
  --app-status-ok-text: var(--status-success-strong); /* variantes strong: texto sobre fondo claro */
  --app-status-warn-text: var(--status-warning-strong);
  --app-status-bad-text: var(--status-danger-strong);
  --app-tip-bg: var(--bg-surface);
}

/* ---- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text-accent); }
a:hover { color: var(--action-primary-hover); }
.w-full { width: 100%; }

/* Contenedor de pantalla: a ancho completo en móvil; 390 px centrados en escritorio. */
.screen {
  width: 100%;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-canvas);
  color: var(--text-primary);
}

/* ---- Barra superior ---------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  height: 64px;
  padding: 0 var(--space-8) 0 var(--space-4);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}
.topbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  text-decoration: none;
}
.topbar__back:hover { background: var(--bg-surface-raised); color: var(--text-primary); }
.topbar__title {
  flex-grow: 1;
  margin: 0;
  font-size: 20px;
  line-height: 24px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
}

/* ---- Contenido --------------------------------------------------------- */
.content {
  display: flex;
  flex-direction: column;
  gap: var(--space-16);
  padding: var(--space-16);
  flex-grow: 1;
}

/* ---- Chips de periodo -------------------------------------------------- */
.chips { display: flex; gap: var(--space-8); }
.chip {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--app-text-support);
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-decoration: none;
}
.chip--active {
  background: var(--app-chip-selected-bg);
  border-color: var(--app-chip-selected-bg);
  color: var(--text-primary);
}

/* Selector de periodo como switch segmentado (.screen--depth) */
:root, :root[data-theme="tpv-dark"] { --app-switch-track: var(--color-navy-950); --app-switch-text: var(--color-gray-400); }
:root[data-theme="light"], :root[data-theme="brand"] { --app-switch-track: var(--color-gray-200); --app-switch-text: var(--color-gray-500); }
.screen--depth .chips {
  gap: 0;
  padding: 4px;
  border-radius: 999px;
  background: var(--app-switch-track);
  box-shadow: inset 1px 2px 4px var(--app-depth-dark);
}
.screen--depth .chips .chip {
  flex: 1 1 0;
  height: 40px;
  padding: 0 var(--space-8);
  white-space: nowrap;
  letter-spacing: 0.5px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--app-switch-text);
  transition: background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}
.screen--depth .chips .chip:hover { color: var(--app-tile-figure); }
.screen--depth .chips .chip:focus-visible { outline: 2px solid var(--action-primary); outline-offset: -2px; }
.screen--depth .chips .chip--active {
  background: var(--bg-surface);
  color: var(--app-tile-figure);
  box-shadow: 0 2px 6px var(--app-depth-dark);
}

/* ---- Barra superior cyan con selector de local (Inicio) ----------------- */
.appbar {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  height: 64px;
  padding: 0 var(--space-8) 0 var(--space-16);
  background: var(--bg-app-bar);
  color: var(--text-on-accent);                 /* navy: el blanco no contrasta sobre cyan */
  flex-shrink: 0;
}
.appbar__local {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 10px 0 14px;
  margin-right: auto;
  border: 1px solid color-mix(in srgb, var(--text-on-accent) 18%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-white) 35%, transparent);
  color: inherit;
  font: inherit;
  font-size: 15px;
  line-height: 20px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: background-color 150ms ease;
}
.appbar__local:hover { background: color-mix(in srgb, var(--color-white) 55%, transparent); }
.appbar__local:focus-visible { outline: 2px solid var(--text-on-accent); outline-offset: 2px; }
.appbar__local-chevron { opacity: 0.7; }
.appbar__bell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: inherit;
}
.appbar__bell:hover { color: inherit; }
.appbar__badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  box-shadow: 0 0 0 2px var(--bg-app-bar);
  background: var(--status-danger);
  color: var(--text-on-status);
  font-size: 11px;
  line-height: 18px;
  font-weight: 400;
  text-align: center;
}

/* ---- Barra inferior ---------------------------------------------------- */
.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  height: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}
.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  flex-grow: 1;
  height: 64px;
  color: var(--text-secondary);
  text-decoration: none;
}
.tabbar__item--active { color: var(--text-accent); }
/* Barra superior de detalle en cyan, como la de Inicio */
.screen--depth .topbar { background: var(--bg-app-bar); border-bottom-color: transparent; color: var(--text-on-accent); }
.screen--depth .topbar__back,
.screen--depth .topbar__title { color: var(--text-on-accent); }
.screen--depth .topbar__back:hover { background: color-mix(in srgb, var(--color-white) 35%, transparent); color: var(--text-on-accent); }
.screen--depth .topbar__back:focus-visible { outline: 2px solid var(--text-on-accent); outline-offset: 2px; }
/* Barra inferior azul oscuro (.screen--depth) */
.screen--depth .tabbar { background: var(--bg-app-bar-tab); border-top-color: transparent; }
.screen--depth .tabbar__item { color: var(--color-gray-400); }
.screen--depth .tabbar__item--active { color: var(--color-cyan-400); }
.tabbar__label {
  font-size: 11px;
  line-height: 14px;
  font-weight: 400;
  letter-spacing: 1px;
  text-transform: uppercase;
}

@media (min-width: 600px) { .screen { max-width: 390px; } }

/* Barras superiores bajo la muesca (viewport-fit=cover) */
.screen--depth .appbar,
.screen--depth .topbar { height: calc(64px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px); }

/* ---- Rejilla Bento (spec §5.2) ------------------------------------------ */
.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: var(--space-16);
}
.bento__heading {                       /* rótulo de bloque dentro de la rejilla */
  grid-column: span 6;
  margin: var(--space-8) 0 calc(-1 * var(--space-8));
  font-size: 14px; line-height: 16px; font-weight: 400;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-accent);
}

/* ---- Tile ----------------------------------------------------------------- */
.tile {
  grid-column: span 3;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  min-height: 132px;
  padding: var(--space-16);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  color: inherit;
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease;
}
.tile--wide  { grid-column: span 6; }
.tile--third { grid-column: span 2; }
.tile--tall  { grid-row: span 2; }
.tile--hero  { grid-column: span 6; background: var(--bg-surface-raised); }
a.tile:hover { border-color: var(--border-strong); color: inherit; }

/* ---- Profundidad (.screen--depth, todas las pantallas) -------------------
   Doble sombra difuminada: luz arriba-izquierda, sombra abajo-derecha. */
:root, :root[data-theme="tpv-dark"] {
  --app-depth-light: rgba(255, 255, 255, 0.06);
  --app-depth-dark: rgba(0, 0, 0, 0.55);
}
:root[data-theme="light"], :root[data-theme="brand"] {
  --app-depth-light: rgba(255, 255, 255, 0.95);
  --app-depth-dark: rgba(15, 30, 60, 0.14);
}
.screen--depth .tile:not(.tile--plain) {
  box-shadow: -6px -6px 12px var(--app-depth-light), 6px 7px 17px var(--app-depth-dark);
  border-color: transparent;
}
.screen--depth .tile--hero { background: var(--bg-surface); }

/* ---- Módulo limpio (.screen--depth) -------------------------------------
   Solo título, dato grande y resumen; todo en grises del TDS. */
:root, :root[data-theme="tpv-dark"] {
  --app-tile-chevron: var(--color-gray-500);
  --app-tile-title: var(--color-gray-400);
  --app-tile-figure: var(--color-gray-200);
  --app-tile-note: var(--color-gray-400);
}
:root[data-theme="light"], :root[data-theme="brand"] {
  --app-tile-chevron: var(--color-gray-200);
  --app-tile-title: var(--color-gray-300);
  --app-tile-figure: var(--color-gray-500);
  --app-tile-note: var(--color-gray-400);
}
.screen--depth .tile__head { color: var(--app-tile-title); }
.screen--depth .tile__head > [data-ds="Icon"],
.screen--depth a.tile .tile__divider:not(.tile__divider--push) { display: none; }   /* solo en módulos-resumen enlazados */
.screen--depth .tile__divider--push { background: transparent; }
.screen--depth .tile:not(.tile--plain) { padding: var(--space-24) 20px; min-height: 164px; }
.screen--depth .tile > .tile__figure,
.screen--depth .tile > .tile__row:has(> .tile__figure) { margin-block: auto; }   /* dato centrado; resumen al pie */
.screen--depth .tile:not(.tile--hero):not(.tile--wide):not(.tile--tall) > .tile__note:last-child { min-height: 36px; }   /* resumen: 2 líneas reservadas */
.screen--depth .tile__label { font-size: 15px; line-height: 20px; }
.screen--depth .tile__figure { font-size: 40px; line-height: 44px; color: var(--app-tile-figure); letter-spacing: -0.5px; }
.screen--depth .tile__figure { white-space: nowrap; }
.screen--depth .tile__figure--fit { font-size: 32px; }            /* cifras largas en tile estrecha */
.screen--depth .tile--hero .tile__figure { font-size: 56px; line-height: 60px; }
.screen--depth .tile.tile--row:not(.tile--plain) { min-height: 0; }             /* filas de aviso: altura por contenido */
.screen--depth .tile__val { white-space: nowrap; }
.screen--depth .tile--third:not(.tile--plain) { padding-inline: var(--space-16); }                  /* tercio: 20px no deja sitio a la cifra */
.screen--depth .tile--third .tile__figure { gap: 3px; font-size: 24px; line-height: 32px; letter-spacing: 0; }
.screen--depth .tile--third .tile__unit { font-size: 14px; }
.screen--depth .tile:not(.tile--plain):has(.tile__table-row) { padding-inline: var(--space-16); }    /* tablas: mantener ancho de columnas */
.screen--depth .tile__unit { font-size: 16px; line-height: 22px; color: var(--app-tile-figure); }
.screen--depth .tile__note,
.screen--depth .tile__legend { color: var(--app-tile-note); }
.screen--depth .tile__text,
.screen--depth .tile__body,
.screen--depth .tile__strong { color: var(--app-tile-figure); }
/* Color de estado: se recupera en los textos que avisan */
.screen--depth .tile__note--ok, .screen--depth .tile__val--ok, .screen--depth .tile__tag--ok { color: var(--app-status-ok-text); }
.screen--depth .tile__note--warn, .screen--depth .tile__tag--warn { color: var(--app-status-warn-text); }
.screen--depth .tile__note--bad, .screen--depth .tile__val--bad { color: var(--app-status-bad-text); }
/* Chevron fino arriba a la derecha: el módulo es pulsable */
.screen--depth .tile__chevron { margin-left: auto; flex-shrink: 0; color: var(--app-tile-chevron); }
a.tile:active { transform: scale(0.98); }
a.tile:focus-visible { outline: 2px solid var(--action-primary); outline-offset: 2px; }

/* Anatomía */
.tile__head { display: flex; align-items: center; gap: var(--space-8); color: var(--text-accent); }
.tile__label { margin: 0; font-size: 14px; line-height: 16px; font-weight: 400; letter-spacing: 1.4px; text-transform: uppercase; }
.tile__chevron { margin-left: auto; color: var(--text-subtle); display: inline-flex; }
.tile__figure { display: flex; align-items: baseline; gap: 6px; font-size: 28px; line-height: 36px; font-weight: 300; color: var(--text-primary); }
.tile--hero .tile__figure { font-size: 44px; line-height: 52px; }
.tile__figure--m { font-size: 33px; line-height: 40px; }          /* cifra de tarjeta grande, si hace falta */
.tile__unit { font-size: 15px; line-height: 20px; font-weight: 300; color: var(--app-text-support); }
.tile__note { margin: 0; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--app-text-support); }
.tile__note--ok   { color: var(--app-status-ok-text); }
.tile__note--warn { color: var(--app-status-warn-text); }
.tile__note--bad  { color: var(--app-status-bad-text); }
.tile__note--light { font-weight: 300; }
.tile__text { margin: 0; font-size: 14px; line-height: 20px; font-weight: 400; color: var(--text-primary); }
.tile__body { margin: 0; font-size: 16px; line-height: 22px; font-weight: 300; color: var(--text-primary); }
.tile__row { display: flex; align-items: center; gap: var(--space-16); flex-wrap: wrap; }
.tile__row--tight { gap: 14px; }
.tile__row > .grow { flex-grow: 1; }
.tile__divider { height: 1px; background: var(--border-subtle); }
.tile__divider--push { margin-top: auto; }                        /* empuja lo que sigue al pie de la tile */
.tile__bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; background: var(--border-subtle); }
.tile__legend { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; font-weight: 300; color: var(--app-text-support); }
.tile__dot { width: 10px; height: 10px; border-radius: 5px; flex-shrink: 0; }
.tile__strong { color: var(--text-primary); font-weight: 400; }

/* Filas de dato (listas "Por franja", "Por canal", "Lo más vendido") */
.tile__kv { display: flex; align-items: center; gap: var(--space-8); }
.tile__kv-label { width: 96px; flex-shrink: 0; margin: 0; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--app-text-support); }
.tile__kv-value { width: 56px; flex-shrink: 0; margin: 0; text-align: right; font-size: 13px; line-height: 18px; font-weight: 400; color: var(--text-primary); }
.tile__kv-track { flex-grow: 1; height: 8px; border-radius: 6px; background: var(--border-subtle); overflow: hidden; }
.tile__kv-fill { height: 100%; border-radius: 6px; background: var(--app-chart-accent); }
.tile__kv-fill--ink { background: var(--app-chart-ink); }

/* Auxiliares de la migración */
.bento__full { grid-column: span 6; }                       /* bloque no-tile dentro de la rejilla */
.grow { flex-grow: 1; }
.tile--plain { background: transparent; border-color: transparent; padding: 0 var(--space-4); min-height: 0; }
.tile__figure--center { align-items: center; }
.tile__note--primary { color: var(--text-primary); }
.tile__note--right { text-align: right; }
.tile__note--center { text-align: center; }
.tile__body--regular { font-weight: 400; }

/* Secciones: filas clave-valor, rótulos pequeños, listas, tablas, columnas */
.tile--row { flex-direction: row; align-items: flex-start; gap: var(--space-12); min-height: 0; }
.tile__status { width: 12px; height: 12px; border-radius: 6px; margin-top: 5px; flex-shrink: 0; }
.tile__stack { display: flex; flex-direction: column; gap: var(--space-4); flex-grow: 1; min-width: 0; }
.tile__key { margin: 0; font-size: 15px; line-height: 20px; font-weight: 300; color: var(--app-text-support); }
.tile__val { margin: 0; font-size: 15px; line-height: 20px; font-weight: 400; color: var(--text-primary); }
.tile__val--ok { color: var(--app-status-ok-text); }
.tile__val--bad { color: var(--app-status-bad-text); }
.tile__caps { margin: 0; font-size: 12px; line-height: 16px; font-weight: 400; letter-spacing: 1.2px; text-transform: uppercase; color: var(--app-text-support); }
.tile__tag { margin: 0; font-size: 11px; line-height: 14px; font-weight: 400; letter-spacing: 1px; text-transform: uppercase; color: var(--app-text-support); }
.tile__tag--ok { color: var(--app-status-ok-text); }
.tile__tag--warn { color: var(--app-status-warn-text); }
.tile__unit--l { font-size: 20px; line-height: 28px; }
.tile__kv-label--w { width: 110px; }
.tile__kv--end { align-items: flex-end; }
.tile__bar--thick { height: 14px; }
.tile__list-row { display: flex; align-items: center; gap: var(--space-12); padding: 10px 0; border-bottom: 1px solid var(--border-subtle); }
.tile__list-icon { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; color: var(--text-primary); flex-shrink: 0; }
.tile__list-main { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; min-width: 0; }
.tile__list-aside { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; flex-shrink: 0; }
.tile__table-row { display: grid; gap: 6px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); }
.tile__table-row--head { padding: 0 0 6px; border-bottom-color: var(--border-default); }
.tile__cols { display: flex; align-items: flex-end; gap: 6px; }
.tile__col { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); flex-grow: 1; min-width: 0; }
.tile__col-track { position: relative; width: 100%; height: 96px; display: flex; align-items: flex-end; }
.tile__col-track--tall { height: 120px; }
.tile__col-track--short { height: 72px; }
.tile__col-bar { width: 100%; border-radius: 4px; }
.tile__col-outline { position: absolute; left: 0; bottom: 0; width: 100%; height: 99%; border-radius: 4px; border: 1px dashed var(--app-chart-accent); }   /* columna de hoy */
.tile__title { margin: 0; font-size: 24px; line-height: 30px; font-weight: 400; color: var(--text-primary); }
.tile__col-label { margin: 0; font-size: 11px; line-height: 14px; font-weight: 400; color: var(--app-text-support); }

/* Enlaces con aspecto de botón del TDS (los que navegan sin JS) */
.btn { display: flex; align-items: center; justify-content: center; flex-grow: 1; height: 64px; border-radius: var(--radius-sm); font-size: 20px; line-height: 24px; font-weight: 400; text-transform: uppercase; text-decoration: none; }
.btn--primary { background: var(--action-primary); color: var(--text-on-accent); }
.btn--secondary { background: var(--action-secondary); color: var(--text-on-secondary); }
.btn--step { flex-grow: 0; width: 56px; height: 56px; }
.btn:focus-visible { outline: 2px solid var(--action-primary); outline-offset: 2px; }

/* ---- Movimiento (dial 3) --------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .bento > .tile {
    animation: tile-in 250ms ease-out backwards;
    animation-delay: calc(var(--i, 0) * 30ms);
  }
  @keyframes tile-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
  }
}

/* ---- Gráfico de línea de Ventas (spec §6.2) --------------------------------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: 120px; overflow: visible; }
.chart__grid { stroke: var(--border-default); stroke-width: 1; stroke-dasharray: 3 5; }
.chart__line { fill: none; stroke: var(--app-chart-accent); stroke-width: 2; stroke-linecap: round; }
.chart__expected { fill: none; stroke: var(--text-secondary); stroke-width: 1.25; opacity: 0.8; }
.chart__grad-a { stop-color: var(--app-chart-accent); stop-opacity: 0.32; }
.chart__grad-b { stop-color: var(--app-chart-accent); stop-opacity: 0; }
.chart__halo { fill: var(--app-chart-accent); opacity: 0.25; }
.chart__dot { fill: var(--app-chart-accent); stroke: var(--bg-surface-raised); stroke-width: 2; }
.chart__axis { position: relative; height: 18px; margin-top: 6px; border-top: 1px solid var(--border-subtle); padding-top: 4px; }
.chart__axis span { position: absolute; transform: translateX(-50%); font-size: 13px; line-height: 18px; font-weight: 300; color: var(--app-text-support); white-space: nowrap; }
.chart__tip { position: absolute; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--app-tip-bg); border: 1px solid var(--border-default); white-space: nowrap; }
.chart__tip-date { font-size: 12px; line-height: 16px; font-weight: 300; color: var(--app-text-support); }
.chart__tip-value { font-size: 16px; line-height: 20px; font-weight: 400; color: var(--text-primary); }

/* ---- Copiloto · override AI-Native (design-system/pulso/pages/copiloto.md) ---- */
.chat { display: flex; flex-direction: column; gap: var(--space-12); flex-grow: 1; }
.msg { max-width: 88%; padding: var(--space-12) var(--space-16); font-size: 16px; line-height: 22px; font-weight: 300; color: var(--text-primary); border-radius: var(--radius-lg); }
.msg p { margin: 0; }
.msg--user { align-self: flex-end; background: var(--action-secondary); border-bottom-right-radius: var(--radius-sm); }
.msg--bot { align-self: flex-start; background: var(--bg-surface); border: 1px solid var(--border-default); border-bottom-left-radius: var(--radius-sm); display: flex; flex-direction: column; gap: var(--space-8); }
.cite { padding: var(--space-8) var(--space-12); background: var(--bg-surface-raised); border-left: 2px solid var(--text-accent); border-radius: var(--radius-sm); }
.cite__source { margin: 0; font-size: 11px; line-height: 14px; font-weight: 400; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-accent); }
.attachment { display: inline-flex; align-items: center; gap: var(--space-8); max-width: 88%; padding: var(--space-8) var(--space-12); border-radius: var(--radius-sm); background: var(--bg-surface-raised); border: 1px solid var(--border-default); color: var(--text-primary); }
.attachment--user { align-self: flex-end; }
.attachment .ds { color: var(--text-accent); }
.attachment__meta { display: flex; flex-direction: column; gap: 2px; }
.chat__actions { display: flex; gap: var(--space-12); }
.suggestions { display: flex; gap: var(--space-8); overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.suggestions::-webkit-scrollbar { display: none; }
.suggestions .chip { flex-grow: 0; flex-shrink: 0; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 14px; }
.composer { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 2; display: flex; align-items: center; gap: var(--space-8); margin: 0; padding: var(--space-8) var(--space-16); background: var(--bg-surface); border-top: 1px solid var(--border-default); }
.composer__input { flex-grow: 1; min-width: 0; height: 44px; padding: 0 var(--space-16); border-radius: 22px; background: var(--bg-canvas); border: 1px solid var(--border-default); color: var(--text-primary); font: 300 16px/22px var(--font-sans); }
.composer__input::placeholder { color: var(--text-secondary); }
.composer__input:focus-visible { outline: 2px solid var(--action-primary); outline-offset: 1px; }
.composer__btn { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; width: 44px; height: 44px; border: 0; border-radius: 22px; background: var(--action-secondary); color: var(--text-on-secondary); cursor: pointer; }
.composer__btn--send { background: var(--action-primary); color: var(--text-on-accent); }
.composer__btn:focus-visible { outline: 2px solid var(--action-primary); outline-offset: 2px; }

/* ---- Slots de componentes del TDS (los monta js/ds-mount.js) ----------- */
.ds { display: inline-flex; }
.ds:empty { min-width: 1em; min-height: 1em; }

/* ---- Barra de desarrollo (quitar en producción) ------------------------ */
.dev-bar {
  position: fixed;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 10;
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-inverse);
  box-shadow: var(--shadow-modal);
}
.dev-bar button {
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  background: transparent;
  color: var(--text-inverse);
  font: 400 12px/14px var(--font-sans);
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
}
.dev-bar button[aria-pressed="true"] { background: var(--action-primary); color: var(--text-on-accent); }
@media (min-width: 900px) {
  .dev-bar { bottom: auto; top: 12px; }
}
