/**
 * style.css — 7xAgentChat 控制台（omp.sh 设计语言）
 * 设计令牌取自参考设计系统：纯黑底 ink 色阶、洋红/青双强调色、
 * Geist / JetBrains Mono 字体、8%/14% 白描边、12px 毛玻璃。
 * 全部 class 钩子与 app.js 一一对应，仅视觉层。
 */

/* ─── 设计令牌 ─────────────────────────────────────────── */

:root {
  --ink-0: #000;
  --ink-1: #0a0a0c;
  --ink-2: #111116;
  --ink-3: #16161d;
  --ink-5: oklch(50% .008 280);      /* faint */
  --ink-7: oklch(82% .005 280);      /* dim */
  --ink-9: oklch(97% 0 0);           /* fg */
  --accent: oklch(70% .24 340);      /* 洋红 */
  --accent-2: oklch(81% .14 200);    /* 青 */
  --ok: oklch(78% .16 150);
  --warn: oklch(82% .13 85);
  --err: oklch(68% .19 25);
  --rule: oklch(100% 0 0 / .08);
  --rule-strong: oklch(100% 0 0 / .14);
  --font-sans: "Geist", -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", ui-sans-serif, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --blur: 12px;
  --t: .15s cubic-bezier(.4, 0, .2, 1);
  --r-lg: 12px;
  --r-md: 8px;
}

/* ─── 基础 ─────────────────────────────────────────────── */

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ink-0);
  color: var(--ink-9);
  font: 14px/1.6 var(--font-sans);
  letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: oklch(70% .24 340 / .32); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.025em; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
code, pre, .invite-code, .seq, .chip, .contract-list li {
  font-family: var(--font-mono);
}
code {
  font-size: .86em;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--ink-1);
  color: var(--accent-2);
}
pre {
  margin: 8px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--ink-0);
  overflow: auto;
  font-size: 12px;
  max-height: 300px;
}
.hidden { display: none !important; }
.muted { color: var(--ink-7); }
.small { font-size: 12px; }
.dim { color: var(--ink-5); }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #26262e; border-radius: 9px; }
::-webkit-scrollbar-thumb:hover { background: #35353f; }

/* ─── 按钮 ─────────────────────────────────────────────── */

button {
  background: var(--ink-9);
  color: var(--ink-0);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  padding: 7px 14px;
  font-weight: 500;
  font-size: 13px;
  transition: transform var(--t), filter var(--t), border-color var(--t), background var(--t), color var(--t);
}
button:hover { filter: brightness(1.08); }
button:active { transform: scale(.98); }
button.primary {
  background: linear-gradient(135deg, var(--accent), oklch(60% .24 300));
  color: #fff;
  filter: none;
}
button.ghost {
  background: transparent;
  color: var(--ink-7);
  border-color: var(--rule);
  filter: none;
}
button.ghost:hover { border-color: var(--rule-strong); color: var(--ink-9); }
button.danger { background: transparent; color: var(--err); border-color: oklch(68% .19 25 / .35); filter: none; }
button.danger:hover { border-color: var(--err); }
button.ghost.danger { background: transparent; color: var(--err); border-color: oklch(68% .19 25 / .35); }
button:disabled { opacity: .5; cursor: not-allowed; }

/* ─── 输入 ─────────────────────────────────────────────── */

input, textarea, select {
  background: var(--ink-0);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 8px 11px;
  outline: none;
  width: 100%;
  color: var(--ink-9);
  transition: border-color var(--t);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 44px; }
label { display: block; font-size: 12px; color: var(--ink-7); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 5px; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-5) 50%), linear-gradient(135deg, var(--ink-5) 50%, transparent 50%);
  background-position: calc(100% - 16px) 55%, calc(100% - 11px) 55%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  background-color: var(--ink-0);
}

/* ─── 卡片 ─────────────────────────────────────────────── */

.card {
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.card:hover { border-color: var(--rule-strong); background: var(--ink-2); }
.card h3 { font-size: 14px; margin-bottom: 4px; }
.card .meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-5);
}
.card .meta b { color: var(--ink-7); font-weight: 500; font-family: var(--font-mono); }

.card-list { display: flex; flex-direction: column; gap: 10px; }

/* ─── 徽章 / 标签 ──────────────────────────────────────── */

