:root[data-theme="dark"] {
  --bg: #08080b; --panel: #111116; --panel2: #18181f; --panel3: #22222b; --line: #2a2a34;
  --text: #f1f1f4; --muted: #9291a0; --accent: #ff5b3a; --accent2: #ffb22e; --accent-text: #1a0b04;
  --link: #ffb22e; --ok: #3ecf8e; --warn: #f0b34a; --bad: #ff6470; --info: #58b8ff;
  --shadow: 0 10px 34px rgba(0,0,0,.45); --glow: rgba(255,91,58,.20);
}
:root[data-theme="light"] {
  --bg: #f6f4f1; --panel: #ffffff; --panel2: #f6f3ef; --panel3: #ebe6df; --line: #e4ded5;
  --text: #1b1613; --muted: #6d655d; --accent: #e8431d; --accent2: #f5a10c; --accent-text: #1a0b04;
  --link: #b8370f; --ok: #17a568; --warn: #b9770a; --bad: #d8323c; --info: #1479c8;
  --shadow: 0 8px 28px rgba(60,35,10,.09); --glow: rgba(232,67,29,.12);
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); display: flex;
  font: 14.5px/1.5 Inter, "Segoe UI Variable", "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h3, h4 { margin: 0; text-wrap: balance; }
.grad { background: linear-gradient(135deg, var(--accent), var(--accent2)); }

/* ---------- sidebar ---------- */
#side { width: 228px; flex: none; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 2px 6px; }
.logo { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; border-radius: 10px;
  width: 34px; height: 34px; display: grid; place-items: center; font-size: 13px; letter-spacing: .03em; box-shadow: 0 4px 16px var(--glow); }
#nav { display: flex; flex-direction: column; gap: 3px; }
#nav button { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; background: transparent;
  border: 1px solid transparent; color: var(--muted); padding: 9px 10px; border-radius: 10px; font-weight: 550; }
#nav button svg { width: 18px; height: 18px; flex: none; }
#nav button:hover { color: var(--text); background: var(--panel2); }
#nav button.active { color: var(--text); background: var(--panel2); border-color: var(--line); box-shadow: inset 3px 0 0 var(--accent); }
#nav .count { margin-left: auto; font-size: 11.5px; background: var(--panel3); border-radius: 999px; padding: 1px 8px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-foot { margin-top: auto; }
.side-boss { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 12.5px; color: var(--muted); }
.side-boss b { display: block; color: var(--text); font-size: 13.5px; }

/* ---------- shell ---------- */
#app { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; }
header { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--bg); }
header h1 { font-size: 19px; font-weight: 680; }
main { flex: 1; overflow-y: auto; padding: 20px 24px 28px; }
.view { display: none; max-width: 1280px; margin: 0 auto; }
.view.active { display: block; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
.live.on i { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 22%, transparent); }

