:root {
  --bg: #f7f7f5; --panel: #fff; --ink: #1b1b19; --muted: #6b6b66;
  --line: #e3e3de; --accent: #3b5bdb; --warn: #c2410c; --ok: #15803d;
  --open: #3b5bdb; --claimed: #b45309; --done: #15803d; --escalated: #be123c;
  /* Links are deliberately NOT --accent. No rule styled anchors at all, so the
     run's "log" link fell back to the browser's dark blue -- hard to pick out,
     and --accent is near enough to that same blue to be no improvement. Teal is
     unmistakably not it and still reads as "clickable". 5.5:1 on --panel. */
  --link: #0f766e;
  /* the A, C and E of the wordmark — tune the acronym's colour here only */
  --wordmark-accent: #1b73b0;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17171a; --panel: #1f1f23; --ink: #ececea; --muted: #9a9a94;
    --line: #313138; --accent: #8fa4ff;
    --open: #8fa4ff; --claimed: #e0a252; --done: #6ee7a8; --escalated: #fb7185;
    --link: #5eead4;
    --wordmark-accent: #5cb0e8;
  }
}
* { box-sizing: border-box; }
/* `hidden` is a UA-stylesheet rule, so any author `display` (e.g. .gate below)
   outranks it. Without this, setting el.hidden = true does nothing visible. */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
/* Colour is the weakest of the three cues here. "log" is one short word on a
   dense metadata line, so it carries weight and an underline too: findable at a
   glance, and still findable by someone who cannot tell the colours apart. */
a {
  color: var(--link); font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
a:hover, a:focus-visible { color: var(--ink); }
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 20px; border-bottom: 1px solid var(--line); background: var(--panel);
  position: sticky; top: 0; z-index: 5;
}
h1 { font-size: 15px; margin: 0; letter-spacing: .01em; }
.brand { display: flex; flex-direction: column; gap: 1px; }
.wordmark { font-size: 15px; font-weight: 600; }
/* Stacked, one word per line: the three accented initials sit at the same
   left edge, so the eye reads ACE straight down the column. Tight leading
   keeps three lines from growing the sticky header. */
.wordmark .word { display: block; line-height: 1.12; }
/* the acronym: A, C, E carry the accent, the rest stays header ink */
.wordmark .ace { color: var(--wordmark-accent); }
/* Heavier than the words it starts, so the column reads as an acronym and
   not just as coloured text. */
.wordmark .ace { font-weight: 800; }
.tagline { margin: 0; font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.brand-logo { height: 30px; width: auto; display: block; }
@media (prefers-color-scheme: dark) {
  /* the logo's wordmark is black art on transparent; a light chip keeps it
     readable on the dark panel without touching the rest of the theme */
  .brand-logo { background: #fff; padding: 3px 5px; border-radius: 4px; }
}
h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em;
     color: var(--muted); margin: 0 0 10px; font-weight: 600; }
/* A column so the identity line sits under the logo and the New task button,
   clear of the wordmark on the left however long the agent's name is. */
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.head-controls { display: flex; align-items: center; gap: 12px; }
.identity { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.whoami .who-name { color: var(--ink); font-weight: 600; }
/* A button, because it acts on the session — styled as a link so it does not
   compete with New task for the eye. */
button.linkish {
  padding: 0; border: 0; background: none; color: var(--muted);
  font-size: 11px; text-decoration: underline; cursor: pointer;
}
button.linkish:hover { color: var(--ink); }
/* Not a colour-only cue: the text itself names the agent that would be
   credited, so it reads the same to anyone who cannot see the orange. */
.whoami-warn {
  margin: 0; max-width: 420px; text-align: right; font-size: 11px;
  color: var(--warn); border: 1px solid var(--warn); border-radius: 5px;
  padding: 3px 7px; line-height: 1.35;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--ok); }
main { display: grid; grid-template-columns: 1.15fr .8fr .8fr .85fr .85fr; gap: 14px;
       padding: 16px 20px; align-items: start; }
@media (max-width: 1100px) { main { grid-template-columns: 1fr 1fr; } }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.count { color: var(--muted); font-weight: 400; }
button {
  font: inherit; padding: 5px 11px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--accent); color: #fff; cursor: pointer;
}
button.ghost { background: transparent; color: var(--ink); }
input, textarea, select {
  font: inherit; padding: 6px 8px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink); width: 100%;
}
.status-group { margin-bottom: 14px; }
.status-group > h3 {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  margin: 0 0 6px; color: var(--muted); font-weight: 600;
}
.task {
  border: 1px solid var(--line); border-left: 3px solid var(--open);
  border-radius: 6px; padding: 8px 10px; margin-bottom: 6px; cursor: pointer; background: var(--bg);
}
.task[data-status="claimed"] { border-left-color: var(--claimed); }
.task[data-status="done"] { border-left-color: var(--done); }
.task[data-status="escalated"] { border-left-color: var(--escalated); }
.task[data-status="archived"] { border-left-color: var(--line); opacity: .62; }
.archive-btn { margin-top: 7px; font-size: 11px; padding: 2px 8px; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 12px;
          color: var(--muted); margin-bottom: 9px; cursor: pointer; }
