/* The page CSP forbids style attributes, so every style lives here. */

/* TSS theme: the same tokens as Cockpit and the other apps (cream page, navy for the main action). */
@font-face { font-family: "DM Sans"; src: url("/fonts/dm-sans.woff2") format("woff2"); font-weight: 100 1000; font-style: normal; font-display: swap; }

:root {
  --bg: #F6F4EE;
  --surface: #FFFFFF;
  --surface-2: #F1EEE5;
  --border: #DDD7CA;
  --text: #222724;
  --muted: #5F6861;
  --accent: #0A3269;
  --accent-text: #FFFFFF;
  --danger: #8C1D18;
  --ok: #166534;
  --warn: #8A5A00;
  --code-bg: #F1EEE5;
  --user-bubble: #E6EBF3;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Dark: the TSS light/dark switch (tss-theme.js sets data-theme on html). Light otherwise. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #191D1A;
  --surface: #222724;
  --surface-2: #161A17;
  --border: #3A413B;
  --text: #F6F4EE;
  --muted: #9EA69E;
  --accent: #82A9D2;
  --accent-text: #10243D;
  --danger: #F09A92;
  --ok: #6FBE8B;
  --warn: #D9A338;
  --code-bg: #161A17;
  --user-bubble: #28333D;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); min-height: 1em; margin: 8px 0 0; }
.warn { color: var(--warn); }
.spacer { flex: 1; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 15px; margin-top: 20px; }

button, input, select, textarea { font: inherit; color: inherit; }
button {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
button.ghost { background: transparent; }
button.link { border: none; background: none; color: var(--accent); padding: 4px 0; }
button.small, a.small { font-size: 13px; padding: 4px 8px; }
button.wide { width: 100%; }
.icon-btn { border: none; background: none; font-size: 20px; padding: 4px 8px; line-height: 1; }
a { color: var(--accent); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 8px 10px;
}
textarea { resize: vertical; }
label { display: block; margin: 10px 0 0; font-size: 14px; }
label > input, label > select, label > textarea { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; }
label.check input { width: auto; margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.row { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Sign-in */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px;
}
.login-card button { width: 100%; margin-top: 12px; }

/* Layout */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) auto;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "top top top" "side main panel";
}
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface);
  padding-top: max(8px, env(safe-area-inset-top));
}
/* Upper-left mark on every screen: TSS wordmark, app icon, app name, Wally.
   Inside Cockpit's middle panel Cockpit already shows it, so it is hidden there. */
.brandbar { display: flex; align-items: center; gap: 7px; margin: 0; flex: none; }
.brandbar img, .brandbar picture { display: block; width: auto; flex: none; }
.brandbar-tss { height: 18px; }
.brandbar-icon { height: 24px; border-radius: 5px; }
.brandbar-name { font-weight: 800; font-size: 17px; color: var(--text); white-space: nowrap; }
.brandbar-wally { height: 48px; width: auto; }
.topbar .brandbar { padding-right: 10px; margin-right: 4px; border-right: 1px solid var(--border); }
.brandbar-login { margin-bottom: 8px; }
.brandbar-login .brandbar-tss { height: 22px; }
.brandbar-login .brandbar-icon { height: 30px; }
.brandbar-login .brandbar-name { font-size: 24px; }
.brandbar-login .brandbar-wally { height: 88px; }
body.embedded .topbar .brandbar { display: none; }
@media (max-width: 520px) { .topbar .brandbar-tss, .topbar .brandbar-wally { display: none; } }
.topbar-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#chatTitle { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: none; background: none; padding: 0; text-align: left; max-width: 100%; }
.meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 4px; }
#menuBtn { display: none; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-left: 6px; vertical-align: middle; }

.sidebar {
  grid-area: side; display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border-right: 1px solid var(--border); background: var(--surface); min-height: 0;
}
.chat-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.chat-list li {
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px;
}
.chat-list li:hover { background: var(--surface-2); }
.chat-list li.active { background: var(--user-bubble); }
.chat-list .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list .running::after { content: " \2022 working"; color: var(--ok); }
.sidebar-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.scrim { display: none; }

