/* Colours live in tokens.css, which every page includes first. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

h1 { font-size: 17px; margin: 0 0 4px; }
h2 { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h3 { font-size: 13px; margin: 0; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 20px; }
.error { color: var(--bad); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sep { color: var(--line); }

/* ---- chrome ---- */

#bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.dot.live { background: var(--accent); }

#gate { display: flex; align-items: center; justify-content: center; flex: 1; }
#gate form { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 24px; width: 380px; }
#gate input { width: 100%; margin: 12px 0; }
#gate button { width: 100%; }

#main { display: flex; flex: 1; min-height: 0; }

/* ---- queue ---- */

#queue-panel {
  width: 340px; flex: 0 0 340px; border-right: 1px solid var(--line);
  background: var(--panel); display: flex; flex-direction: column; min-height: 0;
}
.panel-head { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px 8px; }
.panel-head h2 { margin: 0; }
.panel-foot { padding: 10px 16px; border-top: 1px solid var(--line); font-size: 12px; }
#queue { list-style: none; margin: 0; padding: 0 8px 8px; overflow-y: auto; flex: 1; }
#queue li {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  margin-bottom: 4px;
}
#queue li:hover { background: var(--panel-2); }
#queue li.sel { background: var(--panel-2); border-color: var(--line); }
#queue li.taken { opacity: .55; }
#queue li.urgent .age { color: var(--warn); }
.q-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.q-sum { margin-top: 4px; word-break: break-word; }
.q-snip { font-size: 12px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- work area ---- */

#work { flex: 1; overflow-y: auto; min-height: 0; }
.request, #request { padding: 20px 24px 60px; max-width: 900px; }
.req-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.meta { font-size: 12px; margin-top: 6px; }
.clock { font-family: var(--mono); font-size: 22px; text-align: right; }
.clock.warn { color: var(--warn); }
.clock.bad { color: var(--bad); }
.req-clock { text-align: right; flex: 0 0 auto; }

.bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; margin: 16px 0;
}
.bar.mine { border-color: #2c4a33; background: #16211a; }

.block { border-top: 1px solid var(--line); padding: 16px 0; }
.block > details > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.block > h2 { margin-bottom: 12px; }

.label { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; margin: 12px 0 4px; }

pre.transcript, .transcript {
  font-family: var(--mono); font-size: 12.5px; white-space: pre-wrap; word-break: break-word;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 4px 0;
}
.msg { border-left: 2px solid var(--line); padding-left: 12px; margin: 14px 0; }
.msg.user { border-color: #3b6ea5; }
.msg.assistant { border-color: #4a5f3f; }
.msg-role { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.block-tools { font-family: var(--mono); font-size: 12.5px; color: #b8c6d8; }
.block-thinking { color: var(--muted); font-style: italic; }

/* ---- tools ---- */

.tool {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin: 10px 0;
}
.tool-name { font-family: var(--mono); font-size: 13px; }
.tool-desc { white-space: pre-wrap; word-break: break-word; font-size: 13px; margin-top: 6px; }
.tool details summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 8px; }
.tool pre { max-height: 320px; overflow: auto; }

/* ---- forms ---- */

textarea, input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%; background: var(--bg); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 10px; font: inherit;
}
textarea#response { font-family: var(--mono); font-size: 13.5px; }
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: #3d6b8f; }

button {
  background: var(--panel-2); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer;
}
button:hover:not(:disabled) { border-color: #46505f; }
button:disabled { opacity: .45; cursor: default; }
button.primary { background: #1f6f3f; border-color: #2c8a52; font-weight: 600; }
button.primary:hover:not(:disabled) { background: #248046; }
button.ghost { background: transparent; }
button.link { background: none; border: none; color: var(--muted); text-decoration: underline; padding: 0; }

.field { margin: 10px 0; }
.field-label { font-size: 12.5px; margin-bottom: 3px; }
.field-label .req { color: var(--warn); }
.field-help { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.field.invalid input, .field.invalid textarea, .field.invalid select { border-color: var(--bad); }

.call { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin: 10px 0; }
.call-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.call-head .tool-name { font-weight: 600; }
.call-id { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.call pre { margin: 8px 0 0; }

.meter { margin-top: 14px; }
.meter-track { height: 5px; background: var(--panel-2); border-radius: 3px; overflow: hidden; }
#meter-fill { height: 100%; width: 0; background: var(--accent); transition: width .12s linear; }
#meter-fill.over { background: var(--bad); }
.stop-row { margin-top: 14px; max-width: 320px; }
.actions { margin-top: 18px; }
