:root {
  --bg: #11161d; --panel: #171e27; --panel2: #1d2530; --line: #2a3441; --text: #e3e8ef; --muted: #8b97a7;
  --accent: #f2a93b; --accent2: #3b8ef2; --ok: #3fbf7f; --warn: #e0b341; --bad: #e5534b; --busy: #4aa3ff;
  --r: 10px; font-size: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, textarea, select { font: inherit; color: inherit; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 7px; padding: 5px 11px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: #1b1305; border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--bad); }
button.link { background: none; border: none; padding: 2px 4px; color: var(--muted); }
button.link:hover { color: var(--accent); }
input, textarea, select { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 7px 9px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
a { color: var(--accent2); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center-msg { max-width: 460px; margin: 12vh auto; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.center-msg h1 { margin: 0 0 6px; font-size: 22px; }
.center-msg .row { display: flex; gap: 8px; margin-top: 14px; }
.center-msg input { flex: 1; }
code, pre { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
pre.cmd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; white-space: pre-wrap; word-break: break-all; margin: 6px 0; }

/* 布局 */
.shell { display: grid; grid-template-rows: 48px 1fr; height: 100vh; }
header { display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
header .title { font-weight: 700; font-size: 15px; }
header .title b { color: var(--accent); }
header .spacer { flex: 1; }
.conn { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.main { display: grid; grid-template-columns: 240px 1fr 330px; min-height: 0; }
.col { min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.col:last-child { border-right: none; }
.col h3 { margin: 0; padding: 12px 14px 6px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .5px; }

/* 成员 */
.members { overflow: auto; padding-bottom: 12px; }
.member { display: flex; align-items: flex-start; gap: 9px; padding: 7px 14px; cursor: pointer; position: relative; }
.member:hover { background: var(--panel2); }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; background: #4a5462; }
.dot.online, .dot.ready { background: var(--ok); }
.dot.connected { background: var(--warn); }
.dot.busy { background: var(--busy); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.member .who { flex: 1; min-width: 0; }
.member .name { font-weight: 600; }
.member .st { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { display: inline-block; font-size: 10.5px; padding: 0 6px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); margin-left: 4px; vertical-align: 1px; font-weight: 500; }
.badge.ai { color: var(--accent); border-color: #5a4320; }
.badge.owner { color: var(--accent2); border-color: #23426b; }
.member .menu-btn { visibility: hidden; }
.member:hover .menu-btn { visibility: visible; }
.legend { padding: 10px 14px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); line-height: 1.7; }
.legend .dot { display: inline-block; margin: 0 4px 0 0; vertical-align: 0; }

/* 消息 */
.chat { background: var(--bg); }
.messages { flex: 1; overflow: auto; padding: 14px 18px; }
.msg { display: flex; gap: 10px; padding: 6px 0; }
.avatar { width: 32px; height: 32px; border-radius: 8px; background: var(--panel2); display: grid; place-items: center; font-weight: 700; flex: none; border: 1px solid var(--line); }
.msg.agent .avatar { color: var(--accent); border-color: #5a4320; }
.msg .body { flex: 1; min-width: 0; }
.msg .meta { font-size: 12px; color: var(--muted); }
.msg .meta b { color: var(--text); font-size: 13.5px; margin-right: 6px; }
.msg .text { white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; margin-top: 2px; }
.msg.mine .text { color: #f4f7fb; }
.mention { color: var(--accent); background: rgba(242,169,59,.12); border-radius: 4px; padding: 0 2px; }
.mention.me { background: rgba(242,169,59,.3); }
.quote { font-size: 12px; color: var(--muted); border-left: 2px solid var(--line); padding-left: 8px; margin: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.att { font-size: 12px; background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; text-decoration: none; color: var(--text); }
.jobs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
.job { font-size: 11.5px; padding: 2px 8px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); }
.job.leased { color: var(--busy); border-color: #1f4f80; }
.job.done { color: var(--ok); border-color: #1f5b3f; }
.job.failed, .job.dropped { color: var(--bad); border-color: #6b2a27; }
.sys { text-align: center; font-size: 12px; color: var(--muted); padding: 4px 0; }
.composer { border-top: 1px solid var(--line); padding: 10px 14px; background: var(--panel); position: relative; }
.composer textarea { width: 100%; resize: none; min-height: 44px; max-height: 160px; }
.composer .bar { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.composer .bar .spacer { flex: 1; }
.pending-atts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.ac { position: absolute; bottom: 100%; left: 14px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; min-width: 220px; max-height: 240px; overflow: auto; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.ac div { padding: 6px 10px; cursor: pointer; }
.ac div.sel, .ac div:hover { background: var(--line); }

/* 右栏 */
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; border: none; border-radius: 0; background: none; padding: 11px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.pane { flex: 1; overflow: auto; padding: 10px 12px; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-bottom: 9px; }
.task .t { font-weight: 600; }
.task .d { font-size: 12.5px; color: var(--muted); white-space: pre-wrap; margin: 4px 0; }
.task .res { font-size: 12.5px; white-space: pre-wrap; background: var(--bg); border-radius: 6px; padding: 6px 8px; margin: 6px 0; max-height: 160px; overflow: auto; }
.task .acts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.state { font-size: 11px; padding: 1px 7px; border-radius: 9px; margin-left: 6px; border: 1px solid var(--line); }
.state.open { color: var(--muted); } .state.claimed { color: var(--busy); } .state.submitted { color: var(--warn); }
.state.accepted { color: var(--ok); } .state.cancelled { color: var(--muted); text-decoration: line-through; }
.task-form { display: grid; gap: 6px; margin-bottom: 12px; }
.feed div { font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed #222b36; line-height: 1.5; }
.feed .tm { color: var(--muted); font-size: 11px; margin-right: 6px; font-variant-numeric: tabular-nums; }

/* 弹窗 */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: grid; place-items: center; z-index: 10; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px; width: min(560px, 94vw); max-height: 90vh; overflow: auto; }
.modal-box h2 { margin: 0 0 12px; font-size: 17px; }
.form { display: grid; grid-template-columns: 90px 1fr; gap: 9px 10px; align-items: center; }
.form .full { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 9px 16px; border-radius: 9px; z-index: 20; }
.toast.err { border-color: var(--bad); }
.banner { background: #3a1f1d; color: #ffd2cf; padding: 8px 14px; font-size: 13px; }

@media (max-width: 980px) {
  .main { grid-template-columns: 1fr; }
  .col.side, .col.left { display: none; }
  .main.show-left .col.left, .main.show-side .col.side { display: flex; position: fixed; top: 48px; bottom: 0; width: min(340px, 90vw); background: var(--panel); z-index: 5; }
  .main.show-left .col.left { left: 0; } .main.show-side .col.side { right: 0; }
}
@media (min-width: 981px) { .mobile-only { display: none; } }

/* ───── SaaS：首页 / 控制台 / 后台 ───── */
.logo { font-weight: 800; color: var(--accent); letter-spacing: .3px; text-decoration: none; }
a.back { font-size: 18px; text-decoration: none; }
.landing { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; max-width: 1040px; margin: 10vh auto; padding: 0 24px; align-items: center; }
.hero h1 { font-size: 34px; margin: 14px 0 10px; line-height: 1.25; }
.hero p { color: var(--muted); font-size: 15px; line-height: 1.7; }
.hero ul { padding-left: 18px; line-height: 2; }
.auth-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 24px; display: grid; gap: 10px; }
.auth-card .note { background: rgba(242,169,59,.12); border: 1px solid #5a4320; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.wide { width: 100%; padding: 9px; }
.oauth { text-decoration: none; }
.or { text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0; }
.tabs2 { display: flex; gap: 6px; }
.tabs2 button { flex: 1; }
.tabs2 button.on { border-color: var(--accent); color: var(--accent); }
header.top { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--panel); }
header.top .spacer { flex: 1; }
.dash { max-width: 1040px; margin: 0 auto; padding: 18px 22px 60px; }
.dash section { margin-bottom: 30px; }
.dash h2 { margin: 0; font-size: 20px; }
.dash h3 { font-size: 13px; color: var(--muted); font-weight: 600; margin: 18px 0 10px; }
.row-h { display: flex; align-items: center; gap: 8px; }
.state.bad { color: var(--bad); border-color: #6b2a27; }
.usage { display: grid; gap: 8px; margin-top: 12px; max-width: 520px; }
.usage > div { display: flex; align-items: center; gap: 10px; }
.meter { flex: 1; height: 7px; background: var(--panel2); border-radius: 4px; overflow: hidden; max-width: 260px; }
.meter div { height: 100%; background: var(--ok); }
.meter div.full { background: var(--bad); }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.room-card { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-decoration: none; color: var(--text); }
a.room-card:hover { border-color: var(--accent); }
.room-card.new { gap: 8px; }
.plans { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.plan { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; }
.plan.cur { border-color: var(--accent); }
.plan .price { font-size: 20px; font-weight: 700; }
table.admin { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin th, table.admin td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
table.admin th { color: var(--muted); font-weight: 600; }
@media (max-width: 800px) { .landing { grid-template-columns: 1fr; margin-top: 4vh; } }