.main { grid-area: main; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.empty { margin: auto; max-width: 460px; padding: 24px 16px; text-align: center; }
.messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 820px; width: 100%; margin: 0 auto; }
.msg.user .bubble {
  background: var(--user-bubble); border-radius: var(--radius); padding: 10px 12px;
  white-space: pre-wrap; overflow-wrap: anywhere; margin-left: auto; width: fit-content; max-width: 90%;
}
.msg .text { overflow-wrap: anywhere; }
.msg .text p { margin: 0 0 8px; }
.msg .text p:last-child { margin-bottom: 0; }
.msg .text pre, .tool pre {
  background: var(--code-bg); border-radius: 8px; padding: 10px; overflow-x: auto;
  font: 13px/1.45 var(--mono); margin: 6px 0; white-space: pre;
}
.msg .text code { font: 13px var(--mono); background: var(--code-bg); padding: 1px 4px; border-radius: 4px; }
.msg .text pre code { background: none; padding: 0; }
.msg .text ul, .msg .text ol { margin: 4px 0 8px; padding-left: 22px; }
.msg .text h3, .msg .text h4, .msg .text h5 { margin: 12px 0 6px; font-size: 15px; }
.msg .text blockquote { margin: 6px 0; padding-left: 10px; border-left: 3px solid var(--border); color: var(--muted); }
.note { color: var(--muted); font-size: 13px; font-style: italic; margin: 4px 0; white-space: pre-wrap; }
.notice { color: var(--warn); font-size: 13px; margin: 4px auto; max-width: 820px; width: 100%; }

.tool { border: 1px solid var(--border); border-radius: 8px; background: var(--surface); margin: 6px 0; }
.tool > summary {
  list-style: none; cursor: pointer; padding: 6px 10px; display: flex; gap: 8px; align-items: center;
  font-size: 13px; min-width: 0;
}
.tool > summary::-webkit-details-marker { display: none; }
.tool .tname { font-family: var(--mono); font-weight: 600; flex-shrink: 0; }
.tool .tsum { color: var(--muted); font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1; }
.tool .tstate { flex-shrink: 0; }
.tool .tstate.ok { color: var(--ok); }
.tool .tstate.err { color: var(--danger); }
.tool .tstate.run { color: var(--accent); }
.tool .tbody { padding: 0 10px 8px; }
.tool .label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.tool pre { max-height: 360px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }

.approvals { padding: 0 16px; }
.approval {
  max-width: 820px; margin: 8px auto; border: 2px solid var(--warn); border-radius: var(--radius);
  background: var(--surface); padding: 10px 12px;
}
.approval .reason { font-weight: 600; margin-bottom: 6px; overflow-wrap: anywhere; }
.approval pre { font: 12px var(--mono); max-height: 160px; overflow: auto; background: var(--code-bg); padding: 6px; border-radius: 6px; white-space: pre-wrap; }
.approval .row { justify-content: flex-end; }

.status-line { max-width: 820px; width: calc(100% - 32px); margin: 0 auto 6px; font-size: 13px; color: var(--muted); }
.status-line.bad { color: var(--danger); }
.spinner {
  display: inline-block; width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite; vertical-align: -1px; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.composer {
  display: flex; gap: 8px; align-items: flex-end; padding: 10px 16px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--surface);
}
.composer textarea { max-height: 40vh; min-height: 42px; }

/* The agents' buttons, under the chat: each opens a new chat with that agent. */
.agent-bar {
  display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom)); background: var(--surface);
}
.agent-bar:empty { display: none; }
.agent-bar button { font-size: 13px; padding: 4px 10px; }
.agent-bar button.active { border-color: var(--accent); color: var(--accent); }
.composer:has(+ .agent-bar:not(:empty)) { padding-bottom: 8px; }
.agent-intro { max-width: 820px; width: 100%; margin: 24px auto 8px; text-align: center; }
.agent-intro h2 { margin: 0 0 6px; font-size: 20px; }
.agent-intro p { margin: 0; color: var(--muted); }
.agent-intro .row.center { justify-content: center; margin-top: 12px; }
.hand-back { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 14px; }

/* Workspace panel */
.panel {
  grid-area: panel; width: min(44vw, 640px); border-left: 1px solid var(--border);
  background: var(--surface); display: flex; flex-direction: column; min-height: 0;
}
.panel-tabs { display: flex; gap: 4px; padding: 6px 8px; border-bottom: 1px solid var(--border); align-items: center; }
.panel-tabs .icon-btn { margin-left: auto; }
.tab-btn { border: none; background: none; padding: 6px 10px; border-radius: 6px; }
.tab-btn.active { background: var(--surface-2); font-weight: 600; }

