
:root { color-scheme: dark; 
  --bg: oklch(0.090 0.006 270); --bg-el: oklch(0.130 0.008 270); --bg-sunk: oklch(0.07 0.005 270);
  --bg-hover: oklch(0.190 0.009 270); --bg-active: oklch(0.270 0.010 270);
  --fg: oklch(0.992 0.001 270); --fg-muted: oklch(0.745 0.008 270); --fg-subtle: oklch(0.610 0.010 270);
  --border: oklch(0.22 0.008 270); --border-strong: oklch(0.30 0.010 270); --border-faint: oklch(0.16 0.006 270);
  --success: oklch(0.72 0.15 150); --success-bg: oklch(0.20 0.04 150);
  --warn: oklch(0.78 0.14 75); --warn-bg: oklch(0.22 0.04 75);
  --info: oklch(0.72 0.10 240); --info-bg: oklch(0.20 0.03 240);
  --danger: oklch(0.72 0.16 25); --danger-bg: oklch(0.22 0.05 25);
  --primary: oklch(0.992 0.001 270); --primary-fg: oklch(0.090 0.006 270);
  --activo-sombra: none;
  --shadow-lg: 0 1px 0 rgb(0 0 0 / 0.40), 0 8px 16px rgb(0 0 0 / 0.40), 0 24px 48px rgb(0 0 0 / 0.50);
 }
@media (prefers-color-scheme: light) { :root:not([data-tema="oscuro"]) { color-scheme: light; 
  --bg: oklch(0.992 0.001 270); --bg-el: oklch(1 0 0); --bg-sunk: oklch(0.960 0.003 270);
  --bg-hover: oklch(0.960 0.003 270); --bg-active: oklch(0.940 0.004 270);
  --fg: oklch(0.090 0.006 270); --fg-muted: oklch(0.490 0.011 270); --fg-subtle: oklch(0.610 0.010 270);
  --border: oklch(0.910 0.005 270); --border-strong: oklch(0.860 0.006 270); --border-faint: oklch(0.940 0.004 270);
  --success: oklch(0.45 0.11 150); --success-bg: oklch(0.96 0.03 150);
  --warn: oklch(0.50 0.11 70); --warn-bg: oklch(0.97 0.04 80);
  --info: oklch(0.48 0.10 240); --info-bg: oklch(0.96 0.02 240);
  --danger: oklch(0.50 0.16 25); --danger-bg: oklch(0.97 0.03 25);
  --primary: oklch(0.090 0.006 270); --primary-fg: oklch(0.992 0.001 270);
  --activo-sombra: 0 1px 0 rgb(0 0 0 / 0.04), 0 1px 2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 1px 0 rgb(0 0 0 / 0.04), 0 8px 16px rgb(0 0 0 / 0.06), 0 24px 48px rgb(0 0 0 / 0.08);
 } }
:root[data-tema="claro"] { color-scheme: light; 
  --bg: oklch(0.992 0.001 270); --bg-el: oklch(1 0 0); --bg-sunk: oklch(0.960 0.003 270);
  --bg-hover: oklch(0.960 0.003 270); --bg-active: oklch(0.940 0.004 270);
  --fg: oklch(0.090 0.006 270); --fg-muted: oklch(0.490 0.011 270); --fg-subtle: oklch(0.610 0.010 270);
  --border: oklch(0.910 0.005 270); --border-strong: oklch(0.860 0.006 270); --border-faint: oklch(0.940 0.004 270);
  --success: oklch(0.45 0.11 150); --success-bg: oklch(0.96 0.03 150);
  --warn: oklch(0.50 0.11 70); --warn-bg: oklch(0.97 0.04 80);
  --info: oklch(0.48 0.10 240); --info-bg: oklch(0.96 0.02 240);
  --danger: oklch(0.50 0.16 25); --danger-bg: oklch(0.97 0.03 25);
  --primary: oklch(0.090 0.006 270); --primary-fg: oklch(0.992 0.001 270);
  --activo-sombra: 0 1px 0 rgb(0 0 0 / 0.04), 0 1px 2px rgb(0 0 0 / 0.08);
  --shadow-lg: 0 1px 0 rgb(0 0 0 / 0.04), 0 8px 16px rgb(0 0 0 / 0.06), 0 24px 48px rgb(0 0 0 / 0.08);
 }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 13px; line-height: 1.45; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.lbl { font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; color: var(--fg-muted); line-height: 1.2; }
.chip { font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; text-transform: uppercase; letter-spacing: .1em; border-radius: 4px; padding: 3px 6px; line-height: 1; white-space: nowrap; }
.chip.borrador { color: var(--warn); background: var(--warn-bg); }
.chip.publicado { color: var(--success); background: var(--success-bg); }
.chip.esperando { color: var(--info); background: var(--info-bg); }
.chip.neutro { color: var(--fg-subtle); border: 1px solid var(--border); }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--fg-muted); outline-offset: 2px; }

