/* ChatAdmin (the hub). The Guide's light "device manual" look (teal = you, amber = a card that waits for you),
   plus one colour and a letter avatar per agent: A blue, PP violet, E green. The Chair is grey and centred. */
:root {
  --bg: #F5F7F9; --panel: #FCFDFD; --panel2: #EEF2F6; --border: #D3D9E1;
  --text: #15202B; --muted: #3F4A57; --dim: #6A7684;
  --teal: #1F6E78; --teal-soft: #DCEEF0; --amber: #A3670F; --amber-soft: #FFF8EC;
  --green: #1E7F4F; --green-soft: #E3F3EA; --red: #B3261E; --red-soft: #FBE9E7;
  --yellow: #8A6100; --yellow-soft: #FFF3CD; --code-bg: #E6ECF1; --focus: #2F7DE1;
  --a: #2B5DAD; --a-soft: #E4ECF9; --pp: #6B3FA0; --pp-soft: #EEE6F7; --e: #1E7F4F; --e-soft: #E3F3EA; --m: #B4530A;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 var(--sans); display: flex; flex-direction: column; min-height: 100vh;
}
a { color: var(--teal); }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
code, pre { font-family: var(--mono); font-size: .93em; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; }
pre { background: var(--code-bg); padding: 10px 12px; border-radius: 8px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; }
pre code { background: none; padding: 0; }
.md h1, .md h2, .md h3, .md h4 { margin: .6em 0 .3em; line-height: 1.25; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.2em; } .md h3 { font-size: 1.1em; } .md h4 { font-size: 1em; }
.md p { margin: .4em 0; } .md ul, .md ol { margin: .4em 0; padding-left: 1.5em; }
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.small { font-size: 13px; color: var(--dim); }

