/* Chat demo: layout of the two columns, the rule switches, the inbox and the chat details. */

[hidden] { display: none !important; }
.chat-col { display: flex; flex-direction: column; gap: 20px; }
.side { display: flex; flex-direction: column; gap: 20px; }
.chat-panel .chatlog { min-height: 250px; max-height: min(60vh, 620px); }
.chat-panel .composer input { flex: 1; min-width: 0; }

/* Messages */
.msg .meta { margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; white-space: normal; }
.msg.sys { max-width: 92%; text-align: center; white-space: normal; line-height: 1.5; }
.msg.sys.hl { color: var(--ink-2); }
.msg.sys .linkish { font: inherit; font-weight: 700; color: var(--gold-deep); background: none; border: 0; padding: 0 0 0 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.msg.bot.typing { color: var(--ink-3); }
.msg.bot.typing .dots::after { content: ''; animation: dl-dots 1.2s steps(4) infinite; }
@keyframes dl-dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.msg.in { animation: dl-in 0.25s ease-out both; }
@keyframes dl-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Suggestions */
.try { border-top: 1px solid var(--line-soft); padding: 14px 16px 16px; display: grid; gap: 10px; }
.try-hd { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; font-size: 11px; }
.try-hd .lbl { font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.suggest button { display: grid; gap: 4px; flex: 1 1 260px; max-width: 100%; line-height: 1.45; }
.suggest button .k { font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold-deep); }
.suggest button[disabled] { opacity: 0.5; cursor: wait; }

/* Rules */
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 0 0 14px; font-size: 11px; }
.legend div { display: flex; gap: 6px; align-items: baseline; }
.legend dt { font-weight: 700; white-space: nowrap; }
.legend dd { margin: 0; color: var(--ink-2); }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.rule { padding: 12px 0; border-top: 1px solid var(--line-softer); display: grid; gap: 8px; }
.rule:first-child { border-top: 0; padding-top: 0; }
.rule .name { font-weight: 700; font-size: 12.5px; }
.rule .detail { font-size: 11px; color: var(--ink-3); }
.rule.flash { animation: dl-flash 0.9s ease-out; }
@keyframes dl-flash { from { background: var(--gold-tint); } to { background: transparent; } }
.seg { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); }
.seg button { font-family: inherit; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.25;
  min-height: 32px; padding: 6px 4px; border: 0; border-left: 1px solid var(--line-soft); background: var(--paper); color: var(--ink-2); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button:hover { background: var(--paper-2); color: var(--ink); }
.seg button[aria-checked="true"] { color: var(--paper); }
.seg button[aria-checked="true"].s-apagada { background: var(--ink-3); }
.seg button[aria-checked="true"].s-prueba { background: var(--warn); }
.seg button[aria-checked="true"].s-aprobar { background: var(--gold); color: var(--ink); }
.seg button[aria-checked="true"].s-en_marcha { background: var(--signal); }
.seg.locked { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 32px; border-style: dashed; border-color: var(--line-soft);
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2); background: var(--paper-2); }
.legend .s-apagada { color: var(--ink-3); } .legend .s-prueba { color: var(--warn); }
.legend .s-aprobar { color: var(--gold-deep); } .legend .s-en_marcha { color: var(--signal); }

/* Trace */
.empty { margin: 0; font-size: 12px; }
.trace li.in { animation: dl-in 0.3s ease-out both; }
.trace li .chip { margin-left: 6px; vertical-align: 1px; }
.trace li .n { color: var(--ink-3); margin-right: 4px; }
.trace li pre { max-height: 150px; }

/* Inbox */
.inbox { display: grid; gap: 12px; }
.inbox .item { border: 1px solid var(--line-soft); padding: 12px 14px; display: grid; gap: 6px; font-size: 12px; }
.inbox .item.approval { border-color: var(--gold); }
.inbox .item.new { animation: dl-flash 1.2s ease-out; }
.inbox .row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.inbox .ref { font-size: 11px; color: var(--ink-3); }
.inbox .ttl { font-weight: 700; font-size: 12.5px; }
.inbox .note { margin: 0; color: var(--ink-2); line-height: 1.5; overflow-wrap: anywhere; }
.inbox .res { margin: 0; font-size: 11.5px; font-weight: 700; }
.inbox .res.ok { color: var(--signal); } .inbox .res.err { color: var(--err); }

@media (max-width: 760px) {
  .legend { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .suggest button { flex-basis: 100%; }
  .chat-panel > .hd { flex-wrap: wrap; }
}