.app { max-width: 760px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.cab { display: flex; align-items: center; gap: 11px; padding: 18px 16px 14px; flex-wrap: wrap; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--fg); color: var(--bg); display: grid; place-items: center; flex-shrink: 0; }
.titulo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.titulo strong { font-size: 15px; font-weight: 600; }
.titulo .lbl { overflow-wrap: anywhere; }
.cab .der { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }

.ws { display: flex; align-items: center; gap: 8px; padding: 0 16px 4px; flex-wrap: wrap; }
.ws select { min-width: 0; max-width: 100%; height: 30px; padding: 0 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-sunk); color: var(--fg); font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.ws .valor { font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--fg); overflow-wrap: anywhere; min-width: 0; }

.vuelta { display: flex; align-items: center; gap: 8px; padding: 8px 16px 0; flex-wrap: wrap; }
.vuelta .aviso { flex: 1; min-width: 200px; }
.pestanas { display: flex; gap: 18px; padding: 0 16px; margin-top: 10px; border-bottom: 1px solid var(--border); }
.pestana { height: 40px; padding: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--fg-muted); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 6px; }
.pestana[aria-selected="true"] { border-bottom-color: var(--fg); color: var(--fg); font-weight: 600; }
.pestana .cuenta { font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 700; color: var(--fg-subtle); }

.cuerpo { flex: 1; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fila { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fila > .der { margin-left: auto; }
.meta { font-size: 12px; color: var(--fg-muted); margin: 0; }
.pie { display: flex; align-items: center; gap: 8px; padding: 14px 16px 24px; color: var(--fg-muted); font-size: 11.5px; border-top: 1px solid var(--border); }
.pie .ic { width: 14px; height: 14px; }

.aviso { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--bg-sunk); font-size: 12.5px; color: var(--fg-muted); overflow-wrap: anywhere; }
.aviso.error { background: var(--danger-bg); color: var(--danger); }
.primario { height: 36px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--primary); color: var(--primary-fg); font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.primario:disabled { opacity: .55; }
.primario.ancho { height: 42px; width: 100%; font-size: 13.5px; gap: 9px; }
.secundario { height: 30px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: transparent; color: var(--fg); font-size: 12px; font-weight: 500; white-space: nowrap; }
.secundario .ic { width: 13px; height: 13px; }

.modos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; padding: 3px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-sunk); }
.modos button { height: 32px; min-width: 0; border: 0; border-radius: 6px; background: transparent; color: var(--fg-subtle); font-size: 12.5px; font-weight: 500; }
.modos button[aria-checked="true"] { background: var(--bg-active); box-shadow: var(--activo-sombra); color: var(--fg); font-weight: 600; }
:root[data-tema="claro"] .modos button[aria-checked="true"] { background: var(--bg-el); }

.lista, .brief { display: flex; flex-direction: column; gap: 10px; }
.brief { gap: 4px; }
.plantilla { display: flex; align-items: flex-start; gap: 12px; width: 100%; padding: 12px 14px; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--fg); }
.plantilla:hover { border-color: var(--border-strong); }
.plantilla[aria-checked="true"] { border-color: var(--fg); background: var(--bg-hover); }
.plantilla .icono { width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-sunk); display: grid; place-items: center; color: var(--fg-muted); }
.plantilla .texto { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.plantilla .texto strong { font-size: 13.5px; font-weight: 600; }
.plantilla .texto small { font-size: 12px; line-height: 1.4; color: var(--fg-muted); }
.marca { width: 18px; height: 18px; flex-shrink: 0; border-radius: 999px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; }
.plantilla[aria-checked="true"] .marca { border: 0; background: var(--fg); color: var(--bg); }
.campo { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; min-width: 0; }
.campo .fila small { margin-left: auto; font-size: 11.5px; color: var(--fg-subtle); text-align: right; }
.campo textarea, .campo input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-sunk); color: var(--fg); font: inherit; font-size: 13px; line-height: 1.5; outline: none; }
.campo textarea { resize: vertical; height: 108px; }
.campo .contador { align-self: flex-end; color: var(--fg-subtle); }
.enviar { display: flex; align-items: center; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.enviar .nota { font-size: 11.5px; color: var(--fg-muted); flex: 1; min-width: 180px; }

.ok { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--success-bg); flex-wrap: wrap; }
.ok .bola { width: 22px; height: 22px; flex-shrink: 0; border-radius: 999px; background: var(--success); color: var(--bg); display: grid; place-items: center; }
.ok .texto { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.ok .texto strong { font-size: 13px; font-weight: 600; }
.ok .texto small { font-size: 12px; color: var(--fg-muted); }
.ok .lbl { overflow-wrap: anywhere; }
.paso { margin-top: 4px; }
pre.prompt { margin: 0; max-height: 220px; overflow: auto; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-sunk); color: var(--fg-muted); font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.centro { margin: -2px 0 0; font-size: 11.5px; color: var(--fg-muted); text-align: center; }
.conectores { display: flex; gap: 8px; flex-wrap: wrap; }
.conector { flex: 1; min-width: 150px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); font-size: 12.5px; }
.conector .ic { width: 14px; height: 14px; color: var(--fg-muted); }
.conector .copiar-url { margin-left: auto; width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: var(--fg-muted); }

