/* 图灵 IM 统一样式：微信式克制——中性灰阶 + 单一青绿强调色，与工作台 App 同一套色值。 */
:root {
  --bg: #f2f2f2;
  --surface: #ffffff;
  --surface-2: #f7f7f7;
  --ink: #1a1a1a;
  --ink-2: #888888;
  --ink-3: #b2b2b2;
  --line: #e6e6e6;
  --hairline: #ededed;
  --accent: #087f6a;
  --accent-ink: #ffffff;
  --accent-soft: #e7f4ef;
  --accent-strong: #066551;
  --danger: #d93f3f;
  --danger-soft: #fdecec;
  --warn: #b26a00;
  --bubble-me: #95ec69;
  --bubble-me-ink: #111;
  --bubble-other: #ffffff;
  --chat-bg: #ededed;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 16px rgba(0, 0, 0, .04);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --surface: #181818; --surface-2: #1f1f1f; --ink: #f2f2f2; --ink-2: #9b9b9b; --ink-3: #5e5e5e;
    --line: #2c2c2c; --hairline: #272727; --accent: #4ecdaf; --accent-ink: #00312a; --accent-soft: #11302a;
    --accent-strong: #aee9da; --danger: #ff6b6b; --danger-soft: #3a1717; --warn: #f0b35a;
    --bubble-me: #3eb575; --bubble-me-ink: #0b0b0b; --bubble-other: #262626; --chat-bg: #111111;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --surface: #181818; --surface-2: #1f1f1f; --ink: #f2f2f2; --ink-2: #9b9b9b; --ink-3: #5e5e5e;
  --line: #2c2c2c; --hairline: #272727; --accent: #4ecdaf; --accent-ink: #00312a; --accent-soft: #11302a;
  --accent-strong: #aee9da; --danger: #ff6b6b; --danger-soft: #3a1717; --warn: #f0b35a;
  --bubble-me: #3eb575; --bubble-me-ink: #0b0b0b; --bubble-other: #262626; --chat-bg: #111111;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 14px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.3; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }

/* 按钮 */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink); height: 34px; padding: 0 14px;
  border-radius: 6px; font: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 22px; font-size: 15px; }
.link-btn { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }

/* 表单 */
.input, .textarea, select.input { width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
  background: var(--surface); color: var(--ink); font: inherit; outline: none; }
.textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
.input:focus, .textarea:focus { border-color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 13px; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--ink-2); }
.switch { position: relative; width: 40px; height: 22px; border-radius: 11px; background: var(--line); border: 0; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 20px; }

/* 卡片/列表 */
.card { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 20px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--hairline); }
.list { background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.list-row:last-child { border-bottom: 0; }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: 4px; font-size: 12px;
  border: 1px solid var(--line); color: var(--ink-2); }
.tag.ok { color: var(--accent); border-color: var(--accent); }
.tag.bad { color: var(--danger); border-color: var(--danger); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.empty { padding: 48px 16px; text-align: center; color: var(--ink-3); }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 16px; border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.table th { font-weight: 500; color: var(--ink-2); font-size: 12.5px; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }

/* 头像 */
.avatar { width: 40px; height: 40px; border-radius: 6px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 600; font-size: 15px; overflow: hidden; background: #9aa5b1; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 32px; height: 32px; font-size: 13px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar.svc { background: var(--accent); }

/* 提示 */
.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: rgba(30, 30, 30, .92); color: #fff; padding: 8px 16px; border-radius: 6px; font-size: 13px; }
.toast.err { background: var(--danger); }
.modal-mask { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); display: flex; align-items: center; justify-content: center; z-index: 900; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow: auto; }
.modal-head { padding: 18px 24px 0; font-size: 16px; font-weight: 600; }
.modal-body { padding: 16px 24px; }
.modal-foot { padding: 0 24px 20px; display: flex; justify-content: flex-end; gap: 8px; }
.secret-box { font-family: var(--mono); background: var(--surface-2); border: 1px dashed var(--line); border-radius: 6px; padding: 10px 12px;
  word-break: break-all; user-select: all; }
.notice { background: var(--accent-soft); color: var(--accent-strong); border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.notice.warn { background: var(--danger-soft); color: var(--danger); }

/* 控制台布局 */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--hairline); padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; padding: 4px 8px 16px; color: var(--ink); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.brand-mark svg { width: 18px; height: 18px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink); cursor: pointer; }
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.nav-sep { height: 1px; background: var(--hairline); margin: 10px 4px; }
.main { padding: 24px 32px 48px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; }
.page-head h1 { font-size: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 16px 20px; }
.stat .num { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--ink-2); font-size: 12.5px; }
.tabs { display: flex; gap: 20px; border-bottom: 1px solid var(--hairline); margin-bottom: 16px; }
.tab { padding: 8px 0; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab.active { color: var(--ink); border-color: var(--accent); font-weight: 500; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; align-items: center; }
.kv > div:nth-child(odd) { color: var(--ink-2); font-size: 13px; }
.bar-chart { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.bar-chart .bar { flex: 1; background: var(--accent); opacity: .85; border-radius: 2px 2px 0 0; min-height: 1px; position: relative; }
.bar-chart .bar:hover { opacity: 1; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 8px; position: sticky; top: 0; z-index: 10; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .brand { padding: 4px 8px; }
  .nav-sep { display: none; }
  .main { padding: 16px; }
  .grid-2, .grid-4 { grid-template-columns: 1fr 1fr; }
  .kv { grid-template-columns: 1fr; }
}
