/* 寄頁 Console — 建立在 /admin/assets/admin.css 的設計系統上, 這裡只放 Console 專用元件 */
body.is-login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--line-2); border-bottom-width: 2px;
  border-radius: 5px; color: var(--muted); background: var(--panel); }
.search kbd { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); }
.nav-sep { margin: 14px 10px 4px; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; }
.seg button span { font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 2px; }
.seg button span:empty { display: none; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.live.on::before { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }

/* 專案標籤 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.chips:empty { display: none; }
.chip { height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel);
  font-size: 12.5px; color: var(--ink-2); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip small { color: inherit; opacity: .65; margin-left: 3px; }

/* agent 頭像 (名稱首字 + 依名稱上色) */
.ag { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.ag i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-style: normal; font-weight: 700;
  font-size: 12px; color: #111; background: var(--c, #e5e5e0); flex: none; text-transform: uppercase; }
.vis { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 5px; margin-left: 6px; vertical-align: 1px; }
.vis.public { background: var(--ok-soft); color: var(--ok); }
.vis.unlisted { background: var(--info-soft); color: var(--info); }
.vis.private { background: var(--sunk); color: var(--ink-2); }
.st { font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.st.unread { color: var(--mag-text); }
.st.unread::before { content: "● "; }
.st.pending { color: var(--warn); }
.st.done { color: var(--muted); font-weight: 500; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl tbody tr.unread td .cell-title a { font-weight: 700; }
.row-sum { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 520px; }

/* 抽屜 */
.scrim { position: fixed; inset: 0; background: rgba(17,17,16,.32); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--panel); z-index: 41;
  border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0,0,0,.12); display: flex; flex-direction: column;
  animation: slide .18s ease-out; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.drawer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 10px; border-bottom: 1px solid var(--line); }
.drawer header h2 { font-size: 16px; line-height: 1.35; }
.drawer-body { overflow-y: auto; padding: 16px 20px 32px; display: flex; flex-direction: column; gap: 18px; }
.drawer h3 { font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 0 0 8px; }
.preview { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.share-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.share-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.share-list li span { flex: 1; }
.ackbox textarea { width: 100%; min-height: 64px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--panel); resize: vertical; }
.ack-result { padding: 10px 12px; border-radius: var(--r-sm); font-size: 13.5px; }
.ack-result.approve { background: var(--ok-soft); color: var(--ok); }
.ack-result.reject { background: var(--danger-soft); color: var(--danger); }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form select, .inline-form input { height: 30px; border: 1px solid var(--line-2); border-radius: 7px; background: var(--panel); padding: 0 8px; font-size: 13px; }
.inline-form input { width: 90px; }

/* 記憶 */
.split { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.split-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.split-main > .card + .card { margin-top: 0; }
.tree { padding: 10px 8px; position: sticky; top: 16px; max-height: calc(100vh - 120px); overflow: auto; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 12px; }
.tree > ul { padding-left: 0; }
.tree button { display: flex; width: 100%; align-items: center; gap: 6px; border: 0; background: transparent; text-align: left;
  padding: 5px 8px; border-radius: 6px; font-size: 13px; font-family: var(--mono); color: var(--ink-2); }
.tree button:hover { background: var(--sunk); }
.tree button.on { background: var(--mag-soft); color: var(--mag-text); font-weight: 600; }
.tree button small { margin-left: auto; color: var(--muted); font-family: var(--font); }
.klist { list-style: none; margin: 0; padding: 0; }
.klist li button { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 9px 4px; border-top: 1px solid var(--line); }
.klist li:first-child button { border-top: 0; }
.klist li button:hover b { color: var(--mag-text); }
.klist b { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.klist small { color: var(--muted); font-size: 12px; grid-column: 1; }
.klist .ver { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
.codeview { margin: 0; padding: 14px 16px; border-radius: var(--r-sm); background: #0f172a; color: #d6e4ff; font-family: var(--mono);
  font-size: 12.5px; line-height: 1.6; overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
.codeedit { width: 100%; min-height: 220px; font-family: var(--mono); font-size: 12.5px; padding: 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--panel); }
.hist { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.hist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.hist li span { flex: 1; }
.tags { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.search-results { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto; }
.search-results li button { width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px;
  display: flex; flex-direction: column; gap: 2px; }
.search-results li button:hover, .search-results li button.on { background: var(--sunk); }
.search-results b { font-family: var(--mono); font-size: 13px; }
.search-results small { color: var(--muted); font-size: 12px; }
.search-results mark { background: var(--sun-soft, #fff1b8); color: inherit; border-radius: 3px; }

/* 協作空間 */
.spaces-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.space-card { text-align: left; border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); }
.space-card:hover { border-color: var(--line-2); }
.space-card b { font-size: 15px; display: block; }
.space-card small { color: var(--muted); }
.space-card .meta { display: flex; gap: 12px; margin-top: 10px; font-size: 12.5px; color: var(--ink-2); }
.space-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.space-head h2 { font-size: 18px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.col { background: var(--sunk); border-radius: var(--r); padding: 10px; min-height: 120px; }
.col h3 { font-size: 12.5px; color: var(--muted); margin: 2px 4px 8px; display: flex; justify-content: space-between; }
.task { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; margin-bottom: 8px; font-size: 13px; }
.task b { display: block; font-weight: 600; }
.task small { color: var(--muted); font-size: 12px; }
.task .lease { color: var(--warn); font-variant-numeric: tabular-nums; }
.space-body { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 14px; }
.stream { display: flex; flex-direction: column; height: 520px; }
.msgs { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 0 2px; font-size: 13.5px; }
.msgs li { padding: 7px 0; border-top: 1px solid var(--line); }
.msgs li:first-child { border-top: 0; }
.msgs b { font-weight: 650; }
.msgs .to { color: var(--muted); }
.msgs time { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.msgs .kind { font-size: 11px; }
.compose { display: flex; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.compose input { flex: 1; height: 34px; border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 0 10px; background: var(--panel); }

/* agents */
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.agent-card { display: flex; flex-direction: column; gap: 12px; }
.agent-card + .agent-card { margin-top: 0; }
.agent-top { display: flex; align-items: center; gap: 12px; }
.agent-top .ag i { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
.agent-top b { font-size: 15px; }
.agent-top small { display: block; color: var(--muted); font-size: 12.5px; }
.agent-stats { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); align-items: flex-end; }
.agent-stats b { display: block; color: var(--ink); font-size: 16px; font-variant-numeric: tabular-nums; }
.agent-stats .spark { margin: 0 0 0 auto; width: 90px; height: 24px; }
.keys { list-style: none; margin: 0; padding: 0; }
.keys li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.keys li .mono { font-weight: 600; }
.keys li .grow { flex: 1 1 100%; order: 9; min-width: 0; color: var(--muted); font-size: 12px; }
.keys li .scope-tags { order: 10; }
.keys li .btn { margin-left: auto; }
.keys li .btn + .btn { margin-left: 0; }
.scope-tags { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; }
.scope-tags span { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border-radius: 5px; background: var(--sunk); color: var(--ink-2); }
.scope-group { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; }
.scope-group h3 { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 4px 0; font-size: 13.5px; }
.check input { margin-top: 3px; accent-color: var(--mag); width: 16px; height: 16px; }
.check code { font-size: 11.5px; }
.check .warn { color: var(--warn); font-size: 12px; display: block; }
.tabs-mini { display: flex; gap: 4px; flex-wrap: wrap; }
.tabs-mini button { height: 28px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--line-2); background: var(--panel); font-size: 12.5px; }
.tabs-mini button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.snippet { position: relative; }
.snippet .codeview { max-height: 200px; }
.snippet .btn { position: absolute; top: 8px; right: 8px; }
.modal.wide { width: min(640px, calc(100vw - 32px)); }

@media (max-width: 1080px) {
  .split, .space-body { grid-template-columns: 1fr; }
  .tree { position: static; max-height: none; }
  .board { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .nav-sep { display: none; }
  .tbl .hide-sm { display: none; }
}

/* 方案與用量 */
.plan-now { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.plan-now .pname { font-size: 22px; font-weight: 700; }
.plan-now .meta { color: var(--muted); font-size: 13px; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 14px; }
.usage { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.usage .lbl { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.usage .num { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.usage .num small { font-size: 13px; color: var(--muted); font-weight: 500; }
.bar { height: 8px; background: var(--sunk); border-radius: 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); border-radius: 6px; }
.bar i.warn { background: #e0a400; } .bar i.over { background: var(--danger); }
.usage .note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.plan-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .plan-cards { grid-template-columns: 1fr; } }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.pcard.cur { border: 2px solid var(--mag); }
.pcard h3 { margin: 0; font-size: 16px; }
.pcard .price { font-size: 22px; font-weight: 700; }
.pcard ul { margin: 4px 0 8px; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.code-big { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: 1px; text-align: center; padding: 14px; background: var(--sunk); border-radius: var(--r-sm); }
.conns { list-style: none; margin: 0; padding: 0; }
.conns li { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.conns li .grow { flex: 1; color: var(--muted); font-size: 12px; }
.plan-cmp { font-size: 15px; margin-top: 28px; }

/* 活動 */
.agent-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.astat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.astat .top { display: flex; align-items: center; gap: 8px; }
.astat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.astat .dot.on { background: #22c55e; box-shadow: 0 0 0 3px color-mix(in srgb, #22c55e 25%, transparent); }
.astat .top .btn { margin-left: auto; }
.astat .doing { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.astat .meta { color: var(--muted); font-size: 12px; }
.astat.paused { opacity: .7; border-style: dashed; }
.cmd { display: flex; flex-direction: column; gap: 10px; }
.cmd textarea { width: 100%; min-height: 70px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel); resize: vertical; }
.cmd-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.cmd-row .field { min-width: 180px; }
.cmd-row select { height: 36px; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--panel); padding: 0 8px; }
.cmd-foot .btn { margin-left: auto; }
.act-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.act-grid > .card + .card { margin-top: 0; }
@media (max-width: 1000px) { .act-grid { grid-template-columns: 1fr; } }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13.5px; max-height: 620px; overflow-y: auto; }
.timeline li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--line); }
.timeline li:first-child { border-top: 0; }
.timeline time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.timeline .ev small { display: block; color: var(--muted); font-size: 12px; }
.timeline li.urgent .ev b:first-child { color: var(--danger); }
.timeline li.done { opacity: .55; }
.timeline .acts { display: flex; gap: 6px; margin-top: 4px; }
.timeline li.new { animation: pop .3s ease-out; background: color-mix(in srgb, var(--mag-soft) 40%, transparent); }
.space-tools { display: flex; gap: 8px; margin-left: auto; flex-wrap: wrap; }