.badge {
  display: inline-block;
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  line-height: 18px;
}
.chip, .status-chip, .type-badge, .role-chip, .unread-chip, .marker-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  border: 1px solid var(--rule);
  color: var(--ink-7);
  white-space: nowrap;
}
.chip { font-family: var(--font-mono); letter-spacing: .04em; }
.type-badge { border-color: var(--accent-2); color: var(--accent-2); font-family: var(--font-mono); }
.role-chip { color: var(--ink-5); }
.unread-chip { border-color: var(--warn); color: var(--warn); }

/* 状态色（变更请求 / 审批 / 房间） */
.status-chip.status-proposed, .status-chip.status-pending, .status-chip.status-open { border-color: var(--warn); color: var(--warn); }
.status-chip.status-accepted, .status-chip.status-claimed { border-color: var(--accent-2); color: var(--accent-2); }
.status-chip.status-in_progress { border-color: var(--accent); color: var(--accent); }
.status-chip.status-done, .status-chip.status-approved { border-color: var(--ok); color: var(--ok); }
.status-chip.status-rejected, .status-chip.status-expired, .status-chip.status-timeout, .status-chip.status-blocked { border-color: var(--err); color: var(--err); }

/* 结构化标记标签 */
.marker-tag { font-family: var(--font-mono); margin-right: 4px; }
.marker-DECISION { border-color: var(--accent); color: var(--accent); }
.marker-TODO { border-color: var(--warn); color: var(--warn); }
.marker-STATUS { border-color: var(--accent-2); color: var(--accent-2); }
.marker-RESULT { border-color: var(--ok); color: var(--ok); }

/* ─── 登录视图 ─────────────────────────────────────────── */

#view-login {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: #070b09; /* 品牌墨绿黑，粒子画布覆盖其上 */
}
#particle-canvas {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}
.particle-hint {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  letter-spacing: .16em;
  font-size: 11px;
  color: var(--ink-5);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
  z-index: 1;
}
#view-login::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(70% 60% at 50% 40%, #000 30%, transparent 100%);
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 2;
  width: min(420px, 92vw);
  padding: 32px;
  border: 1px solid var(--rule);
  border-radius: 16px;
  background: oklch(97% 0 0 / .03);
  backdrop-filter: blur(var(--blur));
  box-shadow: 0 24px 80px oklch(0% 0 0 / .6);
}
.login-card h1 {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -.03em;
  background: linear-gradient(120deg, #6affcb, #0fd18d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-card > p { margin: 6px 0 22px; font-size: 13px; }
.login-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--ink-0);
}
.login-tabs .tab {
  flex: 1;
  background: transparent;
  color: var(--ink-5);
  border: none;
  border-radius: 6px;
  padding: 6px;
  filter: none;
}
.login-tabs .tab.active { background: var(--ink-3); color: var(--ink-9); }
.login-card form button { width: 100%; margin-top: 8px; }
.error {
  margin-top: 14px;
  padding: 9px 12px;
  border: 1px solid oklch(68% .19 25 / .35);
  border-radius: var(--r-md);
  color: var(--err);
  font-size: 12px;
}

/* ─── 应用外壳 ─────────────────────────────────────────── */

#view-app { height: 100%; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--rule);
  background: oklch(0% 0 0 / .72);
  backdrop-filter: blur(var(--blur));
  position: sticky;
  top: 0;
  z-index: 40;
  flex: none;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.02em;
  background: linear-gradient(120deg, var(--ink-9), oklch(70% .24 340 / .85));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.logo-img { height: 18px; width: auto; display: block; }
.topbar nav { display: flex; gap: 4px; }
.nav-btn {
  background: transparent;
  border: none;
  color: var(--ink-5);
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: 13px;
  filter: none;
}
.nav-btn:hover { color: var(--ink-9); }
.nav-btn.active { background: var(--ink-3); color: var(--ink-9); }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 12px; }

.sse-status {
  padding: 7px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--warn);
  border-bottom: 1px solid oklch(82% .13 85 / .25);
  background: oklch(82% .13 85 / .06);
}

main { flex: 1; overflow: auto; }
.panel { padding: 24px; max-width: 1100px; margin: 0 auto; }
.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.panel-head h2 { font-size: 18px; }
.panel > h3 { font-size: 12px; color: var(--ink-5); text-transform: uppercase; letter-spacing: .08em; margin: 20px 0 10px; font-weight: 500; }

