:root {
  --bg: #0f1115; --panel: #171a21; --panel2: #1e222b; --line: #2a2f3a;
  --text: #e6e8ec; --muted: #8b93a3; --accent: #5b8cff;
  --ok: #22c55e; --warn: #eab308; --bad: #ef4444; --idle: #6b7280;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; }
.err { color: var(--bad); min-height: 1.5em; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 7px 14px; cursor: pointer; font: inherit; }
button.link { background: none; color: var(--muted); padding: 0; text-decoration: underline; }
button.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); }
button.danger { background: #7f1d1d; }
input, textarea { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px; font: inherit; margin-top: 4px; }
label { display: block; margin: 10px 0; color: var(--muted); font-size: 13px; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.login-box h1 { margin: 0; font-size: 22px; }
.login-box button[type=submit] { width: 100%; margin-top: 8px; }

header { display: flex; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.me { margin-left: auto; color: var(--muted); }
.tabs { display: flex; gap: 4px; }
.tabs button { background: none; color: var(--muted); padding: 6px 12px; }
.tabs button.active { background: var(--panel2); color: var(--text); }
.tabs.small button { font-size: 13px; padding: 4px 8px; }
.badge { background: var(--bad); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; margin-left: 4px; }
main { padding: 16px; max-width: 1400px; margin: 0 auto; }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.idle { background: var(--idle); }

.summary { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-width: 120px; }
.stat b { font-size: 22px; display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px; cursor: pointer; }
.card:hover { border-color: var(--accent); }
.card.bad { border-color: #7f1d1d; } .card.warn { border-color: #713f12; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h3 { margin: 0; font-size: 16px; }
.card-head .kind { margin-left: auto; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.meta { color: var(--muted); font-size: 12px; margin: 2px 0 10px; }
.bars { display: grid; grid-template-columns: 52px 1fr 56px; gap: 4px 8px; align-items: center; font-size: 12px; }
.bar { height: 6px; background: var(--panel2); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.hot { background: var(--bad); } .bar i.warm { background: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.chip { font-size: 11px; border-radius: 4px; padding: 1px 6px; background: var(--panel2); border: 1px solid var(--line); }
.chip.ok { border-color: #14532d; color: #86efac; } .chip.bad { border-color: #7f1d1d; color: #fca5a5; }
.chip.warn { border-color: #713f12; color: #fde68a; }

.chat { display: grid; grid-template-columns: 240px 1fr; gap: 12px; height: calc(100vh - 110px); }
aside { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: auto; padding: 8px; }
aside h4 { margin: 10px 8px 4px; color: var(--muted); font-size: 12px; font-weight: 500; }
.ch { display: flex; align-items: center; padding: 6px 8px; border-radius: 6px; cursor: pointer; gap: 6px; }
.ch:hover { background: var(--panel2); } .ch.active { background: var(--panel2); color: #fff; }
.ch .badge { margin-left: auto; }
.thread { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; min-width: 0; }
.thread-head { padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: 600; }
.messages { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 820px; }
.msg .who { font-size: 12px; color: var(--muted); }
.msg .who b { color: var(--text); font-weight: 600; }
.msg .who .tag { font-size: 10px; border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.msg .body { white-space: pre-wrap; word-break: break-word; background: var(--panel2); border-radius: 8px; padding: 8px 10px; margin-top: 2px; }
.msg.mine .body { background: #1e3a8a; }
.msg .mention { color: #93c5fd; font-weight: 600; }
.msg .reads { font-size: 11px; color: var(--muted); margin-top: 2px; }
.composer { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
.composer textarea { margin: 0; resize: vertical; }
.composer .attach { margin: 0; display: flex; align-items: center; cursor: pointer; font-size: 20px; padding: 0 4px; color: var(--text); }
.pending-files { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px 0; border-top: 1px solid var(--line); }
.pending-files .chip button { background: none; color: var(--muted); padding: 0 0 0 6px; }
.thread.dragging { outline: 2px dashed var(--accent); outline-offset: -6px; }
.atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.att-img { max-width: min(360px, 100%); max-height: 280px; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; display: block; background: var(--panel2); min-width: 80px; min-height: 60px; }
.att-file { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.att-file small { color: var(--muted); margin-left: 6px; }

.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 10; display: flex; justify-content: flex-end; }
.drawer-body { width: min(640px, 100%); background: var(--panel); height: 100%; overflow: auto; padding: 20px; border-left: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-top: 16px; }
.result { white-space: pre-wrap; color: var(--ok); }
.spark { width: 100%; height: 60px; display: block; }
code { background: var(--panel2); padding: 1px 4px; border-radius: 3px; }

.skills-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 12px 0; }
.skills-bar input[type=search] { max-width: 360px; }
label.inline { display: flex; gap: 6px; align-items: center; margin: 0; white-space: nowrap; }
label.inline input { width: auto; }
.skills-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.skills-wrap table { min-width: 720px; }
.skills-wrap th { position: sticky; top: 0; background: var(--panel); white-space: nowrap; }
.skills-wrap td.has, .skills-wrap td.no, .skills-wrap th.m { text-align: center; width: 64px; }
.skills-wrap td.has { color: var(--ok); }
.skills-wrap td.no { color: var(--line); }
.skills-wrap td.desc { color: var(--muted); font-size: 12px; max-width: 420px; }
.skills-wrap .src { font-size: 11px; color: var(--muted); margin-left: 6px; }

@media (max-width: 720px) {
  .chat { grid-template-columns: 1fr; height: auto; }
  aside { max-height: 200px; }
  .messages { min-height: 50vh; }
}
.skills-bar select { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font: inherit; }
