:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --line: #e3e6eb;
  --line-2: #eef0f4;
  --text: #1f2329;
  --muted: #8a8f98;
  --muted-2: #6b7280;
  --brand: #2f6bff;
  --brand-soft: #edf2ff;
  --flow: #2f6edb;
  --weight: #e8873a;
  --ok: #1f9d55;
  --ok-soft: #e9f7ef;
  --warn: #b7791f;
  --warn-soft: #fdf3e3;
  --danger: #e5484d;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

/* hidden 属性优先于任何 display 设定 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 "Microsoft YaHei UI", "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 58px;
  padding: 0 28px;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, #2f6bff, #5b8cff);
  position: relative;
}
.logo::after {
  content: ""; position: absolute; inset: 7px 6px 8px 6px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff;
  transform: skew(-12deg);
  opacity: .9;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; letter-spacing: .2px; }
.brand-text em { font-style: normal; font-size: 11px; color: var(--muted); }

.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab {
  padding: 6px 12px; border-radius: 8px; color: var(--muted-2);
  font-size: 13px; transition: .15s;
}
.tab:hover { background: #f2f4f8; color: var(--text); }
.tab.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

.right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.role-chip {
  font-size: 12px; padding: 3px 9px; border-radius: 999px;
  background: #f1f3f7; color: var(--muted-2); border: 1px solid var(--line);
}
.role-chip.viewer { background: var(--ok-soft); color: var(--ok); border-color: #cdebd9; }
.role-chip.debugger { background: var(--warn-soft); color: var(--warn); border-color: #f3e0bf; }
.role-chip.developer { background: #eef2ff; color: #4c5fd5; border-color: #d8defb; }

.login-link { font-size: 12px; color: var(--muted); }
.login-link:hover { color: var(--brand); }

/* ---------- 视图 ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 48px; }
.view[hidden] { display: none; }

/* ---------- 首页 hero ---------- */
.hero {
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 28px;
  align-items: center; padding: 26px 0 8px;
}
.eyebrow { margin: 0 0 8px; font-size: 12px; letter-spacing: 2px; color: var(--brand); text-transform: uppercase; }
.hero h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.28; letter-spacing: -.4px; }
.lead { margin: 0 0 18px; color: var(--muted-2); max-width: 46ch; }
.lead strong { color: var(--text); }
.hero-actions { display: flex; gap: 10px; margin-bottom: 22px; }
.hero-facts { display: flex; gap: 26px; margin: 0; padding: 0; list-style: none; }
.hero-facts li { color: var(--muted); font-size: 12px; }
.hero-facts span { display: block; font-size: 20px; font-weight: 700; color: var(--text); }