.two-col { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
.side-forms { display: flex; flex-direction: column; gap: 14px; }
.form-box, .side-box {
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px;
}
.form-box h3, .side-box h3 { font-size: 13px; margin-bottom: 12px; color: var(--ink-9); text-transform: none; letter-spacing: 0; }
.form-box button { width: 100%; margin-top: 6px; }

/* ─── 房间详情 ─────────────────────────────────────────── */

.room-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.msg-area {
  background: var(--ink-1);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 380px;
  overflow: hidden;
}
.message-list { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg {
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  background: var(--ink-0);
  padding: 10px 13px;
  max-width: 88%;
}
.msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--ink-5);
  margin-bottom: 4px;
}
.msg-head .who { font-weight: 600; color: var(--ink-7); font-size: 12px; }
.msg-head .seq { color: var(--ink-5); font-size: 10px; font-family: var(--font-mono); }
.msg-content { white-space: pre-wrap; word-break: break-word; font-size: 13px; }
.msg-content.system { color: var(--ink-5); font-style: italic; }
.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--rule);
  background: var(--ink-1);
  align-items: flex-end;
}
.composer select { width: 130px; flex: none; }
.composer textarea { flex: 1; }
.composer button { flex: none; }

.room-side { display: flex; flex-direction: column; gap: 14px; }
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.member-list li { display: flex; align-items: center; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.presence-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-5); display: inline-block; flex: none; }
.presence-listening { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.presence-online { background: var(--accent-2); box-shadow: 0 0 6px var(--accent-2); }
.presence-idle, .presence-offline { background: var(--ink-5); }
.pinned-contract { padding: 10px 12px; border: 1px dashed var(--rule-strong); border-radius: var(--r-md); font-size: 12px; }
.pinned-contract b { color: var(--accent-2); font-family: var(--font-mono); }
details summary { cursor: pointer; font-size: 12px; color: var(--ink-7); margin: 10px 0; }
.compact input, .compact textarea { margin-bottom: 8px; }
.contract-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.contract-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--ink-7); }
.pin-btn { padding: 2px 10px; font-size: 11px; }
.pinned { color: var(--ok); font-size: 11px; }

/* ─── 审批 / 变更请求 ──────────────────────────────────── */

.approval-actions { display: flex; gap: 8px; margin-top: 12px; }
.transition-list { list-style: none; margin: 10px 0 0; padding: 8px 10px; border-left: 2px solid var(--rule); font-size: 11px; color: var(--ink-5); display: flex; flex-direction: column; gap: 4px; font-family: var(--font-mono); }
.transition-deny { color: var(--err); }
.changes-select { width: 180px; margin-top: 10px; }

/* ─── 弹窗与提示 ───────────────────────────────────────── */

dialog {
  border: 1px solid var(--rule-strong);
  border-radius: 16px;
  background: var(--ink-1);
  color: var(--ink-9);
  padding: 26px;
  width: min(440px, 92vw);
  box-shadow: 0 24px 80px oklch(0% 0 0 / .7);
}
dialog::backdrop { background: oklch(0% 0 0 / .6); backdrop-filter: blur(4px); }
dialog h3 { margin-bottom: 8px; font-size: 16px; }
dialog p { font-size: 13px; color: var(--ink-7); margin: 0 0 14px; }
.invite-code {
  font-family: var(--font-mono);
  font-size: 26px;
  letter-spacing: .18em;
  text-align: center;
  padding: 16px;
  border: 1px dashed var(--rule-strong);
  border-radius: var(--r-lg);
  color: var(--accent-2);
  background: var(--ink-0);
}
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: oklch(97% 0 0 / .06);
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  backdrop-filter: blur(var(--blur));
  z-index: 100;
  animation: toast-in .2s var(--t);
}
.toast.err { border-color: oklch(68% .19 25 / .5); color: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ─── 响应式 ───────────────────────────────────────────── */

@media (max-width: 860px) {
  .two-col, .room-layout { grid-template-columns: 1fr; }
  .msg-area { height: 60vh; }
  .topbar { flex-wrap: wrap; gap: 8px; }
}
