/* ==========================================================================
 * Agent Hive — 原型主题（严格对齐 Hive-UI原型/*.dc.html）
 * 墨黑 #1D1C1A / 米白 #FAF9F7 / 暖纸 #ECEAE6 / 琥珀 #F5B800
 * 覆盖 style.css 的基础变量与控件外观；功能样式（timeline/presence 等）
 * 仍由 style.css 提供。
 * ========================================================================== */

/* ---------- 设计令牌（覆盖 style.css 的 :root） ---------- */
:root {
  --ink: #1D1C1A;
  --ink-2: #2A2925;
  --ink-3: #3D3B37;
  --paper: #FAF9F7;
  --paper-2: #F2EFE9;
  --paper-3: #F4F2EE;
  --paper-4: #F7F5F1;
  --surface: #FFFFFF;
  --chrome: #ECEAE6;

  --line: #E6E3DD;
  --line-2: #EFECE7;
  --line-3: #E2DED7;
  --line-4: #D6D1C9;
  --line-5: #BDB7AE;

  --tx: #1D1C1A;
  --tx-2: #5E5A53;
  --tx-3: #77736C;
  --tx-4: #8A877F;

  --amber: #F5B800;
  --amber-deep: #EBCB63;
  --amber-soft: #FFFBEA;
  --amber-note: #FFF8E1;
  --green: #1F8A4C;
  --green-deep: #1F5E3A;
  --green-soft: #E9F5EE;
  --green-line: #B7DCC6;
  --rust: #A3341F;
  --gold-text: #8A5800;

  --r-sm: 5px;
  --r-lg: 10px;
  --r-xl: 12px;

  --nav-w: 224px;
  --rail-w: 300px;
  --aside-w: 260px;
  --head-h: 64px;
}

/* 旧变量映射到新色板，避免 style.css 里的老样式脱色 */
:root {
  --bg: var(--paper);
  --text: var(--tx);
  --text-2: var(--tx-2);
  --text-3: var(--tx-3);
  --border: var(--line);
  --border-strong: var(--line-4);
  --card: var(--surface);
  --accent: var(--ink);
  --accent-fg: #ffffff;
  --muted: var(--paper-2);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tx);
  background: var(--surface);
}

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ---------- 原型控件外观 ---------- */
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--ink);
  width: 16px; height: 16px; margin: 0; flex: none;
}

input[type="text"], input[type="number"], input[type="password"],
input:not([type]), textarea, select {
  border: 1px solid var(--line-4);
  border-radius: var(--r);
  padding: 0 9px;
  height: 32px;
  font-size: 13px;
  color: var(--tx);
  background: var(--surface);
  width: 100%;
}
textarea { height: auto; padding: 8px 10px; line-height: 1.6; resize: vertical; }
input:focus, textarea:focus, select:focus {
  outline: 2px solid var(--amber);
  outline-offset: -1px;
  box-shadow: none;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; background: var(--line-4);
  padding: 0; border: none; width: 100%;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 8px;
  background: var(--ink); cursor: pointer; border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

/* 药丸按钮 */
.pill {
  height: 30px; padding: 0 14px; border-radius: 15px; font-size: 12.5px;
  border: 1px solid var(--line-4); background: var(--surface); color: var(--tx);
  transition: background .12s, color .12s, border-color .12s;
}
.pill:hover { border-color: var(--tx-3); }
.pill.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* 按钮 */
.btn {
  height: 32px; padding: 0 14px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line-4); background: var(--surface); color: var(--tx);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--tx-3); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.btn.accent { background: var(--amber); border-color: var(--amber); color: var(--ink); font-weight: 600; }
.btn.danger, .btn.rust { color: var(--rust); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; }

.linkbtn {
  border: none; background: none; padding: 4px 0;
  color: var(--gold-text); font-size: 12.5px; cursor: pointer; align-self: flex-start;
}