/* Dialogs */
.dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text);
  padding: 20px; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 24px);
}
.dialog.wide { width: min(720px, calc(100vw - 24px)); }
.dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 18px; }
.choice { border: none; padding: 0; margin: 8px 0; display: flex; gap: 16px; flex-wrap: wrap; }
.choice label { display: flex; gap: 6px; align-items: center; margin: 0; }
.choice input { width: auto; }
.choice.stacked { flex-direction: column; gap: 6px; }
.choice legend { padding: 0; margin-bottom: 4px; }
.connection-list { list-style: none; padding: 0; margin: 0; }
.connection-list li {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-top: 8px;
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
}
.connection-list .cinfo { flex: 1; min-width: 180px; }
.connection-list .cname { font-weight: 600; }
.connection-list .cmeta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.connection-list .cresult { width: 100%; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 120px; overflow: auto; }
.empty-note { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Phones and narrow windows */
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  #menuBtn { display: inline-block; }
  .sidebar {
    position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(300px, 85vw);
    transform: translateX(-100%); transition: transform 0.18s ease;
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.4); }
  .panel { position: fixed; z-index: 30; inset: 0; width: auto; padding-top: env(safe-area-inset-top); }
  .messages { padding: 12px; }
  .grid2 { grid-template-columns: 1fr; }
  .topbar { padding-left: 4px; padding-right: 8px; }
  .topbar-actions { gap: 2px; }
  .topbar-actions button { padding: 5px 7px; font-size: 13px; }
}

/* ---- Rook-E additions ---------------------------------------------------- */

