/* Console-as-a-Service · Clean Light Tech 主题
 * 全站共享：index / phone(现场端) / console(工程师终端)
 */
:root {
  --bg: #f6f8fb;
  --panel: #ffffff;            /* 兼容旧变量：卡片面 */
  --panel-2: #eef2f8;          /* 兼容旧变量：浅灰内嵌 */
  --surface: #ffffff;
  --surface-2: #f0f4fa;
  --ink: #0f1c2e;
  --text: #0f1c2e;             /* 兼容旧变量 */
  --muted: #5d6b82;
  --line: #e4eaf2;
  --line-strong: #cdd8e6;

  --accent: #2563eb;
  --accent-ink: #1d4ed8;
  --grad: linear-gradient(135deg, #4f46e5, #2563eb 55%, #0ea5e9);

  --green: #16a34a;            /* 兼容旧变量 */
  --red: #e5484d;              /* 兼容旧变量 */
  --amber: #d97706;            /* 兼容旧变量 */
  --ok: #12a150;
  --err: #e03c3c;

  --mono: 'JetBrains Mono', 'Cascadia Code', SFMono-Regular, Consolas, 'Courier New', monospace;
  --sans: Inter, 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Roboto, sans-serif;

  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(18, 35, 70, .05), 0 1px 3px rgba(18, 35, 70, .06);
  --shadow-md: 0 10px 30px -14px rgba(25, 50, 100, .22);
  --shadow-lg: 0 24px 60px -24px rgba(25, 60, 130, .28);
}

/* ---------- Microsoft Teams 宿主暗色/高对比主题 ----------
 * 由 teams-host.js 依据 Teams 上下文设置 <html data-ts-theme="dark|contrast">。
 * 页面控件均已变量化，此处仅覆盖变量与个别浅色外壳，即可随 Teams 明暗联动。
 * 选择器带 html[data-ts-theme] 前缀，优先级高于各页面内联 <style>。 */
html[data-ts-theme='dark'],
html[data-ts-theme='contrast'] {
  --bg: #15171e;
  --panel: #1e222d;
  --panel-2: #272d3b;
  --surface: #1e222d;
  --surface-2: #272d3b;
  --ink: #e7ebf3;
  --text: #e7ebf3;
  --muted: #93a1b8;
  --line: #2b3142;
  --line-strong: #3a4357;
  --accent: #6aa4ff;
  --accent-ink: #8db8ff;
  --grad: linear-gradient(135deg, #7c6cff, #4f8bff 55%, #2fb5f6);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 10px 30px -14px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .65);
  color-scheme: dark;
}
html[data-ts-theme='contrast'] {
  --bg: #101218;
  --surface: #151821;
  --surface-2: #242b3a;
  --ink: #ffffff;
  --muted: #c3cde0;
  --line: #3a4357;
  --line-strong: #5a6880;
  --accent: #7ab0ff;
  --accent-ink: #9cc4ff;
}
/* 顶栏原为半透明白玻璃底，暗色下换成半透明深色 */
html[data-ts-theme='dark'] .topbar,
html[data-ts-theme='contrast'] .topbar {
  background: rgba(22, 25, 34, .86);
}
html[data-ts-theme='dark'] .btn.danger { background: #3a2226; border-color: #6b3338; color: #ffb4b2; }
html[data-ts-theme='dark'] .btn.danger:hover { background: #452a2e; }
html[data-ts-theme='dark'] .btn.success { background: #17342a; border-color: #2c5c46; color: #7fe0ae; }
html[data-ts-theme='dark'] .btn.success:hover { background: #1d3f32; }
/* 账号/套餐/角色小标签：由浅底深字翻转为深底亮字 */
html[data-ts-theme='dark'] .plan-tag.free, html[data-ts-theme='contrast'] .plan-tag.free,
html[data-ts-theme='dark'] .tag.free, html[data-ts-theme='contrast'] .tag.free {
  background: #17342a; border-color: #2c5c46; color: #7fe0ae;
}
html[data-ts-theme='dark'] .plan-tag.pro, html[data-ts-theme='contrast'] .plan-tag.pro,
html[data-ts-theme='dark'] .tag.pro, html[data-ts-theme='contrast'] .tag.pro {
  background: #3a2c12; border-color: #6b5518; color: #ffd479;
}
html[data-ts-theme='dark'] .tag.admin, html[data-ts-theme='contrast'] .tag.admin {
  background: #3a2610; border-color: #6b4718; color: #ffc46b;
}
html[data-ts-theme='dark'] .tag.on, html[data-ts-theme='contrast'] .tag.on {
  background: #17342a; border-color: #2c5c46; color: #7fe0ae;
}
html[data-ts-theme='dark'] .tag, html[data-ts-theme='contrast'] .tag {
  background: #232938; border-color: #3a4357; color: #c3cde0;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(37, 99, 235, .16); }

/* ---------- 布局 ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 0 24px; min-height: 62px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
  flex-wrap: wrap;
}
.topbar > .pill, .topbar > .btn { flex: none; }
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none !important; color: var(--ink);
  min-width: 0;
}
.brand-mark {
  width: 40px; height: 40px; flex: none;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  box-shadow: 0 6px 16px -6px rgba(59, 91, 219, .35);
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.16; min-width: 0; }
.brand-title { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; color: var(--ink); white-space: nowrap; }
.brand-title .bt-dark { color: #0e2038; }
.brand-title .bt-gray { color: #94a3b8; }
.brand-title .bt-grad { background: linear-gradient(100deg, #33b1ff 0%, #0f6fe0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sub {
  font-size: 10px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.topbar .spacer { flex: 1; }

/* ---------- 语言切换 ---------- */
.lang-sw {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px; flex: none;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-sm);
}
.lang-sw span {
  padding: 3px 10px; font-size: 12px; font-weight: 650;
  color: var(--muted); border-radius: 999px; cursor: pointer;
  user-select: none; line-height: 1.3;
}
.lang-sw span:hover { color: var(--ink); }
.lang-sw span.on { background: var(--grad); color: #fff; }
.lang-sw span.on:hover { color: #fff; }

/* ---------- 完整品牌图（首页 hero 大图） ---------- */
/* ---------- 状态胶囊 ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.pill.ok { color: #0b7a49; background: #e7f7ef; border-color: #bfe9d4; }
.pill.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(18, 161, 80, .18); }
.pill.bad { color: #c4373a; background: #fdeeed; border-color: #f4c4c2; }
.pill.bad .dot { background: var(--err); box-shadow: 0 0 0 3px rgba(224, 60, 60, .16); }
.pill.warn { color: #a16207; background: #fdf6e3; border-color: #f0ddb0; }
.pill.warn .dot { background: var(--amber); box-shadow: 0 0 0 3px rgba(217, 119, 6, .16); }
/* 「未加密」中性提示：默认状态（明文会话），不刺眼、不报警，引导开启加密 */
.pill.neutral { color: #475569; background: #f1f5f9; border-color: #cbd5e1; }
.pill.neutral .dot { background: #94a3b8; box-shadow: none; }

/* ---------- 按钮 ---------- */
.btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  padding: 8px 16px; border-radius: 10px;
  font-size: 14px; font-weight: 550;
  font-family: var(--sans);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: var(--shadow-sm);
  transition: transform .12s, box-shadow .15s, border-color .15s, filter .15s;
  text-decoration: none;
}
.btn:hover { border-color: #a9b8d0; box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, #4f46e5, #2563eb 60%, #0284c7);
  border: none; color: #fff;
  box-shadow: 0 8px 18px -8px rgba(59, 91, 219, .65);
}
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 12px 22px -8px rgba(59, 91, 219, .7); }
.btn.danger { background: #fdeeed; border-color: #f4c4c2; color: #c4373a; }
.btn.danger:hover { background: #fbe0de; }
.btn.success { background: #e7f7ef; border-color: #bfe9d4; color: #0b7a49; }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .18s, transform .18s;
}
.card h3 {
  margin: 0 0 12px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted);
  display: flex; align-items: center; gap: 9px;
}
.card h3 .step {
  width: 22px; height: 22px; border-radius: 8px; flex: none;
  background: var(--grad); color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}
.card h3 .step.alt { background: var(--surface-2); color: var(--accent); }

/* ---------- 表单 ---------- */
input, select {
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; font-size: 14px;
  font-family: var(--sans); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37, 99, 235, .14); }
input[readonly] { background: var(--surface-2); color: var(--muted); }
label.field { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 10px 0 5px; }

/* ---------- 会话码盒 ---------- */
.code-box {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, #f6f9ff, #eef3fb);
  border: 1px dashed #c6d3ea;
  border-radius: 12px; padding: 12px 16px;
}
.code-box .code {
  flex: 1; word-break: break-all;
  font-family: var(--mono); font-size: 22px; font-weight: 800;
  letter-spacing: .14em; color: #2a3d66;
  line-height: 1.3;
}
.code-box .sub { color: var(--muted); font-size: 11px; }

/* ---------- 事件日志（模拟真实 console 暗屏） ---------- */
.log {
  background: #0c1424;
  border: 1px solid #202c46;
  border-radius: 12px;
  padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: #c7d4ee;
  height: 150px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
  margin-top: 10px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.03), var(--shadow-sm);
}
.log .t { color: #5d719c; }
.log .muted { color: #7185ad; }
.log .err { color: #ff8378; }
.log .ok { color: #43d998; }
.log .warn { color: #ffd173; }

/* ---------- 工具类 ---------- */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 6px 0; }
.hint code, .code-inline {
  font-family: var(--mono); background: rgba(37, 99, 235, .08);
  color: #1d4ed8; padding: 2px 6px; border-radius: 6px; font-size: 12px;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.big { font-size: 16px; }

@media (max-width: 640px) {
  .topbar { padding: 8px 14px; min-height: 58px; gap: 8px; }
  .btn { padding: 10px 15px; }
  .card { padding: 15px 15px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
  .brand-title { font-size: 13.5px; }
  .brand-sub { display: none; }
}