.dot { width: 8px; height: 8px; border-radius: 4px; flex: none; display: inline-block; }
.dot.on, .dot-user.human-online { background: var(--green); }
.dot.sleep { background: var(--tx-4); }
.dot.pending { background: #C77700; }

/* 卡片 / 字段 */
.card {
  background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.card h2 { font-size: 14px; font-weight: 700; }
.card .hint, .p7-hint { color: var(--tx-2); font-size: 12px; line-height: 1.6; }

.f { display: flex; flex-direction: column; gap: 4px; }
.f > span { font-size: 12px; color: var(--tx-2); }
.f.row { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; }
.f.row > span { font-size: 13px; color: var(--tx); }
.field-check { display: flex; gap: 10px; align-items: center; margin: 0; cursor: pointer; }
.field-check > span, .field-check > .field-label { display: inline; margin: 0; font-weight: 400; cursor: pointer; }
.field-check input[type="checkbox"] { flex: none; width: 16px; margin: 0; }
.field-hint { font-weight: 400; color: var(--tx-3); font-size: 12px; }

.empty, .empty-state {
  color: var(--tx-2); font-size: 12px; padding: 22px; text-align: center;
  background: var(--paper-3); border-radius: 8px; border: none;
}

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 9px 16px; border-radius: 8px;
  font-size: 13px; z-index: 90; box-shadow: 0 6px 24px rgba(29,28,26,.22);
}
.toast.err { background: var(--rust); }

.tag {
  font-size: 11px; background: var(--paper-2); color: var(--tx-2);
  border-radius: 5px; padding: 2px 7px; display: inline-flex; align-items: center; gap: 4px;
}
.tag.amber { background: var(--amber-note); border: 1px solid var(--amber-deep); color: #4A3A12; }
.tag.green { background: var(--green-soft); border: 1px solid var(--green-line); color: var(--green-deep); }
.tag.chip-key {
  font-family: var(--mono); background: #FFF3C4; border: 1px solid var(--amber-deep);
  color: var(--ink); padding: 2px 8px;
}
.tag.rust { background: #FBEDEA; border: 1px solid #E8C4BC; color: var(--rust); }
.mono { font-family: var(--mono); }

/* ---------- 骨架：左导航 + 主区 ---------- */
.app { display: flex; height: 100vh; overflow: hidden; }

.nav {
  width: var(--nav-w); flex-shrink: 0;
  background: var(--chrome); border-right: 1px solid var(--line-3);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 4px;
  overflow-y: auto;
}
.nav .dots { display: flex; gap: 8px; padding: 2px 6px 18px; }
.nav .dots i { width: 12px; height: 12px; border-radius: 6px; display: block; }
.nav .brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 4px; }
.nav .brand b { font-size: 16px; font-weight: 700; }
.nav .status { display: flex; align-items: center; gap: 6px; padding: 0 6px 16px;
  color: var(--tx-2); font-size: 11.5px; }
.nav .status i { width: 7px; height: 7px; border-radius: 4px; background: var(--green); }
.nav .cap { padding: 8px 8px 4px; font-size: 11px; font-weight: 600; color: var(--tx-2); }
.nav .item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 8px; border-radius: 6px; color: var(--tx); text-decoration: none;
  font-size: 13px; cursor: pointer; border: none; background: none;
  width: 100%; text-align: left;
}
.nav .item:hover { background: rgba(255,255,255,.5); }
.nav .item.on { background: #D9D4CC; font-weight: 600; }
.nav .item .cnt { font-size: 11px; background: var(--ink); color: #fff;
  border-radius: 8px; padding: 0 6px; }
.nav .item .cnt.amber { background: transparent; color: var(--gold-text); }
.nav .foot {
  margin-top: auto; border-top: 1px solid var(--line-3); padding: 12px 8px 0;
  display: flex; flex-direction: column; gap: 4px;
}
.nav .foot b { font-weight: 600; }
.nav .foot span { color: var(--tx-2); font-size: 11.5px; }

.main { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.main-head {
  height: var(--head-h); flex-shrink: 0; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px; gap: 16px;
}
.main-head h1 { font-size: 18px; font-weight: 700; }
.main-head .sub { color: var(--tx-2); font-size: 12px; }
.main-body { flex-grow: 1; display: flex; min-height: 0; }

/* 两栏 */
.split { display: flex; flex-grow: 1; min-height: 0; }
.split > .col-a {
  width: 470px; flex-shrink: 0; border-right: 1px solid var(--line);
  padding: 22px 28px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 18px; box-sizing: border-box;
}
.split > .col-b {
  flex-grow: 1; min-width: 0; padding: 22px 28px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 14px; background: var(--paper);
}
.split > .col-b.plain { background: var(--surface); }

.rail {
  width: var(--rail-w); flex-shrink: 0; border-left: 1px solid var(--line);
  background: var(--paper); padding: 18px 20px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 12px; overflow-y: auto;
}
.rail h3 { font-size: 14px; font-weight: 700; }
.rail .note { color: var(--tx-2); font-size: 12px; }

/* 表格（Agent 池） */
.tbl { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.tbl-head, .tbl-row {
  display: grid;
  grid-template-columns: 40px minmax(0,2.2fr) minmax(0,2fr) minmax(0,1.2fr) minmax(0,1.8fr) 120px;
  align-items: center; padding: 10px 14px;
}
.tbl-head { background: var(--paper); border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; color: var(--tx-2); }
.tbl-row { border-bottom: 1px solid var(--line-2); background: var(--surface); }
.tbl-row:last-child { border-bottom: none; }
.tbl-row.on { background: var(--amber-soft); }
.tbl-row .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tbl-row .av, .msg .av {
  width: 30px; height: 30px; border-radius: 8px; background: var(--paper-2);
  border: 1px solid var(--line-3); display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.tbl-row .nm { display: flex; flex-direction: column; min-width: 0; }
.tbl-row .nm b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-row .nm span { font-size: 11.5px; color: var(--tx-2); }
.tbl-row .role { color: var(--ink-3); padding-right: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl-row .st { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.tbl-row .teams { display: flex; gap: 4px; flex-wrap: wrap; }
.tbl-row .teams .t { font-size: 11.5px; background: var(--paper-2);
  border-radius: 5px; padding: 2px 7px; }
.tbl-row .teams .none { font-size: 11.5px; color: var(--gold-text); }
.tbl-row .acts { display: flex; gap: 6px; justify-content: flex-end; }

/* 槽位卡 */
.slot {
  border: 1px solid var(--line-3); background: var(--surface);
  border-radius: 10px; padding: 10px 12px;
}
.slot.on { border-color: var(--amber-deep); background: var(--amber-soft); }
.slot > label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.slot > label b { font-weight: 600; flex-grow: 1; }
.slot > label .via { font-size: 11.5px; color: var(--tx-2); }
.slot .pair {
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 8px; margin-top: 10px;
}
.slot .pair .f input { height: 30px; }

/* 分享区 */
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.share-head .right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--tx-2); }
.share-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.share-text {
  margin: 0; flex-grow: 1; min-height: 200px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 10px; padding: 16px 18px;
  font-family: "JetBrains Mono", var(--mono); font-size: 12px; line-height: 1.7;
  white-space: pre-wrap; color: var(--ink-2);
}
.share-acts { display: flex; align-items: center; gap: 10px; }
.share-acts .hint { color: var(--tx-2); font-size: 12px; }

/* Key 列表 */
.keys { border-top: 1px solid var(--line); padding-top: 12px;
  display: flex; flex-direction: column; gap: 6px; }
.keys .cap { font-size: 12px; font-weight: 600; color: var(--tx-2); }
.key-row {
  display: grid; grid-template-columns: 130px 90px 90px 1fr auto;
  gap: 16px; font-size: 12px; align-items: center; padding: 3px 0;
}
.key-row .k { font-family: var(--mono); }
.key-row .dim { color: var(--tx-2); }
.key-row .done { color: var(--green); }
.key-row .revoked { color: var(--rust); }

/* 步进器 / 滑块 */
.stepper { display: flex; align-items: center; border: 1px solid var(--line-4);
  border-radius: 7px; overflow: hidden; }
.stepper button { width: 32px; height: 30px; border: none; background: var(--paper-3);
  font-size: 15px; color: var(--tx); }
.stepper button:hover { background: var(--paper-2); }
.stepper .val { width: 44px; text-align: center; font-weight: 600; font-size: 13px; }

/* 设置页网格 */
.grid2 { flex-grow: 1; overflow-y: auto; padding: 20px 28px;
  display: grid; grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px; align-content: start; background: var(--paper); }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }

.note-box { background: var(--amber-note); border: 1px solid var(--amber-deep);
  border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.6; color: #4A3A12; }

.rowline { display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line-2); padding-top: 10px; gap: 10px; }
.rowline:first-of-type { border-top: none; padding-top: 0; }
.rowline b { font-weight: 600; }

/* 对话 */
.chat { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-stream { flex-grow: 1; overflow-y: auto; padding: 18px 28px;
  display: flex; flex-direction: column; gap: 14px; }
.chat-day { align-self: center; font-size: 11.5px; color: var(--tx-2); }
.msg {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 10px; padding: 12px 14px;
}
.msg.self { background: var(--amber-soft); border-color: var(--amber-deep); }
.msg.sys { align-self: center; background: var(--paper-3); border: none;
  border-radius: 12px; padding: 4px 12px; font-size: 12px; color: var(--tx-2); }
.msg .av { width: 28px; height: 28px; }
.msg .bd { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex-grow: 1; }
.msg .hd { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.msg .hd b { font-weight: 700; }
.msg .hd .src { font-size: 11.5px; color: var(--tx-2); }
.msg .hd .tm { font-size: 11.5px; color: var(--tx-3); }
.msg .tx { line-height: 1.65; color: var(--ink-2); }
.msg .mention { background: rgba(245,184,0,.22); color: var(--gold-text);
  border-radius: 4px; padding: 0 3px; font-weight: 600; }
.msg .fold { align-self: flex-start; border: none; background: none; padding: 2px 0;
  color: var(--gold-text); font-size: 12px; }
.msg .detail { font-size: 12px; color: var(--ink-3); background: var(--paper-4);
  border-radius: 8px; padding: 10px 12px; line-height: 1.6; }
.msg .claim { display: flex; gap: 8px; margin-top: 4px; }

/* 输入区 */
.composer { border-top: 1px solid var(--line); padding: 12px 28px 16px;
  display: flex; flex-direction: column; gap: 8px; }
.composer .kinds { display: flex; gap: 6px; align-items: center; }
.composer .counter { margin-left: auto; font-size: 12px; color: var(--tx-2); }
.composer .counter.over { color: var(--rust); font-weight: 600; }
.composer .line { display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { flex-grow: 1; min-height: 42px; }
.composer .send { height: 40px; padding: 0 18px; }

/* 成员侧栏 */
.aside { width: var(--aside-w); flex-shrink: 0; border-left: 1px solid var(--line);
  background: var(--paper); padding: 18px; box-sizing: border-box;
  display: flex; flex-direction: column; gap: 16px; overflow-y: auto; }
.aside .cap { font-size: 11.5px; font-weight: 600; color: var(--tx-2); }
.aside .who { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.aside .who .nm { flex-grow: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aside .who .ty { font-size: 11px; color: var(--tx-2); }
.aside .rules { background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.aside .rules .txt { font-size: 12px; color: var(--ink-3); line-height: 1.6; }

/* 白板 */
.board-add { display: flex; flex-direction: column; gap: 8px; }
.board-item { background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
  white-space: pre-wrap; word-break: break-word; }

/* 弹层 */
.mask { position: fixed; inset: 0; background: rgba(29,28,26,.32);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 24px; }
.modal { background: var(--surface); border-radius: 12px; padding: 22px;
  width: min(560px, 100%); max-height: 86vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(29,28,26,.24);
  display: flex; flex-direction: column; gap: 14px; }
.modal h3 { font-size: 16px; font-weight: 700; }
.modal .sub { color: var(--tx-2); font-size: 12px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal .err { color: var(--rust); font-size: 12px; }

/* 登录 */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--paper); padding: 24px; }
.auth { width: 380px; background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 12px; padding: 28px; display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 10px 40px rgba(29,28,26,.08); }
.auth .brand { display: flex; align-items: center; gap: 10px; }
.auth .brand b { font-size: 18px; font-weight: 700; }
.auth .tabs { display: flex; gap: 6px; }
.auth .tabs button { flex: 1; height: 32px; border-radius: 8px;
  border: 1px solid var(--line-4); background: var(--surface); font-size: 13px; }
.auth .tabs button.on { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }

/* P7 旧类名映射到原型外观 */
.p7-panel { background: var(--surface); border: 1px solid var(--line-3);
  border-radius: 12px; padding: 18px; margin-bottom: 16px; }
.p7-panel-head { font-weight: 700; margin-bottom: 10px; display: flex; gap: 8px; align-items: baseline; }
.p7-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .p7-grid { grid-template-columns: 1fr; } }
.p7-intro { color: var(--tx-2); margin-bottom: 16px; line-height: 1.6; }

.hidden { display: none !important; }
.spacer { flex-grow: 1; }