.toggle input { width: auto; }
.task .title { font-weight: 600; }
.task .meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.task .detail { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.task pre.addendum { border-left: 3px solid var(--claimed); }
.task pre { white-space: pre-wrap; word-wrap: break-word; font-size: 12px;
            background: var(--panel); padding: 8px; border-radius: 4px; margin: 6px 0; overflow-x: auto; }
.transcript {
  position: fixed; right: 16px; bottom: 16px; width: min(560px, calc(100vw - 32px));
  max-height: min(60vh, 520px); display: flex; flex-direction: column; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 10px 34px rgba(0,0,0,.22);
}
.transcript-bar {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px;
  border-bottom: 1px solid var(--line); font-size: 13px;
}
.transcript-bar .spacer { flex: 1; }
.transcript-bar button { padding: 3px 9px; font-size: 12px; }
.transcript-body {
  overflow: auto; padding: 8px 12px; font-size: 12px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.tr-row { display: flex; gap: 8px; padding: 2px 0; align-items: baseline; }
.tr-row span:last-child { white-space: pre-wrap; word-break: break-word; min-width: 0; }
.tr-tag {
  flex: 0 0 62px; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); text-align: right;
}
.tr-text span:last-child { color: var(--ink); }
.tr-tool span:last-child { color: var(--accent); }
.tr-meta span:last-child { color: var(--muted); }
.tr-err span:last-child { color: var(--escalated); }
@media (max-width: 700px) {
  .transcript { right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 55vh; }
}
.badge-push {
  font-size: 10px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  background: var(--claimed); color: #fff; border-radius: 3px;
  padding: 1px 5px; margin-left: 7px; vertical-align: middle;
}
.sched { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 13px; opacity: .55; }
.sched[data-enabled="true"] { opacity: 1; }
.sched:last-child { border-bottom: 0; }
.sched-controls { display: flex; gap: 6px; margin-top: 5px; }
.sched-controls button { font-size: 11px; padding: 2px 8px; }
.run { border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 13px; }
.run:last-child { border-bottom: 0; }
.run-status {
  font-size: 10px; text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 5px; border-radius: 3px; background: var(--line); color: var(--ink);
}
.run[data-status="running"] .run-status { background: var(--claimed); color: #fff; }
.run[data-status="finished"] .run-status { background: var(--done); color: #fff; }
.run[data-status="timed_out"] .run-status,
.run[data-status="failed"] .run-status { background: var(--escalated); color: #fff; }
.run pre { white-space: pre-wrap; word-wrap: break-word; font-size: 11px;
           background: var(--bg); padding: 8px; border-radius: 4px; margin-top: 6px;
           max-height: 320px; overflow: auto; }
.msg { border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 13px; }
.msg:last-child { border-bottom: 0; }
.msg .who { font-weight: 600; }
.msg .when { color: var(--muted); font-size: 11px; float: right; }
.esc { border: 1px solid var(--escalated); border-radius: 6px; padding: 10px; margin-bottom: 10px; }
.esc textarea { margin: 6px 0; }
.esc-fields { display: grid; gap: 6px; margin: 8px 0; }
.esc-fields label { display: block; font-size: 11px; color: var(--muted);
                    text-transform: uppercase; letter-spacing: .05em; }
.esc-fields select, .esc-fields input, .esc-fields textarea { margin-top: 2px; }
/* Two rows, because this form lives in a ~230px column: the message input gets
   the whole width, and the recipient select and Send share the row beneath it. */
.stacked-form { display: grid; gap: 6px; margin-bottom: 10px; }
.form-row { display: flex; gap: 6px; }
.form-row select { flex: 1 1 auto; min-width: 0; }
.form-row button { flex: 0 0 auto; }
.filter-row { margin-bottom: 8px; }
.empty { color: var(--muted); font-style: italic; padding: 6px 0; }
.error { color: var(--warn); }
.gate-msg {
  margin: 10px 0 0; padding: 9px 11px; font-size: 13px; line-height: 1.45;
  border-radius: 6px; border: 1px solid var(--warn); color: var(--warn);
  background: color-mix(in srgb, var(--warn) 8%, transparent);
}
.gate-msg.info { border-color: var(--line); color: var(--muted); background: var(--bg); }
.gate-box button[aria-busy="true"] { opacity: .65; cursor: progress; }
.form-msg { color: var(--warn); font-size: 12px; margin: 4px 0 8px; }
/* Same line, opposite news. A confirmation that looked like a warning would
   train people to stop reading either. */
.form-msg.ok { color: var(--ok); }
/* The Connect button's busy treatment, for every button that now has one. */
button[aria-busy="true"] { opacity: .65; cursor: progress; }
.gate { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.gate-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
            padding: 24px; width: 100%; max-width: 380px; }
.gate-box p { color: var(--muted); }
/* The sign-in screen has room to let the stacked name be the whole title. */
.gate-wordmark { font-size: 26px; margin-bottom: 12px; }
.gate-box input { margin-bottom: 10px; }
.gate-box button { width: 100%; }
dialog { border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
         color: var(--ink); max-width: 560px; width: 92%; padding: 20px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog label { display: block; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
dialog .row { display: flex; gap: 10px; }
dialog menu { display: flex; gap: 8px; justify-content: flex-end; padding: 0; margin: 12px 0 0; }
@media (max-width: 700px) {
  main { grid-template-columns: 1fr; padding: 12px; }
  dialog .row { flex-direction: column; }
}
