/* Canal beta (se retira). Usa los colores y la tipografía de tokens.css. */
:root {
  --bg: var(--fondo); --card: var(--panel); --soft: var(--panel-2); --fg: var(--texto); --muted: var(--tenue);
  --line: var(--linea); --accent: var(--verde); --accent-fg: var(--tinta); --ok: var(--verde); --warn: var(--oro);
  --bad: var(--rojo); --dm: var(--seleccion); --mine: var(--ok-fondo); --focus: var(--foco); --radius: 0;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--fg);
  font: var(--t-m)/1.5 var(--mono);
}
[hidden] { display: none !important; }
a { color: var(--accent); }
code, pre { font-family: var(--mono); font-size: 13px; }
pre { background: var(--soft); border: 1px solid var(--line); border-radius: 0; padding: 10px 12px; overflow-x: auto; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 18px; letter-spacing: -0.01em; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin-bottom: 12px; }
h3 { font-size: 13px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: 16px; top: -48px; background: var(--fg); color: var(--bg); padding: 8px 12px; border-radius: 0; z-index: 10; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.top {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 2px solid var(--line); background: var(--fondo-barra);
}
.sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.session { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 14px; }
.sync { color: var(--muted); font-size: 13px; }

.alert {
  margin: 12px 16px 0; padding: 10px 14px; border-radius: 0;
  border: 1px solid var(--bad); color: var(--bad); background: var(--card);
}
.alert.info { border-color: var(--ok); color: var(--ok); }

main { padding: 16px; outline: none; }
.card { background: var(--card); border: 2px solid var(--line); border-radius: 0; padding: 16px; min-width: 0; }

.login { max-width: 460px; margin: 40px auto; border-color: var(--lila); box-shadow: var(--s-3) var(--sombra-lila); }
.login h2 { font-size: 20px; text-transform: none; letter-spacing: -0.01em; color: var(--fg); margin-bottom: 6px; }
.cli { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.cli summary { cursor: pointer; font-weight: 600; }

.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field.inline { grid-template-columns: auto 1fr; align-items: center; gap: 8px; }
label { font-weight: 600; font-size: 14px; }
.help { margin: 0; font-size: 13px; color: var(--muted); }
input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; background: var(--bg); border: 2px solid var(--linea-fuerte); border-radius: 0; padding: 9px 10px; min-height: 42px;
}
textarea { resize: vertical; }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }
button {
  min-height: 40px; padding: 8px 14px; border-radius: 0; border: 2px solid transparent; cursor: pointer; font-weight: 600;
  transition: transform var(--dur-tic) var(--paso-corto), box-shadow var(--dur-tic) var(--paso-corto);
}
button:hover:not(:disabled) { transform: translate(-2px, -2px); }
button:active:not(:disabled) { transform: translate(2px, 2px); }
button:disabled { opacity: .55; cursor: progress; }
.primary { background: var(--accent); color: var(--accent-fg); }
.secondary { background: var(--soft); border-color: var(--line); }
.ghost { background: transparent; border-color: var(--linea-fuerte); }
.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.actions .muted { margin-right: auto; }

/* Layout principal */
.app {
  display: grid; gap: 16px;
  grid-template-columns: 240px minmax(0, 1fr) minmax(0, 1.25fr);
  grid-template-areas: "agents chat board";
  align-items: start;
}
.agents { grid-area: agents; }
.chat { grid-area: chat; display: flex; flex-direction: column; max-height: calc(100vh - 120px); position: sticky; top: 16px; }
.board { grid-area: board; }

.agent-list { list-style: none; margin: 0 0 10px; padding: 0; }
.agent-list li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); }
.agent-list li:last-child { border-bottom: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line); transform: translateY(-1px); }
.dot.on { background: var(--ok); }
.agent-name { font-weight: 600; word-break: break-all; }
.agent-seen { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }

.feed { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; flex: 1; min-height: 200px; }
.msg { padding: 8px 10px; border-radius: 0; margin-bottom: 6px; border: 1px solid transparent; }
.msg.dm { background: var(--dm); border-color: var(--line); }
.msg.mine { background: var(--mine); }
.msg-meta { font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; }
.msg-meta strong { color: var(--fg); }
.msg-text { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 0; border: 1px solid var(--line); color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.composer { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 12px; }

.board-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; }
.board-head h2 { margin: 0; }
.task-form { background: var(--soft); border: 1px solid var(--line); border-radius: 0; padding: 12px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 10px; }

.columns { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.column { background: var(--soft); border-radius: 0; padding: 10px; min-width: 0; }
.column h3 { display: flex; justify-content: space-between; margin-bottom: 8px; }
.column ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.task { background: var(--card); border: 1px solid var(--line); border-radius: 0; padding: 10px; }
.task.state-blocked { border-color: var(--warn); }
.task.state-review { border-color: var(--accent); }
.task-id { font: 600 12px ui-monospace, Consolas, monospace; color: var(--muted); word-break: break-all; }
.task-title { margin: 2px 0 6px; font-weight: 600; overflow-wrap: anywhere; }
.task dl { margin: 0; font-size: 13px; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; }
.task dt { color: var(--muted); }
.task dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.task .actions { justify-content: flex-start; margin-top: 8px; }
.task .actions button { min-height: 34px; padding: 5px 10px; font-size: 13px; }

dialog { border: 1px solid var(--line); border-radius: 0; background: var(--card); color: var(--fg); padding: 18px; width: min(480px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / .45); }
dialog h2 { font-size: 17px; text-transform: none; letter-spacing: 0; color: var(--fg); margin-bottom: 4px; }

@media (max-width: 1180px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "agents chat" "board board"; }
}
@media (max-width: 760px) {
  main { padding: 12px 16px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "chat" "agents" "board"; }
  .chat { position: static; max-height: none; }
  .feed { max-height: 60vh; }
  .grid2 { grid-template-columns: 1fr; }
  .columns { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

h1 .volver { color: inherit; text-decoration: none; }
h1 .volver:hover { text-decoration: underline; }
.primary { box-shadow: var(--s-1) var(--sombra-boton); }

.top .volver { color: var(--texto); text-decoration: none; letter-spacing: .04em; }
.top .volver:hover { color: var(--texto-fuerte); }
