:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1d212a; --line: #262b36; --muted: #8b93a7; --text: #e6e8ee;
  --accent: #e5a33a; --gold: #c0841a; --danger: #e0604f; --up: #1f9d72; --down: #3a86e8;
  --r: 12px; --gap: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; background: rgba(15,17,21,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
/* Логотип: «agent» — белым, «hub» — тёмным на золотой плашке */
.brand { display: inline-flex; align-items: center; gap: 3px; font-weight: 800; font-size: 19px; letter-spacing: -.3px; color: var(--text); }
.brand span { background: var(--accent); color: var(--bg); border-radius: 6px; padding: 0 6px 1px; line-height: 1.35; }
.brand.big { font-size: 38px; gap: 5px; justify-content: center; display: flex; margin: 48px 0 20px; }
.brand.big span { border-radius: 10px; padding: 0 10px 2px; }
.top nav { display: flex; gap: 4px; }
.top nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.top nav a.on { color: var(--text); background: var(--panel2); }
main { max-width: 980px; margin: 0 auto; padding: 12px 12px calc(env(safe-area-inset-bottom) + 90px); }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; gap: var(--gap); align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: var(--gap); }
.card h3 { margin: 0 0 8px; font-size: 15px; }
.grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.btn { border: 1px solid var(--line); background: var(--panel2); padding: 8px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a4152; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a1205; font-weight: 600; }
.btn.danger { border-color: #5a2a24; color: #ffb3a8; }
.btn.ok { border-color: #1d5a45; color: #9fe6c9; }
.btn.small { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; width: 100%; }
textarea { resize: vertical; min-height: 44px; }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 15px; }
.check input { width: auto; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
.chip.running { color: #9fd2ff; border-color: #24476b; }
.chip.waiting { color: #1a1205; background: var(--accent); border-color: var(--accent); }
.chip.idle { color: #9fe6c9; border-color: #1d5a45; }
.chip.error { color: #ffb3a8; border-color: #5a2a24; }
.chip.stopped { color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--up); }
.bar.warn > i { background: var(--accent); }
.bar.bad > i { background: var(--danger); }
.sess { display: block; color: inherit; }
.sess .title { font-weight: 600; }
.sess .meta { font-size: 13px; color: var(--muted); }
.feed { display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 9px 12px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: #2a2414; border: 1px solid #4a3a16; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.msg pre { background: var(--bg); padding: 8px; border-radius: 8px; overflow-x: auto; white-space: pre; margin: 6px 0; }
.msg code { background: var(--bg); padding: 1px 4px; border-radius: 4px; }
.ev { font-size: 13px; color: var(--muted); padding: 0 4px; }
.ev.tool { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: #b9c0d0; }
.ev.err { color: #ffb3a8; }
details.tool summary { cursor: pointer; list-style: none; }
details.tool pre { white-space: pre-wrap; max-height: 280px; overflow: auto; background: var(--bg); padding: 8px; border-radius: 8px; margin: 4px 0 0; }
.req { border-color: var(--accent); }
.req pre { white-space: pre-wrap; max-height: 220px; overflow: auto; background: var(--bg); padding: 8px; border-radius: 8px; }
.opts { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.opts .btn { text-align: left; white-space: normal; }
.opts .btn.sel { border-color: var(--accent); background: #2a2414; }
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; background: rgba(15,17,21,.96); border-top: 1px solid var(--line);
  padding: 8px 12px calc(env(safe-area-inset-bottom) + 8px); }
.composer .in { max-width: 980px; margin: 0 auto; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { max-height: 40vh; }
.mic.on { background: var(--danger); border-color: var(--danger); color: #fff; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
.kv b { font-weight: 500; color: var(--muted); }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: var(--gap); overflow-x: auto; padding-bottom: 8px; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; min-height: 120px; }
.col h4 { margin: 2px 4px 8px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.task { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; margin-bottom: 8px; display: block; color: inherit; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet .box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 16px; width: 100%; max-width: 640px;
  max-height: 88vh; overflow: auto; padding-bottom: calc(env(safe-area-inset-bottom) + 16px); }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }
.badge { background: var(--accent); color: #1a1205; border-radius: 99px; padding: 0 7px; font-size: 12px; font-weight: 700; }
@media (min-width: 760px) { .msg { max-width: 80%; } }
.btn.icon { display: inline-flex; align-items: center; justify-content: center; padding: 8px 10px; }
.btn.icon svg { display: block; }
