/* (20.10, agentchat-cloud-external-v1 §3) Страница внешних людей: тёмная плотная консоль, обычный (не узкий) системный шрифт,
   без полупрозрачности. Встроенных стилей нет — политика содержимого узла их запрещает */
:root {
  --bg: #0e1014; --panel: #151920; --panel2: #1b2029; --line: #283040; --text: #d8dee8; --muted: #8b95a5;
  --accent: #5aa7ff; --ok: #48c08a; --warn: #e3b04b; --err: #f06470; --mine: #17222f; --tome: #2a2414;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif; }
code, .cmd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 13px; margin: 0 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
p { margin: 4px 0; }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; min-height: 100%; }
.bar { display: flex; align-items: center; gap: 4px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { font-weight: 700; margin-right: 12px; }
.tab { padding: 4px 10px; border-radius: 4px; color: var(--text); }
.tab.on { background: var(--panel2); color: #fff; }
.tab:hover { text-decoration: none; background: var(--panel2); }
.badge { display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #08111c; font-size: 12px; text-align: center; }
.who { color: var(--muted); margin-right: 8px; }
.status { font-size: 12px; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); }
.status.online { color: var(--ok); border-color: #24563f; }
.status.offline, .status.connecting { color: var(--warn); border-color: #5a4720; }
.status.revoked { color: var(--err); border-color: #5c2a30; }
.grow { flex: 1 1 auto; }
.screen { flex: 1 1 auto; display: flex; min-height: 0; }

main { width: 100%; margin: 0 auto; padding: 12px; }
main.narrow { max-width: 640px; }
main.wide { max-width: 1100px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px; margin-bottom: 12px; }
.note { color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { border: 1px solid #5a4720; background: #1d1910; border-radius: 6px; padding: 8px 10px; margin: 10px 0; }
.warn strong { color: var(--warn); }
.msg { min-height: 1.4em; margin-top: 6px; }
.msg.err, .err { color: var(--err); }

label { display: block; color: var(--muted); margin: 8px 0 4px; }
input, textarea, select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
input:focus, textarea:focus, select:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
input[type=text] { width: 100%; }
textarea { width: 100%; resize: vertical; min-height: 60px; }
.form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.form input { flex: 1 1 220px; width: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 6px; }
.btn { font: inherit; cursor: pointer; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 4px; padding: 5px 12px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: #1d3a5c; border-color: #2c5a8c; color: #fff; }
.btn.danger { background: #3a1c21; border-color: #6a2c35; }
.btn.small { padding: 2px 8px; font-size: 12px; }
.link { font: inherit; background: none; border: none; color: var(--accent); cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }

.list .tools, .feedcol .tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.search { flex: 1 1 200px; }
.rows { display: flex; flex-direction: column; }
.item { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 6px 8px; border-top: 1px solid var(--line); color: var(--text); }
.item:first-child { border-top: none; }
.item.go:hover { background: var(--panel2); text-decoration: none; }
.item.fresh .title { color: #fff; }
.title { font-weight: 600; }
.tag { font-size: 11px; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--muted); }
.tag.hot { color: var(--warn); border-color: #5a4720; }
.state.pending { color: var(--warn); }
.state.approved { color: var(--ok); }
.state.rejected, .state.revoked { color: var(--err); }

.codebox { margin-top: 10px; padding: 10px; border: 1px solid #2c5a8c; background: #111b27; border-radius: 6px; }
.cmd { flex: 1 1 auto; min-width: 0; width: auto !important; color: #fff; }
.device { padding: 8px; border-top: 1px solid var(--line); }
.device:first-child { border-top: none; }
.device .joins { margin: 4px 0 0 12px; }
.join { margin-top: 4px; }

.room { display: flex; flex-direction: column; height: calc(100vh - 42px); max-width: none; padding: 8px 12px; }
.roomhead { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.purpose { flex-basis: 100%; }
.roomgrid { flex: 1 1 auto; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 12px; min-height: 0; padding-top: 8px; }
.feedcol { display: flex; flex-direction: column; min-height: 0; }
.feed { flex: 1 1 auto; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 0; }
.msg-item { padding: 5px 10px; border-left: 3px solid transparent; }
.msg-item + .msg-item { border-top: 1px solid #1d232d; }
.msg-item.own { background: var(--mine); }
.msg-item.tome { border-left-color: var(--warn); background: var(--tome); }
.msg-item.agent .author { color: #9fc9ff; }
.meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.author { font-weight: 600; }
.text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.composer { margin-top: 8px; }
.to { margin-top: 4px; }
.members { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow-y: auto; min-height: 0; }
.member { padding: 6px 0; border-top: 1px solid var(--line); }
.member:first-child { border-top: none; }
.member .row { margin-top: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #3a4352; display: inline-block; }
.dot.on { background: var(--ok); }
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 0 16px; }
.chip { font: inherit; font-size: 12px; cursor: pointer; color: #9fc9ff; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 1px 8px; }
.chip:hover { border-color: var(--accent); }

.toasts { position: fixed; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 5; max-width: 420px; }
.toast { padding: 8px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel2); }
.toast.ok { border-color: #24563f; }
.toast.err { border-color: #6a2c35; color: #ffd6da; }

@media (max-width: 800px) {
  .roomgrid { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .members { max-height: 30vh; }
  .room { height: auto; min-height: calc(100vh - 42px); }
  .feed { min-height: 50vh; }
}
