:root {
  --blue: #1b365d; --blue-50: #122745; --red: #af272f; --cyan: #00a6bd;
  --bg: #f6f7f9; --line: #e0e0e0; --muted: #636363;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { font-family: system-ui, "Segoe UI", sans-serif; background: var(--bg); color: var(--blue); }

header {
  background: var(--blue); color: #fff; padding: 12px 20px;
  display: flex; align-items: center; gap: 10px;
}
header .logo b { color: #fff; }
header .logo .r { color: #ff6b73; font-style: italic; font-weight: 900; }
header .logo { font-weight: 800; font-size: 18px; }
header .tag { color: rgba(255,255,255,.7); font-size: 13px; }

main {
  display: flex; align-items: stretch;
  padding: 12px; height: calc(100vh - 49px);
}
/* A column that stacks two panes vertically (with a horizontal splitter). */
.col {
  display: flex; flex-direction: column; align-items: stretch;
  flex: 0 0 auto; min-width: 150px;
}
.pane {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  display: flex; flex-direction: column; overflow: hidden;
  min-height: 0; min-width: 150px; flex: 0 0 auto;
}

/* Draggable splitters. data-axis="x" resizes width, "y" resizes height. */
.gutter { position: relative; align-self: stretch; }
.gutter[data-axis="x"] { flex: 0 0 10px; cursor: col-resize; }
.gutter[data-axis="y"] { flex: 0 0 10px; cursor: row-resize; }
.gutter::after {
  content: ""; position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%); background: var(--line);
  border-radius: 3px; transition: background .15s;
}
.gutter[data-axis="x"]::after { width: 3px; height: 38px; }
.gutter[data-axis="y"]::after { width: 38px; height: 3px; }
.gutter:hover::after, .gutter.active::after { background: var(--cyan); }
.gutter[data-axis="x"]:hover::after, .gutter[data-axis="x"].active::after { height: 60px; }
.gutter[data-axis="y"]:hover::after, .gutter[data-axis="y"].active::after { width: 60px; }
body.resizing { user-select: none; }
.pane h2 {
  font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); margin: 0; padding: 12px 14px; border-bottom: 1px solid #f2f2f2;
}
.pane h2.divider { border-top: 1px solid var(--line); }
.scroll { flex: 1; overflow-y: auto; padding: 12px 14px; min-height: 0; }

/* Chat */
.msg { display: flex; margin-bottom: 10px; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 86%; padding: 10px 14px; border-radius: 14px; font-size: 15.5px;
  line-height: 1.5; white-space: pre-wrap; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.msg.user .bubble { background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot .bubble { background: #eef1f5; color: #16243a; border-bottom-left-radius: 4px; }
.chips { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 8px; }
.chip {
  text-align: left; background: #fff; border: 1px solid var(--blue);
  color: var(--blue); border-radius: 12px; padding: 8px 11px; font: inherit;
  font-size: 12.5px; line-height: 1.3; cursor: pointer; transition: all .12s;
}
.chip:hover { background: var(--blue); color: #fff; }

.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px; padding: 10px 14px;
  font: inherit; outline: none;
}
.composer input:focus { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan); }
.composer button {
  background: var(--red); color: #fff; border: 0; border-radius: 999px;
  padding: 0 18px; font-weight: 700; cursor: pointer;
}
.composer button:disabled { background: #c1c1c1; cursor: not-allowed; }
.composer .iconbtn {
  background: #eef1f5; color: var(--blue); border: 0; border-radius: 999px;
  width: 38px; min-width: 38px; height: 38px; padding: 0; font-size: 16px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.composer .iconbtn:hover { background: #e2e8f1; }

/* Staged image preview chip */
.attach-preview {
  display: flex; align-items: center; gap: 8px; margin: 0 10px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px;
  background: #f8fafc;
}
.attach-preview img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex: none; }
.attach-name { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.attach-clear { border: 0; background: #e6e9ee; color: var(--blue); border-radius: 999px; width: 22px; height: 22px; cursor: pointer; flex: none; }
.attach-clear:hover { background: var(--red); color: #fff; }

/* Photo inside a user bubble */
.user-photo img { display: block; max-width: 200px; max-height: 200px; border-radius: 8px; margin-bottom: 4px; }

/* Mic button states */
.mic.idle:hover { background: #e2e8f1; }
.mic.listening { background: #fde2e2; color: var(--red); animation: micpulse 1s infinite; }
.mic.thinking  { background: #fff4d6; color: #8a6d00; }
.mic.speaking  { background: #d8f5e3; color: #166f3e; }
.mic.unsupported { opacity: .45; cursor: not-allowed; }
@keyframes micpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(175,39,47,.4); } 50% { box-shadow: 0 0 0 5px rgba(175,39,47,0); } }

/* Hands-free toggle bar */
.voice-bar { display: flex; align-items: center; gap: 12px; padding: 6px 12px 2px; }
.voice-switch { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); cursor: pointer; user-select: none; }
.voice-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.voice-switch .slider { width: 34px; height: 18px; border-radius: 999px; background: #cfd6df; position: relative; transition: background .15s; flex: none; }
.voice-switch .slider::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.voice-switch input:checked + .slider { background: var(--cyan); }
.voice-switch input:checked + .slider::after { transform: translateX(16px); }
.voice-state { font-size: 12px; color: var(--blue); font-weight: 600; }

/* Services + activity */
.svc-group { border-bottom: 1px solid #f4f4f4; }
.svc { display: flex; align-items: center; gap: 8px; padding: 7px 4px; font-size: 13px; }
.svc.expandable { cursor: pointer; border-radius: 6px; }
.svc.expandable:hover { background: #f4f7fb; }
.svc-name { font-weight: 600; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; flex: none; }
.dot.a2a { background: var(--cyan); }
.caret { color: var(--muted); font-size: 10px; width: 10px; transition: transform .15s; }
.svc-group.open .caret { transform: rotate(90deg); }
.kind { color: var(--muted); font-size: 11px; margin-left: auto; text-transform: uppercase; }
.tools { display: none; padding: 2px 0 8px 26px; }
.svc-group.open .tools { display: block; }
.tool {
  font-family: ui-monospace, monospace; font-size: 12px; color: #4a5568;
  padding: 3px 6px; border-radius: 5px; cursor: default;
}
.tool:hover { background: #eef4fb; color: var(--cyan); }
.section-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing:.05em; margin: 14px 0 6px; }
.act { font-family: ui-monospace, monospace; font-size: 12px; padding: 5px 8px; border-bottom: 1px solid #f4f4f4; }
.act .name { color: var(--cyan); font-weight: 700; }
.act.err .name { color: var(--red); }
.act .ms { color: var(--muted); float: right; }
.act .sum { color: #555; }

/* A2A task card */
.task { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-top: 8px; }
.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; background: #eef1f5; color: var(--blue); text-transform: uppercase;
}
.badge.working { background: #fff4d6; color: #8a6d00; }
.badge.completed { background: #d8f5e3; color: #166f3e; }
.badge.failed { background: #fbe0e2; color: var(--red); }
.task .step { font-size: 12px; color: #555; margin-top: 6px; font-family: ui-monospace, monospace; }

/* Artifact */
#artifact { margin: 0 14px; padding: 12px; font-family: ui-monospace, monospace; font-size: 12px;
  color: #cfe8ff; background: #0f1b2d; border-radius: 8px; overflow-x: auto; white-space: pre; }
#artifact.empty { background: none; }
.hold { background: var(--cyan); color: #04313a; font-weight: 700; padding: 8px 14px; font-size: 13px; }
.empty { color: var(--muted); font-size: 13px; padding: 14px; }

/* Per-step screenshots gallery */
#shots { padding: 0 14px 14px; }
.shot { margin: 0 0 10px; }
.shot img { width: 100%; display: block; border: 1px solid var(--line); border-radius: 6px; }
.shot figcaption {
  font-size: 11px; color: var(--muted); margin: 4px 2px 0;
  font-family: ui-monospace, monospace;
}
.frames { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.frames .shot { margin: 0; }
.frames .shot img { border-radius: 6px; }