.hero-art {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; box-shadow: var(--shadow);
}
.hero-art canvas { width: 100%; height: auto; display: block; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13px; font-weight: 600; cursor: pointer; transition: .15s;
  font-family: inherit;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #2559e0; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: #cfd6e0; background: #fafbfc; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- 项目卡 ---------- */
.section-title { margin: 28px 0 12px; font-size: 15px; color: var(--muted-2); font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.project-shot { background: linear-gradient(180deg, #fbfcfe, #f3f5f9); border-bottom: 1px solid var(--line-2); padding: 14px; }
.project-shot canvas { width: 100%; height: auto; display: block; }
.project-body { padding: 16px 18px 18px; }
.project-body h3 { margin: 0 0 6px; font-size: 16px; }
.project-body p { margin: 0 0 12px; color: var(--muted-2); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips span {
  font-size: 11px; color: var(--muted-2); background: #f2f4f8;
  border: 1px solid var(--line-2); padding: 2px 8px; border-radius: 999px;
}
.card-link { font-size: 13px; color: var(--brand); font-weight: 600; }
.card-link:hover { text-decoration: underline; }

.note {
  margin-top: 18px; padding: 12px 14px; border-radius: 10px;
  background: #fff; border: 1px dashed var(--line);
  color: var(--muted-2); font-size: 12.5px;
}
.note strong { color: var(--text); }

/* ---------- 实时画面 ---------- */
.live-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.live-head h2 { margin: 0 0 2px; font-size: 20px; }
.sub { color: var(--muted); font-size: 12.5px; }
.live-tools { display: flex; align-items: center; gap: 8px; }

.pill {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand); border: 1px solid #d9e3ff;
}
.pill.real { background: var(--ok-soft); color: var(--ok); border-color: #cdebd9; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px 14px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto;
  column-gap: 6px; align-items: end; box-shadow: var(--shadow);
}
.k-label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.k-val { font: 700 26px/1.1 Consolas, "SF Mono", monospace; letter-spacing: -.5px; }
.k-unit { font-size: 12px; color: var(--muted); padding-bottom: 3px; }
.k-tone {
  grid-column: 1 / -1; justify-self: start;
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
  background: var(--ok-soft); color: var(--ok); border: 1px solid #cdebd9;
}

.chart-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 10px; box-shadow: var(--shadow);
}
.chart-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 4px; }
.chart-head h3 { margin: 0; font-size: 15px; }
.chart-tools { margin-left: auto; display: flex; gap: 14px; }
.legend { font-size: 12px; color: var(--muted-2); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.dot.flow { background: var(--flow); }
.dot.weight { background: var(--weight); }
#liveChart { width: 100%; height: 360px; display: block; }

.console { margin-top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.console[hidden] { display: none; }
.console-head { display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); }
.console-head h3 { margin: 0; font-size: 14px; }
.console-body { padding: 6px 16px 14px; }
.rec-line { display: grid; grid-template-columns: 150px 1fr 90px; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); font-size: 13px; }
.rec-line:last-child { border-bottom: 0; }
.rec-line .t { color: var(--muted-2); font-family: Consolas, monospace; font-size: 12px; }
.rec-line .n { color: var(--muted-2); font-size: 12px; text-align: right; }
.rec-line em { font-style: normal; color: var(--warn); }

/* ---------- 记录 demo ---------- */
.record-grid { display: grid; grid-template-columns: 300px 1fr; gap: 16px; align-items: start; }
.rec-meta { padding: 16px 18px; }
.rec-meta h3 { margin: 0 0 10px; font-size: 15px; }
.rec-meta dl { margin: 0; display: grid; grid-template-columns: 72px 1fr; gap: 8px 10px; font-size: 12.5px; }
.rec-meta dt { color: var(--muted); }
.rec-meta dd { margin: 0; color: var(--text); }
.rec-meta code { background: #f2f4f8; padding: 1px 4px; border-radius: 4px; font-size: 11.5px; }

.rec-tabs { padding: 14px 16px 16px; }
.seg { display: inline-flex; background: #f2f4f8; border-radius: 8px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg-btn {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 6px;
  font-size: 12.5px; color: var(--muted-2); cursor: pointer; font-family: inherit;
}
.seg-btn.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,.08); font-weight: 600; }

.code {
  margin: 0; padding: 14px 16px; background: #0f172a; color: #cbd5e1;
  border-radius: 10px; font: 12px/1.75 Consolas, "SF Mono", monospace;
  overflow: auto; max-height: 460px;
  white-space: pre-wrap; word-break: break-word;
}
.code .k { color: #7dd3fc; }
.code .s { color: #86efac; }
.code .n { color: #fdba74; }
.code-inline { font-size: 11.5px; max-height: 170px; margin-top: 4px; }

/* ---------- 页脚 ---------- */
.foot {
  max-width: 1120px; margin: 0 auto; padding: 18px 24px 30px;
  color: var(--muted); font-size: 12px; display: flex; gap: 8px; align-items: center;
}
.dot-sep { opacity: .5; }

/* ---------- 登录弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(15, 23, 42, .35);
  display: grid; place-items: center; padding: 20px;
}
.modal[hidden] { display: none; }
.modal-card {
  position: relative; width: 380px; max-width: 100%;
  background: #fff; border-radius: 14px; padding: 22px 22px 18px;
  box-shadow: 0 20px 48px rgba(15, 23, 42, .22);
}
.modal-card h3 { margin: 0 0 4px; font-size: 17px; }
.modal-x {
  position: absolute; right: 10px; top: 8px; border: 0; background: transparent;
  font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer;
}
.accounts { display: grid; gap: 8px; margin-top: 14px; }
.account {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; text-align: left; background: #fff; font-family: inherit;
}
.account:hover { border-color: #c7d2fe; background: #fbfcff; }
.account b { font-size: 13px; }
.account span { grid-column: 1; font-size: 11.5px; color: var(--muted); }
.account em { grid-row: 1 / span 2; grid-column: 2; font-style: normal; font-size: 11px; color: var(--muted); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  #liveChart { height: 260px; }
  .record-grid { grid-template-columns: 1fr; }
  .tabs { gap: 0; }
  .brand-text em { display: none; }
  .topbar { padding: 0 14px; gap: 12px; }
  main { padding: 18px 14px 40px; }
}

/* ---------- 个人站补充 ---------- */
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #2f6bff, #7aa2ff);
  color: #fff; font: 700 13px/28px "Microsoft YaHei UI", sans-serif;
  text-align: center; letter-spacing: .5px;
}
.about { padding: 16px 18px; }
.about p { margin: 0 0 8px; color: var(--muted-2); }
.about p:last-child { margin-bottom: 0; }
.muted { color: var(--muted); font-size: 12.5px; }
.tag {
  font-size: 10.5px; padding: 1px 6px; border-radius: 4px;
  background: #fff4e6; color: #b7791f; border: 1px solid #f6e0c2; margin-right: 4px;
}
.notes { list-style: none; margin: 0; padding: 0; }
.notes li {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 2px; border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.notes li:last-child { border-bottom: 0; }
.notes a { color: var(--text); }
.notes a:hover { color: var(--brand); }
.notes em { font-style: normal; font-size: 11px; color: var(--muted); }

/* ---------- 参数总览 ---------- */
.ov-grid { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
.ov-nav { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; box-shadow: var(--shadow); }
.ov-nav-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  width: 100%; border: 0; background: transparent; padding: 8px 10px;
  border-radius: 8px; font-size: 13px; color: var(--text); cursor: pointer;
  font-family: inherit; text-align: left;
}
.ov-nav-item:hover { background: #f4f6fa; }
.ov-nav-item.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.ov-nav-item em { font-style: normal; font-size: 11px; color: var(--muted); }
.ov-table { padding: 14px 16px 10px; }
.ov-table-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.ov-table-head h3 { margin: 0; font-size: 15px; }
.ov-rows { width: 100%; border-collapse: collapse; font-size: 13px; }
.ov-rows th {
  text-align: left; font-weight: 500; color: var(--muted);
  font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line);
}
.ov-rows td { padding: 9px 10px; border-bottom: 1px solid var(--line-2); }
.ov-rows tr:last-child td { border-bottom: 0; }
.ov-rows td.val { font-family: Consolas, monospace; }
.ov-rows td.note { color: var(--muted-2); font-size: 12.5px; }
.chip {
  display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px;
  background: #f1f3f7; color: var(--muted-2); border: 1px solid var(--line);
}
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: #cdebd9; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: #f3e0bf; }
.chip.idle { background: #f2f4f8; color: var(--muted); }

/* ---------- 菜单 / toast ---------- */
.menu {
  position: absolute; z-index: 30; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, .14);
  padding: 6px; min-width: 250px;
}
.menu-item {
  display: block; width: 100%; text-align: left; border: 0; background: #fff;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 13px; color: var(--text);
}
.menu-item:hover { background: #f4f6fa; }
.menu-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%);
  background: #1f2937; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; z-index: 60; box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
}

/* ---------- 登录表单 ---------- */
.field { display: block; margin: 12px 0 0; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input {
  width: 100%; height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--line); font: 13px/1 inherit; color: var(--text);
  background: #fff; outline: none;
}
.field input:focus { border-color: #9db4ff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .12); }
.form-err { margin: 10px 0 0; font-size: 12px; color: var(--danger); }
.btn-block { width: 100%; margin-top: 14px; }
.demo-hint {
  margin: 12px 0 0; font-size: 11.5px; line-height: 1.7; color: var(--muted);
  border-top: 1px dashed var(--line); padding-top: 10px;
}
.sub-head { padding: 14px 0 8px; border-bottom: 0; }

@media (max-width: 900px) {
  .ov-grid { grid-template-columns: 1fr; }
  .ov-nav { display: flex; overflow-x: auto; gap: 4px; }
  .ov-nav-item { white-space: nowrap; }
  .notes li { grid-template-columns: 1fr auto; }
  .notes .note-date { display: none; }
}

/* 登录失败提示 */
.form-hint {
  margin: 10px 0 0; font-size: 12px; line-height: 1.6; color: var(--muted-2);
  background: #f6f8fb; border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 10px;
}
.form-hint.warn { color: var(--warn); background: var(--warn-soft); border-color: #f3e0bf; }
.form-hint.danger { color: var(--danger); background: #fdeeee; border-color: #f6cfd0; }

/* 页脚备案信息 */
.foot { flex-wrap: wrap; }
.foot a {
  color: var(--muted); text-decoration: none;
  border-bottom: 1px solid transparent; transition: border-color .15s;
}
.foot a:hover { border-bottom-color: var(--muted); }