.trabajo { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex-shrink: 0; background: var(--bg-el); }
.trabajo .cabeza { display: flex; flex-direction: column; gap: 7px; padding: 12px 12px 10px; min-width: 0; }
.trabajo .cabeza strong { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.trabajo .estado { display: flex; align-items: center; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.pieza { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 12px; border-top: 1px solid var(--border-faint); color: inherit; text-decoration: none; min-width: 0; }
.pieza .nombre { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.pieza .nombre .t { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pieza .nombre .lbl { overflow-wrap: anywhere; }
.pieza > .ic { width: 14px; height: 14px; color: var(--fg-muted); }
.pieza a.ir { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 6px; color: var(--fg-muted); flex-shrink: 0; }
.pieza a.ir:hover { background: var(--bg-hover); color: var(--fg); }
.wss { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.wsx { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 5px 12px; border-top: 1px solid var(--border-faint); min-width: 0; }
.wsx:first-child { border-top: 0; }
.wsx .nombre { flex: 1; min-width: 0; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wsx[data-estado="reconectar"] .nombre { color: var(--fg-muted); }
.bandeja { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-el); }
.bandeja .pieza:first-child { border-top: 0; }

/* Ola 2: tickets, feedback y Soporte. El texto de clientes se parte donde haga falta: nunca ensancha la página. */
.lista-tickets { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-el); }
.ticket { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; border-top: 1px solid var(--border-faint); background: transparent; color: inherit; text-align: left; font: inherit; min-width: 0; }
.lista-tickets > .ticket:first-child { border-top: 0; }
button.ticket:hover { background: var(--bg-hover); }
.ticket .nombre { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.ticket .nombre .t { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket .nombre .lbl { overflow-wrap: anywhere; }
.bandeja .pieza.ticket { border-top: 1px solid var(--border-faint); }
.bandeja .pieza.ticket:first-child { border-top: 0; }
.ticket-cab { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ticket-cab strong { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.hilo { display: flex; flex-direction: column; gap: 8px; }
.mensaje { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg-el); min-width: 0; }
.mensaje.soporte { background: var(--info-bg); border-color: transparent; }
.mensaje .texto { margin: 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.acciones input { flex: 1; min-width: 160px; height: 30px; padding: 0 10px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-sunk); color: var(--fg); font: inherit; font-size: 12px; }
.campo select { width: 100%; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--bg-sunk); color: var(--fg); font: inherit; font-size: 13px; }
.modos.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modos.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fila > .secundario.der { margin-left: auto; }

/* Ola 3: el Retro por producto (Soporte). */
.modos.siete { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.modos.siete button { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-grupos { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg-el); }
.grupo { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border-faint); min-width: 0; }
.grupo:first-child { border-top: 0; }
.grupo .fila { flex-wrap: wrap; }
.grupo .nombre { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.grupo .nombre .t { font-size: 12.5px; overflow-wrap: anywhere; }
.grupo .nombre .lbl, .grupo .meta { overflow-wrap: anywhere; }
.grupo .veces { font-family: 'Space Mono', ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; min-width: 28px; text-align: right; }
.grupo[data-asunto="true"] .veces { color: var(--warn); }

/* Workspaces (doc 54, ola 4): una ficha por workspace, con bloques que se apilan en móvil. */
.lista-ws { display: flex; flex-direction: column; gap: 12px; }
.ws-ficha { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-el); padding: 12px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ws-ficha .cabeza { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ws-ficha .cabeza strong { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.ws-ficha .cabeza .lbl { overflow-wrap: anywhere; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 10px; min-width: 0; }
.bloque { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px; border-radius: 8px; background: var(--bg-sunk); }
.bloque .meta { overflow-wrap: anywhere; }
.datos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.datos li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.datos .t, .datos .lbl { overflow-wrap: anywhere; }
.datos .t { font-size: 12.5px; }
.enlace { all: unset; cursor: pointer; font-size: 12.5px; color: var(--fg); text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.enlace:focus-visible { outline: 2px solid var(--info); outline-offset: 2px; }
@media (max-width: 640px) {
  .cab { padding: 14px 16px 10px; }
  /* Siete pestañas con Workspaces y Soporte: filas de tres. */
  .pestanas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; padding: 0; }
  .pestana[hidden] { display: none; }
  .pestana { height: 44px; justify-content: center; }
  .cuerpo { padding: 14px 16px; }
  .modos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modos.tres { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .modos.tres button { font-size: 12px; }
  .modos.siete { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .modos button { height: 38px; font-size: 13px; }
  .pieza a.ir { width: 44px; height: 44px; }
}
