:root{
  --bg:#050505; --panel:#0d0e0e; --line:#262827; --line2:#3a3d3b;
  --text:#e9e8e3; --muted:#8d908c; --accent:#ffffff; --ok:#5DCAA5; --warn:#EF9F27; --danger:#F09595;
  --mono:ui-monospace,"Cascadia Mono",Consolas,monospace;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--text);font:14px/1.55 system-ui,"Segoe UI",sans-serif}
body{display:flex;flex-direction:column;min-height:100dvh}
.muted{color:var(--muted)} .small{font-size:12px} .danger{color:var(--danger)}
.brand{font-weight:500;letter-spacing:.32em} .brand.big{font-size:26px;margin-bottom:4px}

.bar{display:flex;align-items:center;gap:16px;padding:10px 16px;border-bottom:1px solid var(--line);padding-top:max(10px,env(safe-area-inset-top))}
.bar .muted{flex:1;font-size:12px;font-family:var(--mono)}
.pill{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--muted)}
.dot{width:8px;height:8px;border-radius:50%;background:var(--muted);display:inline-block}
.pill.ok .dot{background:var(--ok)} .pill.err .dot{background:var(--danger)}

.grid{flex:1;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.6fr) minmax(0,1fr);gap:12px;padding:12px;min-height:0}
.col{display:flex;flex-direction:column;gap:12px;min-height:0}
.panel{background:var(--panel);border:1px solid var(--line);border-radius:10px;padding:12px 14px}
h2{margin:0 0 8px;font-size:11px;font-weight:500;letter-spacing:.14em;text-transform:uppercase;color:var(--muted)}
.text{white-space:pre-wrap;font-size:13px}
.list{list-style:none;margin:0;padding:0}
.list li{display:flex;justify-content:space-between;gap:10px;padding:6px 0;border-top:1px solid var(--line);font-size:13px}
.list li:first-child{border-top:0}
.list li>span:first-child{min-width:0;overflow-wrap:anywhere}
.list .tag{font-family:var(--mono);font-size:11px;color:var(--muted);white-space:nowrap}
.tag.warn{color:var(--warn)} .tag.ok{color:var(--ok)}
.list button{background:none;border:1px solid var(--line2);color:var(--muted);border-radius:6px;font-size:11px;padding:1px 8px;cursor:pointer}
.list button:hover{color:var(--text);border-color:var(--muted)}
.empty{color:var(--muted)}

.center{min-height:0}
.core{position:relative;height:clamp(280px,46vh,520px)}
.core canvas{display:block;width:100%;height:100%}
.core-label{position:absolute;left:0;right:0;bottom:2px;text-align:center;font-size:11px;letter-spacing:.2em;text-transform:uppercase;color:var(--muted)}
.chat{flex:1;display:flex;flex-direction:column;min-height:260px}
.log{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:10px;padding-bottom:8px;max-height:46vh}
.msg{max-width:92%;font-size:14px;white-space:pre-wrap;overflow-wrap:anywhere}
.msg .who{display:block;font-size:10px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);margin-bottom:1px}
.msg.user{align-self:flex-end;text-align:right}
.msg.kerr .body{border-left:2px solid var(--line2);padding-left:10px}
.msg.aviso .body{border-left:2px solid var(--ok);padding-left:10px}
.msg.error .body{border-left:2px solid var(--danger);padding-left:10px;color:var(--danger)}
.form{border-top:1px solid var(--line);padding-top:10px}
.modes{display:flex;gap:6px;margin-bottom:8px}
.chip{background:none;border:1px solid var(--line2);color:var(--muted);border-radius:999px;font-size:12px;padding:2px 12px;cursor:pointer}
.chip.on{color:#000;background:var(--accent);border-color:var(--accent)}
.row{display:flex;gap:8px}
.chip.voz{margin-left:auto}
.chip.voz:not(.on){opacity:.6}
.mic{width:44px;flex:none;background:#000;border:1px solid var(--line2);border-radius:8px;color:var(--text);cursor:pointer;display:flex;align-items:center;justify-content:center}
.mic:hover:not(:disabled){border-color:var(--muted)}
.mic:disabled{opacity:.35;cursor:not-allowed}
.mic.on{border-color:hsl(165,65%,60%);color:hsl(165,65%,70%);box-shadow:0 0 0 3px hsla(165,65%,60%,.2)}
input[type=text],input[type=password]{flex:1;min-width:0;background:#000;border:1px solid var(--line2);border-radius:8px;color:var(--text);padding:10px 12px;font:inherit}
input:focus{outline:2px solid #fff;outline-offset:1px}
button[type=submit]{background:var(--accent);color:#000;border:0;border-radius:8px;padding:0 18px;font:inherit;font-weight:500;cursor:pointer}
button[type=submit]:disabled{opacity:.5;cursor:wait}

.bar-bg{height:6px;background:var(--line);border-radius:3px;margin:4px 0 6px}
.bar-fg{height:6px;border-radius:3px;background:var(--ok);width:0;transition:width .4s}
.bar-fg.warn{background:var(--warn)} .bar-fg.bad{background:var(--danger)}

.overlay{position:fixed;inset:0;background:rgba(0,0,0,.94);display:flex;align-items:center;justify-content:center;z-index:10}
.overlay[hidden]{display:none}
.login{width:min(340px,86vw);display:flex;flex-direction:column;gap:12px;text-align:center}
.login input{flex:none;text-align:center}
.login button{padding:10px}

@media (min-width:901px){
  html,body{height:100dvh;overflow:hidden}
  .grid{overflow:hidden}
  .col{overflow-y:auto;overflow-x:hidden}
  .log{max-height:none}
}
@media (max-width:900px){
  .grid{display:flex;flex-direction:column;flex:none}
  .col{flex:none}
  .center{order:-1} .left{order:1} .right{order:2}
  .core{height:270px}
  .chat{flex:none;min-height:0}
  .log{max-height:42vh;min-height:140px}
}
@media (prefers-reduced-motion:reduce){*{transition:none!important}}