/* header and footer */
header.top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0;
  padding: 10px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
}
header.top button { white-space: nowrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.tagline { color: var(--dim); font-size: 14px; }
.spacer { flex: 1; }
header.top button, .btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 6px 12px; font-size: 14px;
}
header.top button:hover, .btn:hover { color: var(--text); border-color: var(--dim); }
.btn.small { padding: 2px 9px; font-size: 13px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 3px 10px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel2); color: var(--muted); white-space: nowrap;
}
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.pill.good { color: var(--green); border-color: var(--green); background: var(--green-soft); }
.pill.good::before { background: var(--green); }
.pill.warn { color: var(--yellow); border-color: var(--yellow); background: var(--yellow-soft); }
.pill.warn::before { background: var(--yellow); }
.pill.bad { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.pill.bad::before { background: var(--red); }
.pill.wait { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.pill.wait::before { background: var(--amber); animation: blink 1s infinite; }
footer { padding: 8px 16px; font-size: 13px; color: var(--dim); border-top: 1px solid var(--border); background: var(--panel); overflow-wrap: anywhere; }

/* the room: rail on the left, timeline in the middle, the Workings panel on the right when open */
.room { flex: 1; display: grid; grid-template-columns: 270px minmax(360px, 1fr); min-height: 0; min-width: 0; max-width: 100%; }
.room.with-workings { grid-template-columns: 250px minmax(300px, 1fr) minmax(280px, 34%); }   /* 830 px minimum: no horizontal scroll above the 960 px phone switch */
.room > * { min-width: 0; }
.viewtoggle { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.viewtoggle .viewbtn { border: 0; border-radius: 0; background: var(--panel); color: var(--muted); padding: 5px 12px; font-size: 13px; }
.viewtoggle .viewbtn[aria-pressed="true"] { background: var(--teal); color: #fff; }
.workings { border-left: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.w-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.w-head h2 { margin: 0; font-size: 16px; }
.w-head .btn { margin-left: auto; }
.w-body { flex: 1; overflow: hidden auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 12px; }
.w-turn { display: flex; flex-direction: column; gap: 10px; }
.w-turn h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.w-turn .w-user { font-size: 13px; color: var(--muted); border-left: 3px solid var(--teal); padding-left: 8px; }
.w-turn .agent-block { width: 100%; }
.w-turn .tool.chair-tool { align-self: flex-start; }
.card-ref { font-size: 13px; color: var(--amber); border: 1px dashed var(--amber); border-radius: 8px; padding: 4px 10px; }
/* the activity strip: one line per agent in motion under the Chair's message; each row opens the Workings panel */
.activity-strip { align-self: center; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 88%; }
.arow { font: 13px var(--mono); background: var(--panel2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 12px; color: var(--muted); border-left: 4px solid var(--dim); }
.arow.agent_a { border-left-color: var(--a); } .arow.agent_pp { border-left-color: var(--pp); } .arow.agent_e { border-left-color: var(--e); } .arow.agent_m { border-left-color: var(--m); }
.arow.live { color: var(--text); } .arow.done { color: var(--dim); } .arow.wait { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); } .arow.bad { color: var(--red); border-color: var(--red); }
.approval .badge { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.approval .badge::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.approval .badge.agent_a::before { background: var(--a); } .approval .badge.agent_pp::before { background: var(--pp); } .approval .badge.agent_e::before { background: var(--e); } .approval .badge.agent_m::before { background: var(--m); }
.rail { border-right: 1px solid var(--border); background: var(--panel); overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tile {
  text-align: left; background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; width: 100%;
}
.tile:hover { border-color: var(--teal); box-shadow: 0 2px 8px rgba(21,32,43,.08); }
.tile-head { display: flex; align-items: center; gap: 8px; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%;
  font: 700 12px var(--mono); color: #fff; background: var(--dim); flex: none;
}
.agent_a .avatar, .avatar.agent_a { background: var(--a); }
.agent_pp .avatar, .avatar.agent_pp { background: var(--pp); }
.agent_e .avatar, .avatar.agent_e { background: var(--e); }
.agent_m .avatar, .avatar.agent_m { background: var(--m); } .agent_k .avatar, .avatar.agent_k { background: #5A6472; }   /* Agent K: inside the hub, a neutral slate */
.tile .name { font-weight: 600; font-size: 15px; }
.tile .pills { display: flex; gap: 6px; flex-wrap: wrap; }
.tile .facts { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.tile .facts .err { color: var(--red); }
.tile .keyline { font-size: 12px; color: var(--dim); }
.tile .keyline.has { color: var(--green); }
.tile .keyline.bad { color: var(--red); }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--border); color: var(--dim); white-space: nowrap; }
.tag.live { color: var(--green); border-color: var(--green); }
.tag.simulated, .tag.dry_run, .tag.guardrail, .tag.scripted { color: var(--amber); border-color: var(--amber); }

/* timeline */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }
.feed { flex: 1; overflow: hidden auto; min-width: 0; padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.feed > * { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel); }
.msg .who { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); margin-bottom: 4px; }
.msg .who .addr { text-transform: none; letter-spacing: 0; }
.msg.user { align-self: flex-end; background: var(--teal-soft); border-color: var(--teal); }
.msg.user .body { white-space: pre-wrap; }
.chair { align-self: center; max-width: 80%; padding: 8px 14px; border-radius: 10px; background: var(--panel2); color: var(--muted); font-size: 15px; border: 1px solid var(--border); }
.chair .who { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); margin-bottom: 2px; text-align: center; }
.chair.local { border-style: dashed; }
.cursor { display: inline-block; width: 8px; height: 1em; background: var(--teal); vertical-align: text-bottom; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.system-line { color: var(--dim); font-size: 14px; text-align: center; }
.status-line { color: var(--dim); font-size: 14px; text-align: center; font-style: italic; order: 9999; }
.error-line { color: var(--red); background: var(--red-soft); border: 1px solid var(--red); border-radius: 8px; padding: 8px 12px; }
.error-line::before { content: "Problem: "; font-weight: 700; }
.budget-line { color: var(--dim); font-size: 13px; text-align: center; }

/* agent blocks */
.agent-block { align-self: flex-start; width: min(100%, 92%); border: 1px solid var(--border); border-left: 5px solid var(--dim); border-radius: 12px; background: var(--panel); padding: 10px 14px; }
.agent-block.agent_a { border-left-color: var(--a); }
.agent-block.agent_pp { border-left-color: var(--pp); }
.agent-block.agent_e { border-left-color: var(--e); }
.agent-block.agent_m { border-left-color: var(--m); }
.agent-block .bhead { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; margin-bottom: 6px; }
.agent-block .bhead .name { font-weight: 700; }
.agent-block .bhead .label { color: var(--dim); }
.agent-block .bhead .tags { display: inline-flex; gap: 6px; }
.agent-block .sent { font-size: 13px; color: var(--muted); margin: 0 0 8px; border: 1px dashed var(--border); border-radius: 8px; padding: 4px 10px; background: var(--panel2); }
.agent-block .sent summary { cursor: pointer; color: var(--dim); }
.agent-block .sent pre { font-family: var(--sans); font-size: 13px; background: none; padding: 4px 0 0; margin: 0; }
.agent-block .body { display: flex; flex-direction: column; gap: 8px; }
.agent-block .body.folded { max-height: 26em; overflow: hidden; position: relative; }
.agent-block .body.folded::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3em; background: linear-gradient(transparent, var(--panel)); }
.agent-block .showall { align-self: flex-start; margin-top: 6px; }
.agent-block .foot { margin-top: 8px; font-size: 13px; color: var(--dim); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); padding-top: 6px; }
.agent-block .foot.bad .summary { color: var(--red); }
.forward-row { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }
.agent-error { color: var(--red); font-size: 14px; }
.verdict-line { font-weight: 600; }

/* tool chips */
.tool { font: 13px var(--mono); color: var(--dim); background: var(--panel2); border: 1px solid var(--border); border-radius: 9px; padding: 5px 10px; align-self: flex-start; max-width: 100%; }
.tool .st { margin-right: 7px; }
.tool.ok .st { color: var(--green); } .tool.bad .st { color: var(--red); } .tool.declined .st { color: var(--yellow); }
.tool.bad { border-color: var(--red); color: var(--red); }
.tool .step { color: var(--yellow); margin-right: 6px; }
.tool .kind { font-size: 11px; margin-left: 6px; padding: 0 6px; border: 1px solid var(--border); border-radius: 10px; }
.tool .covered { color: var(--dim); font-size: 11.5px; margin-left: 8px; }
.tool details { margin-top: 4px; } .tool summary { cursor: pointer; }
.permission-card ul.excluded { margin: 4px 0 6px 18px; padding: 0; font-size: 13.5px; } .permission-card .perm-details summary { cursor: pointer; color: var(--muted); font-size: 13px; } .permission-card .perm-url { width: 100%; max-width: 100%; font: 12px var(--mono); margin: 4px 0; }
.tool pre { max-height: 260px; overflow: auto; font-size: 12px; color: var(--text); }
.tool.plan-summary { border-color: var(--yellow); }
.tool .plan-line { margin-top: 3px; color: var(--text); }
.tool.chair-tool { align-self: center; font-family: var(--sans); }
.tool .name { font-family: var(--mono); }
.verified { margin-top: 6px; border-left: 3px solid var(--green); padding: 4px 10px; background: rgba(30,127,79,.07); border-radius: 0 8px 8px 0; }
.verified .vt { color: var(--green); font-weight: 600; font-size: 12px; margin-bottom: 3px; }
.verified.not { border-left-color: var(--yellow); background: rgba(138,97,0,.07); }
.verified.not .vt { color: var(--yellow); }
.kv { border-collapse: collapse; font-size: 13px; width: 100%; table-layout: fixed; }
.kv td { padding: 2px 8px 2px 0; vertical-align: top; overflow-wrap: anywhere; }
.kv td:first-child { color: var(--dim); font-family: var(--mono); width: 34%; }

/* approval cards: the loudest element */
.approval { border: 2px solid var(--amber); border-radius: 12px; background: var(--amber-soft); padding: 12px 14px; width: 100%; }
.approval h3 { margin: 0 0 4px; font-size: 16px; color: var(--amber); }
.approval .action { font: 14px var(--mono); margin-bottom: 8px; }
.approval .plan-note { font-size: 14px; margin: 4px 0 8px; }
.approval .sub, .approval .askedby { color: var(--muted); font-size: 13px; margin-top: 8px; }
.approval .askedby { font-weight: 600; }
.approval .countdown { margin-top: 8px; font-weight: 600; color: var(--amber); }
.approval .countdown.over { color: var(--red); }
.approval .btns { display: flex; gap: 10px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.approval .btns button { border: none; border-radius: 8px; padding: 8px 18px; font-size: 14px; font-weight: 600; }
.approval .yes { background: var(--green); color: #fff; } .approval .yes.key-needed { background: transparent; color: inherit; border: 1px solid currentColor; } .approval .key-gate { margin: 6px 0; padding: 6px 8px; border-left: 3px solid var(--amber); font-weight: 600; }   /* key-needed: 2026-11-19 */
.approval .no { background: var(--panel); color: var(--text); border: 1px solid var(--border) !important; }
.approval .keyhint { font-size: 13px; color: var(--dim); }
.approval .keymsg { margin-top: 8px; font-size: 13px; color: var(--red); }
.approval .keymsg.ok { color: var(--green); }
.approval.resolved { opacity: .8; border-color: var(--border); background: var(--panel); }
/* the customer organisation (V3, 2026-11-01; org.js): the risk line on every card, the hub-native cards, the
   Organization disclosure, the typed-confirmation dialog */
.approval .riskline { margin-top: 6px; font-size: 13px; color: var(--muted); }
.approval .riskline.blocked { color: var(--red); font-weight: 600; }
.approval.org-card { border-color: var(--e); background: var(--panel); }
.approval.org-card h3 { color: var(--text); }
.approval .modes, .approval .access-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; font-size: 14px; }
.approval .access-form .label { font-weight: 600; }
.approval .custom-areas { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 4px 12px; margin: 4px 0 4px 18px; }
.approval .custom-areas .area { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.approval .custom-areas select { font-size: 13px; }
.org-mode { margin: 0 0 8px; }
details.org { border: 1px solid var(--border); border-radius: 12px; background: var(--panel); padding: 8px 14px; margin-bottom: 10px; }
details.org summary { font-weight: 600; cursor: pointer; }
details.org h2 { font-size: 15px; margin: 12px 0 6px; }
details.org .o-head, details.org .o-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
details.org table.roster { border-collapse: collapse; width: 100%; font-size: 13px; }
details.org table.roster th, details.org table.roster td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
details.org tr.inactive td { color: var(--muted); }
details.org ul.activity { font-size: 13px; padding-left: 18px; }
#orgBtn.prominent { font-weight: 600; }
dialog.confirm { border: 2px solid var(--amber); border-radius: 12px; padding: 16px 18px; max-width: 480px; }
dialog.confirm input { width: 100%; font: 15px var(--mono); padding: 8px; margin: 8px 0; box-sizing: border-box; }
.approval .verdict { margin-top: 10px; font-weight: 600; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.approval .verdict.ok { color: var(--green); } .approval .verdict.no { color: var(--red); }
.steps { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.steps li { border: 1px solid var(--border); border-radius: 9px; padding: 7px 10px; background: var(--panel); }
.steps .head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font: 13px var(--mono); }
.steps .idx { color: var(--dim); } .steps .sid { color: var(--amber); }
.steps .tag.change { color: var(--red); border-color: var(--red); } .steps .tag.read { color: var(--green); border-color: var(--green); }
.steps .why { font-size: 13px; color: var(--dim); margin-top: 2px; }
.preview { margin-top: 8px; border: 1px dashed var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; background: var(--panel); }
.preview summary { cursor: pointer; color: var(--teal); font-weight: 600; }
.preview .unavail { color: var(--dim); }
.preview table.wi { width: 100%; border-collapse: collapse; font: 12px var(--mono); margin-top: 6px; }
.preview table.wi th { text-align: left; color: var(--dim); font-weight: 600; padding: 2px 8px 2px 0; border-bottom: 1px solid var(--border); }
.preview table.wi td { padding: 3px 8px 3px 0; vertical-align: top; overflow-wrap: anywhere; border-bottom: 1px solid var(--border); }
.preview .ct-Create, .preview .ct-create { color: var(--green); }
.preview .ct-Delete, .preview .ct-delete { color: var(--red); }
.preview .ct-Modify, .preview .ct-modify { color: var(--yellow); }
.preview ul { margin: 6px 0 0; padding-left: 18px; }
.preview pre { max-height: 240px; overflow: auto; font-size: 12px; }

/* the sticky "card waiting" strip (shown while a pending card is off screen) */
.card-strip { position: absolute; left: 0; right: 0; bottom: 140px; display: flex; justify-content: center; pointer-events: none; }
.card-strip button { pointer-events: auto; background: var(--amber); color: #fff; border: none; border-radius: 999px; padding: 8px 16px; font-weight: 600; box-shadow: 0 2px 8px rgba(21,32,43,.2); }

/* composer */
#composer { display: flex; flex-direction: column; gap: 6px; padding: 10px 16px 6px; border-top: 1px solid var(--border); background: var(--panel); min-width: 0; }
#composer .row { display: flex; gap: 10px; align-items: flex-end; min-width: 0; }
#input { flex: 1; min-width: 0; width: 100%; resize: vertical; min-height: 48px; max-height: 200px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
#sendBtn { flex: none; white-space: nowrap; background: var(--teal); color: #fff; border: 1px solid var(--teal); border-radius: 10px; padding: 10px 18px; font-weight: 600; }
#stopBtn { flex: none; white-space: nowrap; background: var(--red-soft); color: var(--red); border: 1px solid var(--red); border-radius: 10px; padding: 10px 18px; font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chips-label { font-size: 13px; color: var(--dim); }
.chip { background: var(--panel); border: 1px solid var(--border); color: var(--muted); border-radius: 999px; padding: 3px 12px; font: 13px var(--mono); }
.chip:hover { border-color: var(--teal); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.to-hint { font-size: 13px; color: var(--dim); }
.tools-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.composer-hint { font-size: 12px; color: var(--dim); }

/* key drawer: a panel under the header on desktop, a bottom sheet on the phone */
.drawer { position: fixed; top: 56px; right: 12px; width: min(420px, calc(100% - 24px)); z-index: 20; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; box-shadow: 0 8px 28px rgba(21,32,43,.18); }
.drawer h2 { margin: 0 0 6px; font-size: 17px; }
.keyfield { display: flex; flex-direction: column; gap: 4px; font-size: 14px; margin-top: 10px; color: var(--muted); }
.keyfield input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: #fff; font-family: var(--mono); }
.keyfield input.ok { border-color: var(--green); background: var(--green-soft); }
.keyfield input.bad { border-color: var(--red); background: var(--red-soft); }
.key-hint { min-height: 1.2em; color: var(--amber); }
.drawer .actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

/* the product surface (GTM round, 2026-10-31): the areas rail, the specialists disclosure, the welcome block, the
   card outcome line, the "How access works" dialog */
.tile .sub { font-size: 12px; color: var(--dim); font-weight: 400; margin-left: 4px; }
.specialists { font-size: 13px; color: var(--dim); }
.specialists > summary { cursor: pointer; list-style: none; display: inline-block; padding: 2px 0; }
.specialists > summary::before { content: "▸ "; }
.specialists[open] > summary::before { content: "▾ "; }
.specialists .chips { margin-top: 6px; }
.welcome { border-style: solid; max-width: 88%; text-align: left; }
.welcome .summary { margin: 2px 0 6px; font-size: 14px; color: var(--text); }
.welcome .lead { margin: 6px 0 4px; font-weight: 600; color: var(--text); }
.sp-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.sp-btn { background: var(--panel); border: 1px solid var(--teal); color: var(--teal); border-radius: 999px; padding: 7px 14px; font-size: 14px; font-weight: 600; }
.sp-btn:hover { background: var(--teal-soft); }
.sp-btn.changes { border-style: dashed; }
.sp-btn.changes::after { content: " · cards"; font-weight: 400; color: var(--amber); }
.sp-hidden { font-size: 13px; color: var(--dim); margin: 4px 0; }
.sp-hidden summary { cursor: pointer; }
.sp-hidden ul { margin: 4px 0 0; padding-left: 18px; }
.approval .outcome { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--amber); }
dialog.access { width: min(640px, calc(100% - 24px)); max-height: 88vh; border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; background: var(--panel); color: var(--text); box-shadow: 0 8px 28px rgba(21,32,43,.18); }
dialog.access::backdrop { background: rgba(21,32,43,.35); }
dialog.access[hidden] { display: none; }
.a-head { display: flex; align-items: center; gap: 10px; }
.a-head h2 { margin: 0; font-size: 17px; flex: 1; }
.stage { margin-top: 12px; }
.stage h3 { margin: 0 0 4px; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stage p { margin: 2px 0; font-size: 14px; color: var(--muted); }
.stage a { font-size: 14px; }

/* phone: one column, the rail as four pills, the drawer as a bottom sheet, full-width cards */
@media (max-width: 960px) {
  .room { display: flex; flex-direction: column; }
  .rail { flex-direction: row; gap: 6px; padding: 8px 10px; border-right: 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
  .tile { flex-direction: row; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; width: auto; flex: none; }
  .tile .facts, .tile .keyline, .tile .pills .pill:not(.state), .tile .tag, .tile .sub { display: none; }
  .tile .name { font-size: 13px; }
  .tile .pill.state { padding: 1px 8px; font-size: 12px; }
  .chat { min-height: 70vh; }
  .msg, .chair, .agent-block { max-width: 100%; width: 100%; }
  .tagline { display: none; }
  .drawer { top: auto; bottom: 0; right: 0; left: 0; width: 100%; border-radius: 14px 14px 0 0; }
  .card-strip { bottom: 150px; }
  .approval .btns button { flex: 1; }
  .activity-strip { max-width: 100%; }
  /* the Workings panel as a bottom sheet */
  .workings { position: fixed; left: 0; right: 0; bottom: 0; max-height: 72vh; z-index: 15; border-left: 0; border-top: 1px solid var(--border); border-radius: 14px 14px 0 0; box-shadow: 0 -8px 28px rgba(21,32,43,.18); }
  .tagline, .w-head .small { display: none; }
  .welcome { max-width: 100%; }
  .sp-btn { flex: 1 1 45%; }
  dialog.access { width: calc(100% - 16px); margin: auto 8px; padding: 12px; }
  #accessBtn { font-size: 13px; padding: 6px 8px; }
}
@media (prefers-reduced-motion: reduce) { .cursor, .pill.wait::before { animation: none; } }

/* Stage 1 sign-in (signin.js): the header area, the explanation dialog, the operator / environment lines on a card */
.signin { display: inline-flex; align-items: center; gap: 8px; }
.signin .signed-in { font-size: 13px; color: var(--muted); white-space: nowrap; }
@media (max-width: 960px) {
  /* the phone: the signed-in line may wrap and never pushes "Sign out" off the screen (390 px render, 2026-10-31) */
  .signin { flex-wrap: wrap; max-width: 100%; }
  .signin .signed-in { white-space: normal; overflow-wrap: anywhere; }
}
.signin-dialog { border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; max-width: min(520px, calc(100% - 32px)); background: var(--panel); color: var(--text); }
.signin-dialog::backdrop { background: rgba(21,32,43,.35); }
.signin-dialog h2 { margin: 0 0 8px; font-size: 17px; }
.signin-dialog .actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.signin-note { font-size: 13px; color: var(--muted); }
.signin-note.bad { color: var(--red); }
.approval .envline { font-size: 13px; color: var(--muted); margin-top: 4px; }
.approval .envline.unknown { color: var(--amber); }
.approval .refused { color: var(--red); background: var(--red-soft); border-radius: 8px; padding: 6px 10px; margin-top: 6px; }
#workingsBtn.attention { color: var(--red); border-color: var(--red); }

/* Microsoft Marketplace landing (marketplace.js): one panel above the feed, hidden on every other path */
.marketplace { margin: 12px 12px 0; padding: 14px 18px; border: 1px solid var(--teal); border-radius: 14px; background: var(--teal-soft); color: var(--text); }
.marketplace h2 { margin: 0 0 6px; font-size: 17px; }
.marketplace p { margin: 4px 0; font-size: 14px; }
.marketplace .facts { margin: 6px 0; padding: 0; list-style: none; font-size: 14px; }
.marketplace .facts li { padding: 2px 0; }
.marketplace .facts b { font-weight: 600; }
.marketplace .bad { color: var(--red); }
.marketplace .ok { color: var(--green); font-weight: 600; }
.marketplace .actions { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.marketplace .primary { background: var(--teal); color: #fff; border: 1px solid var(--teal); border-radius: 999px; padding: 8px 16px; font-weight: 600; }
.marketplace .primary[disabled] { opacity: .6; }
.marketplace .welcome { max-width: 100%; margin-top: 10px; background: var(--panel); }
@media (max-width: 960px) { .marketplace { margin: 8px 8px 0; padding: 10px 12px; } .marketplace .actions button { flex: 1; } }

/* layout 2026-11-03 (the owner: the conversation much bigger, everything around it smaller) */
body { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
header.top { padding: 5px 12px; gap: 8px; flex-wrap: nowrap; overflow-x: auto; }
header.top .tagline { display: none; }
header.top button, header.top .pill { padding: 3px 9px; font-size: 13px; }
.viewtoggle .viewbtn { padding: 3px 10px; }
.brand { font-size: 16px; }
.room { grid-template-columns: 190px minmax(360px, 1fr); }
.room.with-workings { grid-template-columns: 190px minmax(360px, 1fr) minmax(260px, 26%); }
.rail { padding: 8px; gap: 6px; }
.tile { padding: 6px 8px; gap: 3px; border-radius: 10px; }
.tile .facts, .tile .keyline, .tile .tag, .tile .sub { display: none; }
.tile .name { font-size: 14px; }
.tile .pill { padding: 1px 7px; font-size: 12px; }
.feed { padding: 12px 20px; gap: 10px; }
.msg, .welcome, .chair { max-width: 100%; }
.msg.user { max-width: 80%; }
.agent-block { width: 100%; }
.agent-block .body.folded { max-height: 60vh; }
#composer { padding: 6px 12px 4px; gap: 4px; }
#input { min-height: 40px; padding: 8px 10px; }
#sendBtn, #stopBtn { padding: 8px 16px; }
.tools-row .btn { padding: 2px 9px; font-size: 13px; }
.composer-hint { display: none; }
.card-strip { bottom: 100px; }
footer { padding: 2px 12px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 960px) {
  .room { display: flex; flex-direction: column; min-height: 0; }
  .chat { min-height: 0; flex: 1; }
  header.top { flex-wrap: wrap; overflow: visible; gap: 6px; padding: 4px 8px; }
  header.top .spacer { display: none; }
  .rail { padding: 4px 8px; }
  .tile { padding: 2px 8px; }
  .feed { padding: 10px; }
  .tools-row { flex-wrap: nowrap; overflow-x: auto; }
  .tools-row .btn { white-space: nowrap; }
  .card-strip { bottom: 110px; }
  footer { display: none; }
}  /* CUST MSP (2026-11-08): the tenant band, the customer marker, the Customers panel, the card header lines, the connect page — one line, the file is at its size cap; nothing of it is drawn for a one-tenant organisation */ .msp-band{display:flex;flex-wrap:wrap;align-items:center;gap:8px;padding:8px 12px;border:1px solid var(--border);border-radius:10px;background:var(--panel);font-size:14px;}.msp-band .msp-band-text{font-weight:600;} .msp-band .msp-tid{color:var(--dim);font-family:var(--mono);font-size:12px;}.msp-band select.msp-switch{margin-left:auto;font:inherit;padding:4px 8px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);} .msp-band .msp-band-note{flex-basis:100%;color:var(--red);}.msp-marker{display:inline-block;width:12px;height:12px;border-radius:50%;flex:none;} .msp-marker.small{width:9px;height:9px;margin-bottom:4px;}.msp table.msp-directory tr.attention td{background:var(--amber-soft);} .msp .msp-actions{display:flex;flex-wrap:wrap;gap:4px;}.msp .msp-create{flex-wrap:wrap;gap:6px;} .msp .msp-create input{font:inherit;padding:4px 8px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);min-width:180px;}.msp .msp-link{width:100%;font:13px var(--mono);padding:6px 8px;border-radius:8px;border:1px solid var(--border);background:var(--bg);color:var(--text);} .msp ul.msp-summary,.msp ul.msp-tenants{margin:6px 0;padding-left:18px;font-size:14px;}.msp ul.msp-tenants li.bad{color:var(--red);} .msp ul.msp-tenants button{margin-left:8px;}.approval dl.msp-header,.msp dl.msp-header{display:grid;grid-template-columns:max-content 1fr;gap:2px 12px;margin:8px 0 4px;font-size:13px;} .approval dl.msp-header dt,.msp dl.msp-header dt{color:var(--muted);}.approval dl.msp-header dd,.msp dl.msp-header dd{margin:0;word-break:break-word;} .approval dl.msp-header .msp-marker{grid-column:1 / -1;}.msp-connect h3{margin:12px 0 4px;font-size:15px;} .msp-connect ul,.msp-connect ol{margin:4px 0;padding-left:18px;}.msp-connect .actions{margin-top:12px;} .msp-connect .bad{color:var(--red);}.msp-connect .ok{color:var(--green);} @media (max-width:960px){.msp-band select.msp-switch{margin-left:0;flex-basis:100%;}} /* UIFIX 2026-11-11: the one model banner above the thread (app.js applyLlm, view.js modelNotice) */ .llm-banner{margin:8px 20px 0;padding:8px 12px;border:1px solid var(--red);border-radius:10px;background:var(--red-soft);color:var(--text);font-size:14px;}.llm-banner strong{color:var(--red);} .llm-banner details{margin-top:4px;font-size:13px;color:var(--muted);}.llm-banner summary{cursor:pointer;} @media (max-width:960px){.llm-banner{margin:6px 10px 0;}} /* UIFIX: the header never scrolls sideways on a desktop (the identity line gives way, with an ellipsis); a tile's state pill wraps instead of being cut ("not available in your organisation") */ @media (min-width:961px){header.top .signin{min-width:0;flex:0 1 auto;} header.top .signin .signed-in{min-width:0;overflow:hidden;text-overflow:ellipsis;} header.top .viewtoggle{flex:none;} .tile .pill{white-space:normal;}}
