:root {
  --bg: #17181c;
  --panel: #23252b;
  --field: #2c2f36;
  --line: #3a3e47;
  --fg: #e8e8ea;
  --dim: #8d929c;
  --me: #5cc8a8;
  --them: #f0a050;
  --task: #8ab4f8;
  --done: #86d686;
  --warn: #ff8a80;
  --claude: #c9a7ff;
  --rail: #0e0f12;
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  font-family: "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  color: var(--fg);
  background: #161616;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
h1, h2, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
.dim { color: var(--dim); }
:focus-visible { outline: 2px solid var(--me); outline-offset: 2px; }

/* ---------- hive background */
.hive { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; }

/* ---------- hex building blocks */
.hex { display: inline-grid; place-items: center; clip-path: var(--hex); position: relative; }
.hex-44 { width: 44px; height: 50.8px; }
/* stretched hexagon (pointed left/right) with a 1px border: border colour = background, fill = ::before */
.hx {
  --k: 12px; --hx-bg: var(--field); --hx-border: var(--line);
  position: relative; isolation: isolate;
  background: var(--hx-border);
  clip-path: polygon(var(--k) 0, calc(100% - var(--k)) 0, 100% 50%, calc(100% - var(--k)) 100%, var(--k) 100%, 0 50%);
}
.hx::before {
  content: ""; position: absolute; inset: 1px; z-index: -1; background: var(--hx-bg);
  clip-path: polygon(var(--k) 0, calc(100% - var(--k)) 0, 100% 50%, calc(100% - var(--k)) 100%, var(--k) 100%, 0 50%);
}
.hx:focus-visible, .hx:focus-within { outline: none; --hx-border: var(--me); }
.hx-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 16px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.hx-btn:hover { --hx-bg: #353841; }
.hx-btn.primary { --hx-bg: var(--me); --hx-border: var(--me); color: #0b1f19; }
.hx-btn.primary:hover { --hx-bg: #72d6b8; }
.chev { width: 0; height: 0; border: 4px solid transparent; border-top-color: currentColor; margin-top: 4px; transition: transform .15s; }
[aria-expanded="false"] .chev { transform: rotate(-90deg); margin-top: 0; margin-left: 2px; }
.ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic .fill { fill: currentColor; stroke: none; }
.ic.them { color: var(--them); } .ic.me { color: var(--me); }
.hexdot { display: inline-block; width: 8px; height: 9.2px; clip-path: var(--hex); background: var(--dim); flex: none; }
.chip { --k: 6px; --hx-bg: #33363d; --hx-border: #454951; padding: 1px 9px; font-size: 10.5px; font-weight: 600; }

.logo { position: relative; display: inline-block; width: 30px; height: 22px; }
.logo i { position: absolute; top: 0; width: 18px; height: 21px; clip-path: var(--hex); background: var(--me); }
.logo i + i { left: 11px; background: var(--them); opacity: .92; }
.logo-lg { width: 40px; height: 28px; flex: none; }
.logo-lg i { width: 24px; height: 27.7px; }
.logo-lg i + i { left: 15px; }

/* ---------- layout */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 72px 400px 1fr; height: 100%; }

/* group rail */
.rail { background: rgba(14,15,18,.94); display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 0 16px; overflow-y: auto; scrollbar-width: none; }
.rail-item { position: relative; width: 72px; display: grid; place-items: center; height: 54px; flex: none; }
.rail-item .hex { font-weight: 700; font-size: 14px; transition: transform .15s; }
.rail-item:hover .hex { transform: translateY(-1px) scale(1.04); }
.rail-item:focus-visible { outline: none; }
.rail-item:focus-visible .hex { filter: drop-shadow(0 0 0 var(--me)) brightness(1.3); }
.hex-home { background: var(--field); }
.hex-home .logo { width: 28px; height: 20px; } .hex-home .logo i { width: 17px; height: 19.6px; } .hex-home .logo i + i { left: 11px; }
.hex-add { background: rgba(92,200,168,.12); color: var(--me); font-size: 22px; font-weight: 500; outline: 1px dashed rgba(92,200,168,.6); outline-offset: -6px; }
.hex-me { background: rgba(92,200,168,.2); color: var(--me); font-size: 16px; }
.online-dot { position: absolute; right: 12px; bottom: 4px; width: 14px; height: 16px; clip-path: var(--hex); background: var(--done); box-shadow: 0 0 0 3px var(--rail); }
.rail-divider { width: 32px; height: 2px; border-radius: 1px; background: var(--field); flex: none; }
.rail-spacer { flex: 1; }
.groups { display: flex; flex-direction: column; gap: 8px; }
.group .hex { color: var(--c); background: color-mix(in srgb, var(--c) 16%, transparent); }
.group .hex::after { content: ""; position: absolute; inset: 0; clip-path: var(--hex); box-shadow: inset 0 0 0 1px var(--c); }
.group.active .hex { background: var(--c); color: #0b1f19; }
.group::before { content: ""; position: absolute; left: 0; width: 4px; height: 0; border-radius: 0 2px 2px 0; background: var(--fg); transition: height .15s; }
.group.unread::before { height: 8px; }
.group:hover::before { height: 20px; }
.group.active::before { height: 36px; }
.badge { position: absolute; right: 8px; bottom: 2px; min-width: 18px; padding: 1px 5px; border-radius: 9px; background: #ef5350; color: #fff; font-size: 10px; font-weight: 700; box-shadow: 0 0 0 3px var(--rail); }

/* sidebar */
.sidebar { display: flex; flex-direction: column; min-height: 0; background: rgba(23,24,28,.82); backdrop-filter: blur(14px); border-right: 1px solid var(--field); }
.sb-header { position: relative; overflow: hidden; background: rgba(35,37,43,.88); padding: 18px 20px 16px; border-bottom: 1px solid rgba(92,200,168,.18); display: grid; gap: 14px; }
.honeycomb { position: absolute; top: -6px; right: -6px; width: 170px; height: 70px; pointer-events: none; opacity: .9;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='38.1' height='66' viewBox='0 0 38.1 66'%3E%3Cpath d='M19.05 1.5 36.6 11.5v20L19.05 41.5 1.5 31.5v-20zM0 44.5l17.55 10v20M38.1 44.5l-17.55 10' fill='none' stroke='%235cc8a8' stroke-opacity='.16'/%3E%3C/svg%3E");
  -webkit-mask-image: linear-gradient(225deg, #000 20%, transparent 75%); mask-image: linear-gradient(225deg, #000 20%, transparent 75%); }
.title-row { display: flex; align-items: center; gap: 12px; position: relative; }
.title-text { flex: 1; min-width: 0; }
h1 { font-size: 17px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you { font-size: 12px; color: var(--dim); margin-top: 2px; }
.you span { color: var(--me); font-weight: 500; }
.controls-row { display: flex; align-items: center; gap: 8px; position: relative; }
.people { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; }
.person { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.person b { font-weight: 600; color: var(--c); }
.person .hexdot { background: var(--c); }
.person.idle .hexdot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--dim); }
.status-line { display: flex; align-items: center; gap: 7px; padding: 10px 20px 4px; font-size: 11px; color: var(--dim); }
.status-line.ok .hexdot { background: var(--done); }
.status-line.bad { color: var(--warn); } .status-line.bad .hexdot { background: var(--warn); }
.icon-btn { width: 30px; height: 30px; border-radius: 6px; color: var(--dim); }
.icon-btn:hover { background: var(--field); color: var(--fg); }
.close-sidebar, .open-sidebar { display: none; }

/* task lists */
.tasks { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; padding: 8px 16px; max-height: 38%; overflow-y: auto; flex: none; }
.tasks[hidden] { display: none; }
.task-card { --k: 12px; --hx-bg: var(--panel); --hx-border: color-mix(in srgb, var(--c) 35%, var(--panel)); padding: 10px 14px 12px 16px; display: grid; gap: 6px; align-content: start; }
.task-card h3 { margin: 0; font-size: 12px; font-weight: 700; color: var(--c); display: flex; align-items: center; gap: 7px; }
.task-card h3 .hexdot { width: 10px; height: 11.5px; background: var(--c); }
.task-card .meta { font-size: 10px; color: var(--dim); }
.task-card li { display: flex; gap: 7px; font-size: 11px; line-height: 1.35; }
.task-card li .hexdot { margin-top: 3px; }
.task-card li.d { color: var(--dim); } .task-card li.d .hexdot { background: var(--done); opacity: .55; }
.task-card li.a { color: var(--task); font-weight: 600; } .task-card li.a .hexdot { background: var(--task); }
.task-card li.p .hexdot { background: transparent; box-shadow: inset 0 0 0 1.4px var(--dim); }
.tasks-empty { grid-column: 1 / -1; font-size: 11px; color: var(--dim); padding: 2px 4px 6px; }

/* feed */
.feed { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 20px 20px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.day { display: flex; align-items: center; gap: 10px; font-size: 10px; font-weight: 500; color: var(--dim); }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--field); }
.day span { --k: 8px; padding: 3px 12px; }
.msg { display: flex; gap: 10px; align-items: flex-start; }
.avatar { width: 28px; height: 32.3px; flex: none; font-size: 12px; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.avatar::after { content: ""; position: absolute; inset: 0; clip-path: var(--hex); box-shadow: inset 0 0 0 1.2px color-mix(in srgb, var(--c) 55%, transparent); }
.avatar.bot { background: color-mix(in srgb, var(--c) 12%, transparent); }
.avatar.bot::after { box-shadow: inset 0 0 0 1.4px var(--c); }
.msg-body { flex: 1; min-width: 0; }
.msg-name { font-size: 12px; font-weight: 600; color: var(--c); }
.msg-name time { color: var(--dim); font-weight: 400; margin-left: 8px; }
.msg-text { font-size: 13.5px; line-height: 1.45; margin-top: 2px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-text .d { color: var(--dim); } .msg-text .task { color: var(--task); } .msg-text .done { color: var(--done); } .msg-text .claude { color: var(--claude); }
.msg-text .q { --k: 6px; --hx-bg: #2c2638; --hx-border: #5a4a78; color: var(--claude); font-size: 10px; font-weight: 600; padding: 1px 8px; margin-right: 6px; vertical-align: 1px; }
.msg.pending { opacity: .55; }
.sys { font-size: 11.5px; color: #ffe08a; background: rgba(58,51,32,.7); border-radius: 6px; padding: 7px 10px; }
.feed-empty { margin: auto; text-align: center; color: var(--dim); font-size: 13px; max-width: 260px; line-height: 1.5; }

/* ---------- main */
.main { position: relative; min-width: 0; overflow-y: auto; display: grid; place-items: start center; padding: 24px 32px 32px; }
.stage { width: min(720px, 100%); display: grid; gap: 12px; }
.ball-wrap { display: flex; justify-content: center; height: clamp(180px, 34vh, 340px); }
.ball { display: block; height: 100%; width: auto; aspect-ratio: 400 / 420; flex: none; overflow: visible; }
.ball .spin { transform-origin: 200px 200px; animation: spin 60s linear infinite; }
.ball .bob { animation: bob 6s ease-in-out infinite; }
.ball .shadow { transform-origin: 200px 398px; animation: shadow 6s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 50% { transform: translateY(-10px); } }
@keyframes shadow { 50% { transform: scaleX(.86); opacity: .7; } }
.ball.kick .spin { animation-duration: 1.2s; }
@media (prefers-reduced-motion: reduce) { .ball * { animation: none !important; } }

.composer { display: flex; align-items: center; gap: 12px; }
.hx-input {
  --k: 22px; --hx-bg: var(--panel); --hx-border: color-mix(in srgb, var(--me) 35%, var(--panel));
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 14px 28px; min-height: 66px; cursor: text;
  filter: drop-shadow(0 10px 30px rgba(0,0,0,.45));
}
.hx-input .ic { width: 20px; height: 20px; color: var(--dim); }
.hx-input .attach { display: grid; place-items: center; flex: none; }
.hx-input .attach:hover .ic { color: var(--me); }
.hx-input .attach.busy { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.kbd { cursor: pointer; }
.kbd:hover { color: var(--fg); --hx-bg: #474b55; }
.file-card { --k: 10px; --hx-bg: #252f40; --hx-border: #3b4d6b; display: inline-flex; align-items: center; gap: 10px; padding: 7px 16px; margin-top: 4px; max-width: 100%; color: var(--fg); cursor: pointer; text-align: left; }
.file-card:hover { --hx-bg: #2c3850; }
.file-card .ic { color: var(--task); width: 18px; height: 18px; }
.file-card b { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.file-card small { font-size: 10.5px; color: var(--dim); }
.file-card.gone { opacity: .55; cursor: default; }
.hx-input { position: relative; }
.msg-wrap { flex: 1; position: relative; display: flex; min-width: 0; }
.msg-back { position: absolute; inset: 0; padding: 4px 0; font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: break-word; overflow: hidden; pointer-events: none; color: var(--fg); }
.msg-back .mention, .msg-text .mention { color: var(--me); font-weight: 700; }
.msg-back .mention { font-weight: inherit; background: color-mix(in srgb, var(--me) 18%, transparent); border-radius: 4px; }
.hx-input textarea { color: transparent; caret-color: var(--fg); position: relative; }
.hx-input textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hx-input textarea:placeholder-shown { white-space: nowrap; overflow: hidden; }
.mention-box { position: absolute; left: 40px; bottom: calc(100% + 6px); z-index: 30; min-width: 220px; max-height: 220px; overflow: auto; background: #15181c; border: 1px solid #2b3036; border-radius: 10px; padding: 4px; box-shadow: 0 8px 24px #0008; }
.mention-opt { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left; padding: 6px 10px; border-radius: 7px; background: none; border: 0; color: inherit; cursor: pointer; }
.mention-opt.on, .mention-opt:hover { background: #ffffff12; }
.mention-opt b { color: var(--me); }
.mention-opt small { color: var(--dim); }
.tip { position: fixed; z-index: 1000; max-width: 260px; padding: 6px 10px; border-radius: 8px; background: #0e1013; border: 1px solid #2b3036; color: #e8e8ea; font-size: 12.5px; line-height: 1.35; pointer-events: none; box-shadow: 0 6px 18px #0009; }
.hx-input textarea { flex: 1; background: none; border: 0; outline: 0; resize: none; font-size: 16px; line-height: 1.4; max-height: 160px; padding: 4px 0; overflow-y: hidden; }
.hx-input textarea.scroll { overflow-y: auto; }
.hx-input textarea::placeholder { color: var(--dim); }
.kbd { --k: 6px; --hx-bg: var(--line); --hx-border: var(--line); font-size: 10px; font-weight: 500; color: var(--dim); padding: 3px 10px; }
.send { width: 58px; height: 67px; clip-path: var(--hex); background: var(--me); display: grid; place-items: center; flex: none; transition: filter .15s, transform .1s; }
.send svg { width: 24px; height: 24px; fill: none; stroke: #0b1f19; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.send:hover { filter: brightness(1.12); }
.send:active { transform: scale(.95); }
.send:disabled { filter: grayscale(.7) brightness(.7); cursor: default; }
.send:focus-visible { outline: none; filter: brightness(1.25) drop-shadow(0 0 6px var(--me)); }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hx-tool { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; font-size: 12px; font-weight: 600; --hx-bg: #1f3a33; --hx-border: color-mix(in srgb, var(--me) 60%, #1f3a33); color: var(--me); }
.hx-tool .chip { --hx-bg: #24463d; --hx-border: #2f6b5b; }
.hx-tool[aria-expanded="false"] { --hx-bg: var(--field); --hx-border: var(--line); color: var(--fg); }
.hx-tool:hover { --hx-bg: #24463d; } .hx-tool[aria-expanded="false"]:hover { --hx-bg: #353841; }
.hint { flex: 1; text-align: right; font-size: 11px; color: var(--dim); }
.hint.warn { color: var(--warn); }

.panels { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.panel { --k: 16px; --hx-bg: var(--panel); padding: 16px 22px 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel[hidden] { display: none; }
.panels:has(.panel[hidden]) { grid-template-columns: 1fr; }
.panel-folders { --hx-border: color-mix(in srgb, var(--them) 30%, var(--panel)); }
.panel-agents { --hx-border: color-mix(in srgb, var(--me) 30%, var(--panel)); }
.panel-head { display: flex; align-items: center; gap: 8px; }
.panel-head h2 { flex: 1; font-size: 13px; font-weight: 600; }
.help { font-size: 11px; color: var(--dim); line-height: 1.45; }
.help.small { font-size: 10.5px; }
.link { color: var(--me); font-size: 12px; font-weight: 600; padding: 2px 4px; border-radius: 4px; }
.link:hover { text-decoration: underline; }
.link.danger { color: var(--warn); }
.rows { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.row { --k: 10px; --hx-bg: rgba(44,47,54,.7); --hx-border: transparent; display: flex; align-items: center; gap: 10px; padding: 7px 14px; }
.row .ic { width: 18px; height: 18px; color: var(--them); }
.row .txt { flex: 1; min-width: 0; display: grid; }
.row .txt b { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .txt span { font-size: 10.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .acc { cursor: pointer; }
.acc.rw { --hx-bg: #1f3a33; --hx-border: #2f6b5b; color: var(--me); }
.acc.ro { --hx-bg: #252f40; --hx-border: #3b4d6b; color: var(--task); }
.row .x { color: var(--dim); font-size: 14px; width: 20px; height: 20px; border-radius: 4px; flex: none; }
.row .x:hover { color: var(--warn); background: rgba(255,138,128,.1); }
.agent-row { --hx-bg: transparent; padding: 4px 10px; }
.agent-row:hover, .agent-row:focus-within { --hx-bg: rgba(44,47,54,.7); }
.agent-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; }
.agent-main:focus-visible { outline: none; }
.agent-row .avatar { width: 24px; height: 27.7px; font-size: 11px; }
.tag { font-size: 10px; color: var(--dim); }
.hx-search { --k: 10px; --hx-bg: var(--field); --hx-border: color-mix(in srgb, var(--me) 40%, var(--field)); display: flex; align-items: center; gap: 8px; padding: 8px 16px; color: var(--dim); }
.hx-search input { flex: 1; background: none; border: 0; outline: 0; font-size: 12px; color: var(--fg); min-width: 0; }
.add-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.add-form[hidden] { display: none; }
.add-form input { flex: 1 1 120px; min-width: 0; background: var(--field); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 12px; }
.add-form input:focus { outline: none; border-color: var(--me); }

/* ---------- dialogs + toast */
.dlg { border: 0; padding: 0; background: transparent; color: var(--fg); max-width: 440px; width: calc(100% - 32px); }
.dlg::backdrop { background: rgba(5,5,7,.7); backdrop-filter: blur(3px); }
.dlg-body { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 22px; display: grid; gap: 12px; }
.dlg h2 { font-size: 17px; }
.dlg label { display: grid; gap: 5px; font-size: 12px; color: var(--dim); }
.dlg input { background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; font-size: 14px; color: var(--fg); }
.dlg input:focus { outline: none; border-color: var(--me); }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; margin-top: 4px; }
.dlg-actions .grow { flex: 1; }
.dlg .hx-btn { padding: 9px 20px; font-size: 13px; }
.tabs { display: flex; gap: 4px; background: var(--field); border-radius: 8px; padding: 3px; }
.tab { flex: 1; padding: 7px; border-radius: 6px; font-size: 12.5px; color: var(--dim); }
.tab.on { background: var(--panel); color: var(--fg); font-weight: 600; }
.code-box { display: grid; gap: 8px; font-size: 12px; background: rgba(58,51,32,.6); border-radius: 8px; padding: 12px; color: #ffe08a; }
.code-box code, .code-row code { font-family: Consolas, monospace; font-size: 11.5px; word-break: break-all; background: var(--bg); color: var(--fg); padding: 8px; border-radius: 6px; user-select: all; }
.code-row { display: grid; gap: 8px; justify-items: start; }
.err { color: var(--warn); font-size: 12px; min-height: 0; }
.err:empty { display: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--panel); border: 1px solid var(--line); color: var(--fg); padding: 10px 16px; border-radius: 8px; font-size: 13px; transition: .2s; z-index: 10; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: var(--warn); }

/* ---------- mini groups (channels) + roles */
.channels { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 16px 2px; align-items: center; }
.chan { --k: 9px; --hx-bg: var(--field); --hx-border: var(--line); padding: 4px 14px; font-size: 12px; font-weight: 600; color: var(--dim); position: relative; }
.chan:hover { color: var(--fg); --hx-bg: #353841; }
.chan.on { color: #0b1f19; --hx-bg: var(--me); --hx-border: var(--me); }
.chan.unread { color: var(--fg); --hx-border: var(--them); }
.chan-add { color: var(--me); font-weight: 700; padding: 4px 12px; }
.chan-new { display: flex; gap: 6px; width: 100%; }
.chan-new input { flex: 1; min-width: 0; background: var(--field); border: 1px solid var(--me); border-radius: 6px; padding: 5px 8px; font-size: 12px; }
.chan-new input:focus { outline: none; }
.roles { display: grid; gap: 4px; padding: 8px 16px 2px; }
.roles[hidden] { display: none; }
.role-row { display: flex; align-items: center; gap: 8px; font-size: 12px; min-width: 0; }
.role-row .avatar { width: 20px; height: 23px; font-size: 10px; }
.role-row .who { font-weight: 600; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.role-chip { --k: 7px; --hx-bg: #2c2638; --hx-border: #5a4a78; color: var(--claude); font-size: 10.5px; font-weight: 600; padding: 1px 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40%; }
.role-row .none { color: var(--dim); font-size: 11px; }
.role-row .link { margin-left: auto; font-size: 11px; flex: none; }
.roles-empty { font-size: 11px; color: var(--dim); }
.msg-name .role-chip { margin-left: 6px; vertical-align: 1px; }
.dlg-select { background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; font-size: 14px; color: var(--fg); }
.dlg-select:focus { outline: none; border-color: var(--me); }
.sys.role { color: var(--claude); background: rgba(44,38,56,.8); }

/* ---------- first-run tutorial */
.tour { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: rgba(5,5,7,.72); backdrop-filter: blur(4px); animation: tourIn .2s ease-out; }
@keyframes tourIn { from { opacity: 0; } }
.tour-card { position: relative; width: min(440px, 100%); display: grid; gap: 14px; justify-items: center; text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 30px 28px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.tour-skip { position: absolute; top: 12px; right: 14px; color: var(--dim); font-size: 12px; }
.tour-skip:hover { color: var(--fg); }
.tour-badge { width: 72px; height: 83px; clip-path: var(--hex); display: grid; place-items: center; font-size: 30px; background: linear-gradient(160deg, #1f3a33, #2a2638); color: var(--me); }
.tour-title { font-size: 20px; }
.tour-text { font-size: 14px; line-height: 1.55; color: var(--dim); max-width: 360px; min-height: 66px; }
.tour-dots { display: flex; gap: 8px; }
.tour-dot { width: 10px; height: 11.5px; clip-path: var(--hex); background: var(--line); }
.tour-dot[aria-current="step"] { background: var(--me); }
.tour-dot:focus-visible { outline: none; background: var(--fg); }
.tour-nav { display: flex; gap: 10px; justify-content: center; width: 100%; }
.tour-nav .hx-btn { padding: 9px 22px; font-size: 13px; min-width: 104px; justify-content: center; }
.tour-nav .hx-btn:disabled { opacity: .4; cursor: default; }
.settings-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .tour { animation: none; } }

/* ---------- install + safety */
.steps { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 13px; line-height: 1.45; }
.safety { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 12px; color: var(--dim); }
.safety summary { cursor: pointer; color: var(--fg); font-weight: 600; }
.safety ul { margin: 8px 0 2px; padding-left: 18px; display: grid; gap: 6px; line-height: 1.45; }
.safety b { color: var(--fg); font-weight: 600; }
.dev-tag { --k: 6px; --hx-bg: #3a3320; --hx-border: #6b5a2a; color: #ffe08a; font-size: 10px; font-weight: 600; padding: 1px 8px; margin-left: 6px; vertical-align: 1px; }
.file-card.risky { --hx-bg: #3a2424; --hx-border: #7a3b3b; }
.file-card.risky .ic { color: var(--warn); }
button.dl-btn { font: inherit; font-size: 11.5px; font-weight: 600; }
@media (display-mode: standalone) { .dl-btn { display: none; } }

/* ---------- To: picker + pairing */
.to-pick { --k: 14px; --hx-bg: var(--panel); --hx-border: color-mix(in srgb, var(--me) 35%, var(--panel)); display: flex; align-items: center; gap: 6px; padding: 0 16px 0 22px; height: 66px; flex: none; max-width: 210px; color: var(--dim); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.to-pick select { background: transparent; border: 0; color: var(--fg); font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; max-width: 150px; cursor: pointer; outline: none; }
.to-pick select option { background: var(--panel); color: var(--fg); }
.to-pick.mine { --hx-border: var(--task); color: var(--task); }
.to-pick.claude { --hx-border: color-mix(in srgb, var(--claude) 70%, var(--panel)); color: var(--claude); }
.pair-box { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 12px; display: grid; gap: 8px; margin: 0; }
.pair-box legend { font-size: 12px; color: var(--fg); font-weight: 600; padding: 0 4px; }
.pair-row { display: flex; gap: 8px; }
.pair-row input { flex: 1; min-width: 0; font-family: Consolas, monospace; font-size: 12px !important; }
.msg-text .to { --k: 6px; --hx-bg: #252f40; --hx-border: #3b4d6b; color: var(--task); font-size: 10px; font-weight: 600; padding: 1px 8px; margin-right: 6px; vertical-align: 1px; }
.msg-text .ack { color: var(--done); font-size: 11px; margin-left: 8px; white-space: nowrap; }
.msg-text .wait { color: var(--dim); font-size: 11px; margin-left: 8px; white-space: nowrap; }
.pair-get { display: grid; gap: 8px; margin-top: 8px; }
.pair-one { display: grid; gap: 10px; }
.pair-target { display: grid; gap: 5px; font-size: 12px; color: var(--dim); }
.pair-one .hx-btn.big { width: 100%; }
.pair-wait { display: grid; gap: 8px; justify-items: center; text-align: center; padding: 6px 0; }
.pair-sas { font-family: Consolas, monospace; font-size: 30px; font-weight: 700; letter-spacing: .12em; color: var(--me); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px 18px; }
.pair-other { font-size: 12px; color: var(--dim); }
.pair-other summary { cursor: pointer; color: var(--fg); font-weight: 600; padding: 2px 0; }
.pair-get > .hx-btn { justify-self: start; text-decoration: none; color: var(--me); --hx-bg: #1f3a33; --hx-border: color-mix(in srgb, var(--me) 60%, #1f3a33); }
.pair-get > .hx-btn:hover { --hx-bg: #24463d; }
.steps.small { font-size: 12px; gap: 6px; color: var(--dim); }
.steps.small b { color: var(--fg); font-weight: 600; }
.cmd { display: flex; align-items: center; gap: 8px; margin-top: 4px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; min-width: 0; }
.cmd code { flex: 1; min-width: 0; font-family: Consolas, monospace; font-size: 11.5px; color: var(--fg); overflow-x: auto; white-space: nowrap; }
.cmd .link { flex: none; font-size: 11px; }
.help.small a { color: var(--me); }

/* ---------- screens: main menu + groups home */
.screen { position: relative; z-index: 1; height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 64px 20px 32px; }
.auth-card { width: min(400px, 100%); display: grid; gap: 14px; background: rgba(35,37,43,.9); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 14px; padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.ball-menu { height: 150px; justify-self: center; margin: -96px 0 -6px; }
.brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 24px; }
.auth-form { display: grid; gap: 11px; }
.auth-form label, .dlg label { display: grid; gap: 5px; font-size: 12px; color: var(--dim); }
.auth-form input:not([type="checkbox"]) { background: var(--field); border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; font-size: 14px; color: var(--fg); }
.auth-form input:focus { outline: none; border-color: var(--me); }
.auth-form label.check { display: flex; align-items: center; gap: 8px; color: var(--fg); font-size: 12.5px; cursor: pointer; }
.auth-form label.check input { accent-color: var(--me); width: 16px; height: 16px; }
.hx-btn.big { justify-content: center; padding: 12px 20px; font-size: 14px; margin-top: 4px; }
.hx-btn:disabled { opacity: .4; filter: grayscale(.8); cursor: not-allowed; }
.ok-msg { color: var(--done); font-size: 12.5px; line-height: 1.45; }
.ok-msg:empty { display: none; }
.help.center { text-align: center; }

.home { place-items: start center; }
.home-inner { width: min(860px, 100%); display: grid; gap: 18px; }
.home-head { display: flex; align-items: center; gap: 14px; background: rgba(35,37,43,.88); backdrop-filter: blur(14px); border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; }
.ball-home { height: 64px; flex: none; }
.home-head h1 { font-size: 20px; }
.home-head p { font-size: 12px; margin-top: 2px; }
.grow { flex: 1; }
.section-title { font-size: 13px; font-weight: 600; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; padding-left: 4px; }
.group-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.gcard { --k: 18px; --hx-bg: var(--panel); --hx-border: color-mix(in srgb, var(--c) 40%, var(--panel)); display: grid; justify-items: center; gap: 8px; padding: 20px 26px 18px; text-align: center; min-height: 168px; align-content: center; transition: transform .15s; }
.gcard:hover { transform: translateY(-2px); --hx-bg: #2a2d34; }
.gcard .hex { width: 54px; height: 62.3px; font-weight: 700; font-size: 17px; color: var(--c); background: color-mix(in srgb, var(--c) 18%, transparent); }
.gcard b { font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard small { font-size: 11px; color: var(--dim); }
.gcard .badge { position: static; box-shadow: none; }
.gcard.action { --hx-border: color-mix(in srgb, var(--me) 45%, var(--panel)); --c: var(--me); }
.gcard.action .hex { font-size: 26px; font-weight: 500; }
.gcard.action.join { --c: var(--task); --hx-border: color-mix(in srgb, var(--task) 45%, var(--panel)); }

.dl-btn { position: fixed; top: 12px; right: 16px; z-index: 6; text-decoration: none; color: var(--me); --hx-bg: #1f3a33; --hx-border: color-mix(in srgb, var(--me) 60%, #1f3a33); font-size: 11.5px; padding: 6px 16px; }
.dl-btn:hover { --hx-bg: #24463d; }
.dl-btn .ic { width: 14px; height: 14px; }
.in-app .dl-btn { display: none; }
.update-bar { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 7; display: flex; gap: 12px; align-items: center; background: #3a3320; color: #ffe08a; border-radius: 8px; padding: 8px 14px; font-size: 13px; }
.update-bar button { background: #ffd166; color: #2a2100; font-weight: 600; border-radius: 6px; padding: 5px 12px; }

/* ---------- smaller screens */
@media (max-width: 1180px) { .app { grid-template-columns: 72px 340px 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 72px 1fr; }
  .sidebar { position: fixed; z-index: 5; left: 72px; top: 0; bottom: 0; width: min(400px, calc(100% - 72px)); transform: translateX(calc(-100% - 80px)); visibility: hidden; transition: transform .2s, visibility .2s; background: rgba(23,24,28,.97); }
  .app.sb-open .sidebar { transform: none; visibility: visible; }
  .close-sidebar { display: grid; place-items: center; }
  .open-sidebar { display: inline-flex; position: sticky; top: 0; justify-self: start; z-index: 2; margin-bottom: 8px; }
  .main { padding: 16px; place-items: start stretch; }
  .stage { justify-self: center; }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .app { grid-template-columns: 60px 1fr; }
  .rail-item { width: 60px; }
  .sidebar { left: 60px; width: calc(100% - 60px); }
  .hx-input { padding: 10px 20px; min-height: 56px; }
  .kbd, .hint { display: none; }
  .composer { flex-wrap: wrap; }
  .to-pick { height: 44px; max-width: none; order: -1; flex-basis: 100%; }
}

.sub-switch { display: flex; gap: 14px; justify-content: center; margin: 4px 0 2px; font-size: 13px; }
.sub-switch .link { opacity: .6; }
.sub-switch .link.on { opacity: 1; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }

.hx-input textarea { min-height: calc(1.4em + 8px); }

.update-btn { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 7; font-size: 12.5px; padding: 7px 20px; animation: pulse 1.6s ease-in-out infinite; }