/* ---------- controls ---------- */
button { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 13px; cursor: pointer; font-weight: 550; transition: border-color .15s, background .15s; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .55; cursor: default; }
button.primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-text); border-color: transparent; box-shadow: 0 4px 16px var(--glow); }
button.primary:hover { filter: brightness(1.08); }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; border-radius: 10px; }
.icon-btn svg { width: 17px; height: 17px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px; min-width: 0; }
textarea { width: 100%; resize: vertical; display: block; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
::placeholder { color: var(--muted); opacity: .8; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-head > :last-child:not(h3) { margin-left: auto; }
.two { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.grid.wide { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); }
.grid .card { margin: 0; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
#agent-roles { margin-top: 8px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; user-select: none; color: var(--muted); background: var(--panel2); }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.tag { font-size: 11.5px; border-radius: 6px; padding: 2px 7px; background: var(--panel3); color: var(--muted); white-space: nowrap; }

.pill { --c: var(--muted); display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.pill.ready, .pill.accepted, .pill.done, .pill.approved { --c: var(--ok); }
.pill.busy, .pill.working, .pill.planning { --c: var(--info); }
.pill.review, .pill.revise, .pill.paused, .pill.onboarding, .pill.awaiting_approval, .pill.draft, .pill.assigned { --c: var(--warn); }
.pill.offline, .pill.login_needed, .pill.rejected, .pill.flagged, .pill.failed, .pill.stopped, .pill.needs_owner, .pill.no_api_key { --c: var(--bad); }
.pill.busy::before, .pill.working::before, .pill.planning::before, .pill.onboarding::before { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.avatar { --h: 230; width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 65% 55%), hsl(calc(var(--h) + 40) 65% 48%)); }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; border-radius: 8px; }

/* ---------- dashboard ---------- */
.hero { background: radial-gradient(900px 200px at 0% 0%, var(--glow), transparent 70%), var(--panel); }
.hero-title { font-size: 17px; font-weight: 680; margin-bottom: 10px; }
.composer .row { margin-top: 10px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--muted); font-size: 12.5px; }
.stat .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat .s { color: var(--muted); font-size: 12px; }
.bar { height: 6px; border-radius: 99px; background: var(--panel3); overflow: hidden; margin: 10px 0; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .4s; }
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 9px; cursor: pointer; }
.step:hover { background: var(--panel2); }
.step .n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--panel3); color: var(--muted); flex: none; }
.step.accepted .n { background: var(--ok); color: #fff; }
.step.working .n, .step.review .n, .step.revise .n { background: var(--info); color: #fff; }
.step.flagged .n, .step.rejected .n { background: var(--bad); color: #fff; }
.step .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.member .who { flex: 1; min-width: 0; }
.member .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-item { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.feed-item:first-child { border-top: 0; padding-top: 0; }
.feed-item .tx { flex: 1; min-width: 0; }
.feed-item .tx p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 26px 10px; }

/* ---------- chat ---------- */
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 120px); gap: 12px; }
.chat-wrap .composer { margin: 0; }
.chat { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 6px 4px 0; }
.msg { display: flex; gap: 10px; max-width: 860px; }
.msg.owner { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: var(--panel); border: 1px solid var(--line); border-radius: 4px 14px 14px 14px; padding: 9px 13px; min-width: 0; }
.msg.owner .bubble { border-radius: 14px 4px 14px 14px; background: color-mix(in srgb, var(--accent) 14%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.msg.error .bubble { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); }
.msg.accept .bubble { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
.msg.revise .bubble { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); }
.msg.system { align-self: center; max-width: 700px; }
.msg.system .bubble { background: transparent; border-style: dashed; color: var(--muted); font-size: 13px; border-radius: 12px; }
.msg .head { font-size: 12px; color: var(--muted); margin-bottom: 3px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.msg .who { color: var(--text); font-weight: 650; font-size: 13px; }
.msg .body { white-space: pre-wrap; word-break: break-word; }
.msg .body.clip { max-height: 7.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent); }
.msg .more { font-size: 12.5px; color: var(--accent); cursor: pointer; background: none; border: 0; padding: 4px 0 0; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 14px; overflow-x: auto; align-items: start; }
.col { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-height: 220px; }
.col h4 { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 10px; display: flex; justify-content: space-between; }
.task { background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 10px; margin-bottom: 9px; cursor: pointer; transition: border-color .15s, transform .15s; }
.task:hover { border-color: var(--accent); transform: translateY(-1px); }
.task .t { font-weight: 600; margin-bottom: 6px; }
.task .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ---------- agents / projects / packs ---------- */
.agent-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.agent-top .who { flex: 1; min-width: 0; }
.agent-top b { font-size: 15px; }
.agent .chips { margin-bottom: 12px; }
.boss-card { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; background: radial-gradient(700px 160px at 0% 0%, var(--glow), transparent 70%), var(--panel); }
.project .plan { color: var(--muted); margin: 8px 0; }
.project .report { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; margin-top: 10px; }
.files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.files a { font-size: 12.5px; color: var(--accent); text-decoration: none; border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; background: var(--panel2); }
.files a:hover { border-color: var(--accent); }
.pack p { margin: 6px 0; color: var(--muted); }
.kv { margin: 10px 0 0; }
.kv dt { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 12px; }
.kv dd { margin: 3px 0 0; white-space: pre-wrap; word-break: break-word; }
.kv ul { margin: 4px 0 0; padding-left: 18px; }

/* ---------- settings ---------- */
.settings { max-width: 640px; }
.form label { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin: 9px 0; color: var(--muted); font-size: 13.5px; }
.form label input, .form label select { width: 280px; }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(5,7,12,.6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; z-index: 20; }
.modal[hidden] { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: min(760px, 100%); max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
#modal-body { padding: 16px; overflow-y: auto; }
#modal-body pre { white-space: pre-wrap; word-break: break-word; font: 13px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin: 6px 0 0; }
#modal-body textarea { min-height: 260px; }
#modal-foot { padding: 12px 16px; border-top: 1px solid var(--line); justify-content: flex-end; }
#modal-foot:empty { display: none; }
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel3); border: 1px solid var(--line); border-radius: 11px; padding: 9px 15px; display: none; max-width: 90vw; box-shadow: var(--shadow); z-index: 30; }

/* ---------- small screens ---------- */
@media (max-width: 1000px) { .stats { grid-template-columns: repeat(2, 1fr); } .two { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  body { flex-direction: column-reverse; }
  #side { width: 100%; flex-direction: row; padding: 6px 8px; border-right: 0; border-top: 1px solid var(--line); gap: 0; }
  .brand, .side-foot, #nav .count { display: none; }
  #nav { flex-direction: row; width: 100%; justify-content: space-between; }
  #nav button { flex-direction: column; gap: 2px; font-size: 10.5px; padding: 6px 4px; justify-content: center; text-align: center; }
  #nav button.active { box-shadow: none; }
  #app { height: auto; flex: 1; min-height: 0; }
  header { padding: 10px 14px; } main { padding: 14px; }
  .board { grid-template-columns: repeat(5, 240px); }
  .grid, .grid.wide { grid-template-columns: 1fr; }
  .form label { flex-direction: column; align-items: stretch; gap: 4px; }
  .form label input, .form label select { width: 100%; }
  .chat-wrap { height: calc(100vh - 170px); }
}

/* =====================================================================
   PandaBoss look: final-boss red and gold, heavy display type
   ===================================================================== */
body { background:
  radial-gradient(1100px 520px at 88% -12%, var(--glow), transparent 62%),
  radial-gradient(900px 520px at -12% 112%, color-mix(in srgb, var(--accent2) 9%, transparent), transparent 62%),
  var(--bg); background-attachment: fixed; }
h1, .hero-title, .stat .v, .card-head h3, .col h4, .brand-sub, .hero-kicker { font-family: Oxanium, Bahnschrift, "Segoe UI", system-ui, sans-serif; }
header { background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: blur(10px); }
header h1 { font-size: 21px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  background: linear-gradient(90deg, var(--text) 30%, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.head-logo { display: none; }
.card-head h3 { text-transform: uppercase; letter-spacing: .07em; font-size: 13px; font-weight: 700; }
.files a, .msg .more { color: var(--link); }

/* sidebar */
#side { background: linear-gradient(180deg, var(--panel), color-mix(in srgb, var(--panel) 70%, var(--bg))); }
.brand { gap: 10px; padding: 0 2px; }
.brand-logo { width: 46px; height: 46px; filter: drop-shadow(0 4px 14px var(--glow)); }
.brand-word { display: block; width: 132px; height: auto; }
:root[data-theme="light"] .brand-word, :root[data-theme="light"] .login-card .wordmark { filter: drop-shadow(0 0 1px #000) drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.brand-sub { display: block; font-size: 10.5px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); margin-top: 1px; padding-left: 4px; }
#nav button.active { box-shadow: inset 3px 0 0 var(--accent); background: linear-gradient(90deg, var(--glow), transparent 85%), var(--panel2); }
#nav button.active svg { color: var(--accent2); }
#nav .count { background: color-mix(in srgb, var(--accent) 22%, var(--panel3)); color: var(--text); }
.side-boss { display: flex; gap: 10px; align-items: center; }
.side-boss img { width: 34px; height: 34px; flex: none; }

/* hero */
.hero { position: relative; overflow: hidden; padding: 20px 22px; border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: radial-gradient(700px 260px at 100% 0%, var(--glow), transparent 70%), linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, var(--panel)), var(--panel) 55%); }
.hero-emblem { position: absolute; right: 14px; top: -6px; width: 150px; height: 150px; opacity: .95; pointer-events: none; filter: drop-shadow(0 8px 28px var(--glow)); }
.hero-kicker { font-size: 11.5px; letter-spacing: .26em; text-transform: uppercase; color: var(--accent2); font-weight: 700; }
.hero-title { font-size: 25px; font-weight: 800; line-height: 1.2; margin: 4px 170px 12px 0; }
.hero textarea { max-width: calc(100% - 165px); min-height: 62px; background: color-mix(in srgb, var(--bg) 70%, transparent); }
.hero .row { position: relative; }

/* stats */
.stat { position: relative; overflow: hidden; padding: 16px 16px 14px 18px; }
.stat::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: linear-gradient(180deg, var(--accent), var(--accent2)); }
.stat .k { text-transform: uppercase; letter-spacing: .08em; font-size: 11.5px; }
.stat .v { font-size: 34px; font-weight: 800; line-height: 1.15; }
.stat:hover, .grid .card:hover, .task:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }

/* production line */
.line { display: flex; align-items: stretch; gap: 0; overflow-x: auto; padding: 4px 2px 6px; }
.node { flex: 1 0 112px; max-width: 170px; text-align: center; padding: 12px 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel2); position: relative; cursor: default; }
.node[data-task] { cursor: pointer; }
.node .ico { width: 38px; height: 38px; margin: 0 auto 7px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--panel3); color: var(--muted); font-family: Oxanium, sans-serif; }
.node .ico img { width: 38px; height: 38px; }
.node b { display: block; font-size: 12.5px; text-transform: capitalize; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node span { font-size: 11.5px; color: var(--muted); }
.node.accepted { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); } .node.accepted .ico { background: var(--ok); color: #04130c; }
.node.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 6px 22px var(--glow); } .node.active .ico { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: var(--accent-text); animation: pulse 1.2s infinite; }
.node.flagged, .node.rejected { border-color: color-mix(in srgb, var(--bad) 60%, var(--line)); } .node.flagged .ico, .node.rejected .ico { background: var(--bad); color: #fff; }
.node.idle { opacity: .5; }
.link { flex: 0 0 22px; align-self: center; height: 3px; border-radius: 3px; background: var(--panel3); }
.link.done { background: linear-gradient(90deg, var(--accent), var(--accent2)); }

/* chat with roster */
.chat-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; height: calc(100vh - 120px); }
.chat-layout .chat-wrap { height: auto; min-height: 0; }
.roster { margin: 0; overflow-y: auto; }
.roster .member { padding: 7px 0; }
.roster .who span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.roster .pill { font-size: 0; padding: 5px; gap: 0; }   /* status as a dot only; the name needs the room */
.roster .pill::before { width: 8px; height: 8px; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; display: block; }
.avatar.boss { background: #0b0b10; box-shadow: 0 0 0 1.5px var(--accent2); }
.working-note { font-size: 12.5px; color: var(--accent2); display: inline-flex; align-items: center; gap: 6px; }
.working-note:not(:empty)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent2); animation: pulse 1s infinite; }
.pinned { display: flex; gap: 12px; align-items: center; border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); border-radius: 12px; padding: 9px 13px;
  background: linear-gradient(90deg, var(--glow), transparent 70%), var(--panel); cursor: pointer; }