.title-btn:hover { text-decoration: underline; }
.count {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px;
  background: var(--warn); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 600;
}
.chat-list li { position: relative; padding-right: 30px; }
.chat-list .del {
  position: absolute; right: 2px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--muted);
  display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 6px; opacity: .75;
}
.chat-list li:hover .del, .chat-list li.active .del, .chat-list .del:focus-visible { opacity: 1; }
.chat-list .del:hover { color: var(--danger, var(--text)); background: var(--surface-2, transparent); }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; }
.suggestions button { font-size: 14px; }
.dev-accounts { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.dev-list { list-style: none; padding: 0; margin: 6px 0 0; }
.dev-list li button { width: 100%; text-align: left; margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.dev-list .sub { font-size: 12px; color: var(--muted); }
.login-card input { margin-top: 10px; }

.toast {
  position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 8px; font-size: 14px;
  max-width: min(560px, calc(100vw - 32px));
}
.toast.bad { background: var(--danger); color: #fff; }

.approval .meta-line { font-size: 13px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.approval .body { white-space: pre-wrap; font-size: 14px; background: var(--code-bg); border-radius: 6px; padding: 8px; max-height: 120px; overflow: auto; }

/* Panel */
.panel-tabs { flex-wrap: wrap; row-gap: 2px; }
.panel-tabs .tab-btn { white-space: nowrap; }
.panel-body { flex: 1; overflow-y: auto; padding: 12px 14px 24px; min-height: 0; }
.panel-body h3 { margin: 16px 0 6px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.panel-body h3:first-child { margin-top: 0; }
.panel-note { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.item {
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-top: 8px;
  display: flex; gap: 10px; align-items: flex-start; background: var(--surface);
}
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; overflow-wrap: anywhere; }
.item .sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.item .actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.item input[type="checkbox"] { width: auto; margin-top: 4px; }
.item.serious { border-left: 4px solid var(--danger); }
.item.warning { border-left: 4px solid var(--warn); }
.num { font-weight: 700; color: var(--accent); min-width: 22px; }
.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--muted); }
.pill.good { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.bad { color: var(--danger); border-color: var(--danger); }
.inline-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; margin-top: 4px; }
.inline-form input[type="text"] { flex: 1 1 200px; width: auto; }
.inline-form input[type="date"] { flex: 0 0 auto; width: auto; }
.inline-form button { flex: 0 0 auto; }
.stack > * + * { margin-top: 8px; }
.panel-body > div > input[type="text"], .panel-body .approval input, .panel-body .approval textarea { margin-top: 8px; }
.list li.day h3 { margin: 14px 0 0; }
.list li.day:first-child h3 { margin-top: 0; }
.recording { color: var(--danger); font-weight: 600; }
.table-wrap { overflow-x: auto; margin-top: 8px; }
table.report { border-collapse: collapse; width: 100%; font-size: 13px; }
table.report th, table.report td { padding: 5px 6px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.report td.n, table.report th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.report tr.total td { font-weight: 700; }
.flag-over { color: var(--danger); font-weight: 600; }
.flag-at_risk { color: var(--warn); font-weight: 600; }
.chart { width: 100%; max-width: 440px; height: auto; margin-top: 6px; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .line { stroke: var(--accent); stroke-width: 2; fill: none; }
.chart .dot { fill: var(--accent); }
.chart .limit { stroke: var(--danger); stroke-width: 1; stroke-dasharray: 4 3; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.commentary { background: var(--code-bg); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-top: 8px; }

/* Settings */
.section { border-top: 1px solid var(--border); margin-top: 18px; padding-top: 6px; }
.row.end { justify-content: flex-end; }
.people-list { list-style: none; padding: 0; margin: 0; }
.people-list li { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.people-list .pinfo { flex: 1; min-width: 180px; }
.people-list .pname { font-weight: 600; }
.people-list .pmeta { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.secret { font: 14px var(--mono); background: var(--code-bg); padding: 6px 8px; border-radius: 6px; display: inline-block; user-select: all; overflow-wrap: anywhere; }

@media (max-width: 900px) {
  .topbar-actions button { padding: 5px 6px; }
  .toast { bottom: 96px; }
}

/* The agent builder and the Agents panel */
.build-btn { margin-top: 6px; }
.builder-msg.kind-warning .text { border-left: 3px solid var(--warn); padding-left: 10px; }
.builder-msg.kind-summary, .builder-msg.kind-test { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 5px 12px; font-size: 14px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.run-note { color: var(--muted); font-size: 13px; text-align: center; margin: 8px auto; max-width: 820px; width: 100%; }
.agent-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px 12px; margin: 8px 0; }
.facts { list-style: none; padding: 0; margin: 6px 0; font-size: 13px; }
.facts li { margin: 2px 0; }
.facts b { font-weight: 600; }
.last-run { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; }
.row.wrap { flex-wrap: wrap; }
.note-row { margin-top: 4px; }
.transcript { max-height: 260px; overflow: auto; margin-top: 6px; }
.transcript p { margin: 4px 0; font-size: 13px; }
.transcript .from-person { font-weight: 600; }

/* Inside TSS Cockpit's middle panel (?view=chat): the phone layout at any width. */
body.embedded .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
body.embedded #menuBtn { display: inline-block; }
body.embedded .sidebar {
  position: fixed; z-index: 20; top: 0; bottom: 0; left: 0; width: min(300px, 85vw);
  transform: translateX(-100%); transition: transform 0.18s ease;
}
body.embedded .sidebar.open { transform: none; }
body.embedded .scrim { display: block; position: fixed; inset: 0; z-index: 10; background: rgba(0, 0, 0, 0.4); }
body.embedded .panel { position: fixed; z-index: 30; inset: 0; width: auto; }

/* Signing in through Cockpit */
.button-link { display: block; text-align: center; text-decoration: none; padding: 9px 14px; border-radius: 8px; margin-top: 12px; }
a.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }

/* The graph filter's verdict under each answer, web cards, and the Graph panel. */
.graph-check { font-size: 12px; margin-top: 6px; color: var(--muted); }
.graph-check.good { color: var(--ok); }
.graph-check.warn, .graph-check.fixed { color: var(--warn); }
.graph-check.fixed summary, .graph-draft summary { cursor: pointer; }
.graph-check ul { margin: 4px 0 0; padding-left: 18px; }
.graph-draft { font-size: 13px; color: var(--muted); margin-top: 4px; }
.web-results { margin: 0; padding-left: 18px; font-size: 13px; }
.web-results a { overflow-wrap: anywhere; }
.stack-form { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 8px; }
.stack-form button { align-self: flex-start; }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="file"]::file-selector-button { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 5px 12px; margin-right: 10px; cursor: pointer; }

/* Rook-E answers with Wally's face: the TSS logo is the one replying. */
.msg.assistant { position: relative; padding-left: 54px; }
.msg.assistant::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface) url("wally.webp") center / 86% no-repeat;
}

/* Back and Cockpit (tss-nav.js) sit in the header; smaller there. */
.topbar .tss-nav-back, .topbar .tss-nav-cockpit { min-height: 32px; padding: 4px 10px; font-size: 14px; flex: none; }
@media (max-width: 520px) {
  .topbar .tss-nav-back span { display: none; }
  .topbar .tss-nav-back { padding: 4px 7px; }
  /* With Back and Cockpit the header is too wide for a phone: the buttons take a second row. */
  .topbar { flex-wrap: wrap; row-gap: 6px; }
  .topbar-actions { width: 100%; justify-content: flex-end; }
}
body.embedded .tss-nav-back, body.embedded .tss-nav-cockpit { display: none; }
/* On a phone the work panel covers the page: its close button stays in reach at the right of the tabs. */
.panel-tabs #closePanel { position: sticky; right: 0; flex: none; background: var(--surface); box-shadow: -8px 0 8px var(--surface); }

/* Suggested agents: the first-time notice above the chat. */
.capture-notice { margin: 10px 16px 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); font-size: 14px; }
.capture-notice p { margin: 0; }
.capture-notice .row { margin-top: 8px; }
.item.suggestion .title { font-weight: 600; }

/* Projects: open steps, the check-in questions and the answers so far. */
.project .steps { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }
.project .steps li.serious { color: var(--danger); }
.project .check-in { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }
.project .check-in .field { display: grid; gap: 2px; font-size: 14px; }
.project .notes { margin: 4px 0 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
