:root {
  --bg: #0a0e14;
  --panel: #111824;
  --line: #1e2a3a;
  --txt: #cfe3ff;
  --dim: #6f8198;
  --accent: #21d4fd;
  --accent2: #2a7fff;
  --user: #16314f;
  --warn: #ff5d5d;
  --ok: #2ee6a6;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #12233b 0%, var(--bg) 60%);
  color: var(--txt);
  font: 15px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  display: flex; flex-direction: column;
}

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: rgba(10,14,20,.7); backdrop-filter: blur(6px);
}
.brand { font-weight: 800; letter-spacing: 3px; color: var(--accent); text-shadow: 0 0 16px rgba(33,212,253,.5); }
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pill { font-size: 12px; color: var(--dim); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
.pill.on { color: var(--ok); border-color: rgba(46,230,166,.4); }
.pill.off { color: var(--warn); border-color: rgba(255,93,93,.3); }
select, button { font: inherit; color: var(--txt); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.toggle.on { color: var(--bg); background: var(--accent); border-color: var(--accent); }
#mic.live { background: var(--warn); border-color: var(--warn); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,93,93,.5); } 50% { box-shadow: 0 0 0 8px rgba(255,93,93,0); } }

main { flex: 1; display: flex; min-height: 0; }
.chat { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 760px; padding: 10px 14px; border-radius: 12px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--user); border: 1px solid #244b73; }
.msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg.sys { align-self: center; color: var(--dim); font-size: 13px; font-family: ui-monospace, monospace; background: transparent; border: 1px dashed var(--line); max-width: 90%; }
.tool { align-self: flex-start; font-size: 12px; color: var(--accent); }
.filecard { display: flex; flex-direction: column; gap: 6px; }
.filecard img { max-width: 280px; max-height: 280px; border-radius: 8px; border: 1px solid var(--line); }
.filecard .dl { color: var(--accent); text-decoration: none; font-size: 14px; }
.box pre { cursor: text; }
.cursor::after { content: '▌'; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.view { width: 340px; border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; }
.view.hidden { display: none; }
.view-head { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; color: var(--dim); border-bottom: 1px solid var(--line); }
.view img { width: 100%; height: auto; }
.x { border: none; background: transparent; color: var(--dim); padding: 0 6px; }

footer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: rgba(10,14,20,.7); }
#input { flex: 1; resize: none; max-height: 160px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--txt); padding: 10px 12px; }
#send { background: linear-gradient(180deg, var(--accent), var(--accent2)); color: #04121f; font-weight: 700; border: none; padding: 0 20px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; }
.modal.hidden { display: none; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; width: min(520px, 92vw); }
.box .title { font-weight: 700; margin-bottom: 8px; color: var(--warn); }
.box pre { white-space: pre-wrap; background: #0c121b; border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: var(--txt); }
.row { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.btn-allow { background: var(--ok); color: #04121f; border: none; font-weight: 700; }
.btn-deny { background: transparent; border: 1px solid var(--line); }