.pinned .lab { font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--accent2); font-weight: 700; display: block; }
.pinned .ti { flex: 1; min-width: 0; } .pinned b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg.owner .bubble { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--panel)), color-mix(in srgb, var(--accent2) 12%, var(--panel))); }

/* login */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-card { width: min(380px, 100%); text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 28px 24px; margin: 0; }
.login-card .wordmark { width: 230px; height: auto; }
.login-card input, .login-card button { width: 100%; text-align: center; font-size: 16px; padding: 11px; }
#err { color: var(--bad); min-height: 1.2em; margin: 0; }
.kbd { font-family: ui-monospace, Consolas, monospace; background: var(--panel3); border-radius: 6px; padding: 2px 7px; color: var(--text); user-select: all; }

/* phones */
.chat-layout > * { min-width: 0; }
@media (max-width: 900px) { .chat-layout { grid-template-columns: minmax(0, 1fr); } .roster { display: none; } }
@media (max-width: 760px) {
  .head-logo { display: block; }
  header h1 { font-size: 17px; }
  #side { padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(12px); }
  #nav button { border-radius: 12px; min-height: 50px; }
  #nav button.active { background: var(--glow); box-shadow: inset 0 -3px 0 var(--accent); color: var(--text); }
  .hero { padding: 16px; } .hero-emblem { width: 84px; height: 84px; right: 8px; top: 4px; }
  .hero-title { font-size: 19px; margin-right: 92px; } .hero textarea { max-width: 100%; }
  .composer .row > * { flex: 1 1 100%; } .composer .chips { flex: 1 1 100%; }
  .composer button.primary { padding: 12px; font-size: 15px; }
  .stats { gap: 10px; } .stat .v { font-size: 27px; }
  .chat-layout { height: calc(100dvh - 150px); } .chat-layout .composer { padding: 10px; }
  .chat-layout .composer textarea { min-height: 44px; height: 44px; }
  .chat-layout .c-samples { display: none; }
  .chat-layout .composer .row > *, .chat-layout .composer .chips { flex: 0 1 auto; }
  .chat-layout .composer .row { margin-top: 8px; gap: 6px; } .chat-layout .composer button.primary { margin-left: auto; padding: 9px 14px; }
  .msg { max-width: 100%; } input, select, textarea { font-size: 16px; }
  .modal { padding: 0; align-items: end; } .modal-box { border-radius: 18px 18px 0 0; max-height: 92vh; width: 100%; }
  button.small { padding: 7px 11px; }
}
