/* Plot 在线工作台 */

:root {
  --bg: #f4f4f8;
  --panel: #ffffff;
  --panel-2: #fbfafd;
  --ink: #17151f;
  --ink-2: #454154;
  --sub: #85818f;
  --line: #e7e4ee;
  --line-2: #dcd8e6;
  --violet: #7c3aed;
  --violet-d: #6425d0;
  --violet-dd: #3f167f;
  --violet-soft: #f3edff;
  --violet-soft-2: #e7dcff;
  --green: #159b6b;
  --red: #d64545;
  --radius: 9px;
  --mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 13px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }

.app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ================= 顶栏 ================= */
.topbar {
  height: 52px; flex: 0 0 52px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line);
  position: relative; z-index: 20;
}
.app-id { display: flex; align-items: baseline; gap: 7px; padding-left: 6px; }
.app-name { font-size: 13px; font-weight: 700; color: var(--ink); letter-spacing: .2px; }
.app-ver { font-size: 10.5px; color: #a6a1b2; }

/* 顶栏版本速递：有新版本时，客服右侧出现版本胶囊与浮动的下载图标 */
.upd-pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 9px;
  border: 1px solid rgba(132, 101, 232, .38); border-radius: 13px;
  background: rgba(132, 101, 232, .08); color: #6b4bd6;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.upd-pill:hover { background: rgba(132, 101, 232, .16); border-color: rgba(132, 101, 232, .62); }
.upd-pill[hidden] { display: none; }
.upd-dl { display: inline-flex; width: 15px; height: 15px; animation: updDl 1.8s ease-in-out infinite; }
.upd-dl svg { width: 15px; height: 15px; display: block; }
@keyframes updDl {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}
.top-divider { width: 1px; height: 18px; background: var(--line); }
.proj { display: flex; align-items: center; gap: 10px; min-width: 0; }
.proj-name {
  width: 230px; max-width: 46vw;
  border: 1px solid transparent; background: transparent;
  border-radius: 6px; padding: 4px 7px; font-size: 13.5px; font-weight: 650;
  color: var(--ink); outline: none;
}
.proj-name:hover { background: var(--panel-2); }
.proj-name:focus { background: #fff; border-color: var(--violet-soft-2); box-shadow: 0 0 0 3px rgba(124, 58, 237, .08); }
.save-state {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: #a6a1b2; white-space: nowrap;
}
.save-state::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: #34c759;
}
.save-state.is-saving::before { background: #c7c3d4; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.tb-btn {
  border: 0; background: none; border-radius: 6px;
  padding: 6px 10px; font-size: 12.5px; color: var(--ink-2);
  cursor: pointer; transition: background .14s, color .14s; white-space: nowrap;
}
.tb-btn:hover { background: var(--violet-soft); color: var(--violet-d); }
.tb-home { color: var(--sub); }
.insp-toggle { display: none; color: var(--violet-d); border: 1px solid var(--violet-soft-2); background: var(--violet-soft); }

/* ================= 工作区 ================= */
.workspace {
  flex: 1; min-height: 0; position: relative;
  display: grid; grid-template-columns: 208px minmax(0, 1fr) 286px;
}
/* 收起后悬浮在右边界的展开按钮 */
.insp-reopen {
  display: none; position: absolute; right: 0; top: 64px; z-index: 30;
  align-items: center; gap: 2px; padding: 8px 6px 8px 9px;
  border: 1px solid var(--line-2); border-right: 0;
  border-radius: 8px 0 0 8px; background: #fff; color: var(--sub);
  font-size: 11.5px; cursor: pointer; box-shadow: -4px 2px 12px rgba(40, 20, 70, .08);
}
.insp-reopen:hover { color: var(--violet-d); border-color: var(--violet); }
/* 宽屏：右侧设置栏可整列收起，收起后在右边界出现「设置」按钮恢复 */
@media (min-width: 1021px) {
  .app.insp-closed .workspace { grid-template-columns: 208px minmax(0, 1fr) 0; }
  .app.insp-closed .inspector { display: none; }
  .app.insp-closed .insp-toggle { display: inline-flex; }
  .app.insp-closed .insp-reopen { display: inline-flex; }
}
.nav {
  background: #faf9fc; border-right: 1px solid var(--line);
  padding: 12px 8px 8px; display: flex; flex-direction: column; overflow-y: auto;
}
.nav-sec { margin-bottom: 16px; }
.nav-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .7px; color: #9993a6; text-transform: uppercase;
}
.nav-add {
  width: 18px; height: 18px; border: 1px solid var(--line-2); background: #fff;
  border-radius: 4px; color: var(--sub); font-size: 13px; line-height: 1;
  cursor: pointer; padding: 0;
}
.nav-add:hover { border-color: var(--violet); color: var(--violet-d); background: var(--violet-soft); }
.nav-count { font-size: 10px; background: #ece9f3; border-radius: 999px; padding: 0 6px; color: var(--sub); font-weight: 600; }
.nav-head .nav-count[data-quota] { margin-left: auto; margin-right: 6px; }
.topbar .head-user { margin: 0 4px; position: relative; display: flex; align-items: center; }
.topbar .head-user:empty { display: none; }
.topbar .head-user-btn {
  display: flex; align-items: center; gap: 6px; height: 30px; padding: 0;
  border: 0; background: none;
  font: inherit; font-size: 12.3px; color: var(--ink-2); cursor: pointer;
}
.topbar .head-user-btn:hover { color: var(--ink); }
.topbar .hu-avatar {
  flex: none; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--violet, #7c3aed); color: #fff; font-size: 11px; font-weight: 700;
}
.topbar .hu-name { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .hu-caret { flex: none; font-size: 10px; color: var(--sub); }
.topbar .head-user-btn[aria-expanded="true"] .hu-caret { transform: rotate(180deg); }
.topbar .head-user-link {
  height: 28px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 999px;
  background: #fff; font: inherit; font-size: 12.3px; color: var(--ink-2); cursor: pointer;
}
.topbar .head-user-link:hover { border-color: #cdc6de; color: var(--violet-d); }
.topbar .hu-reg { color: var(--violet-d); }
.topbar .ska-user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80;
  min-width: 148px; padding: 5px; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line-2); border-radius: 9px;
  box-shadow: 0 12px 30px rgba(20, 18, 31, .14);
}
.topbar .ska-user-menu a, .topbar .ska-user-menu button {
  display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px;
  background: none; font: inherit; font-size: 12.5px; color: var(--ink-2);
  text-align: left; text-decoration: none; cursor: pointer;
}
.topbar .ska-user-menu a:hover, .topbar .ska-user-menu button:hover { background: #f5f2fb; color: var(--violet-d); }
.topbar .ska-user-menu .is-danger { color: #c0392b; }
.topbar .ska-user-menu .is-danger:hover { background: #fdf1f0; color: #b12b2b; }
.nav-list { display: grid; gap: 1px; }
.nav-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; border-radius: 6px; font-size: 12.3px; color: var(--ink-2);
  cursor: pointer; border: 1px solid transparent; user-select: none;
}
.nav-item:hover { background: #fff; border-color: var(--line); }
.nav-item.on { background: #fff; border-color: var(--line-2); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(20, 18, 31, .04); }
.nav-item .dot { display: none; }
.nav-item .nm { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; }
.nav-item .nm > i { font-style: normal; display: inline-block; }
.nav-item:hover .nm.is-over > i { animation: navMarquee var(--mt, 6s) linear infinite alternate; }
@keyframes navMarquee {
  from { transform: translateX(0); }
  to { transform: translateX(var(--mshift, 0)); }
}
.nav-empty { padding: 4px 9px; font-size: 11px; color: #b5b0bf; }
.nav-foot {
  margin-top: auto; padding: 10px 8px 2px; border-top: 1px solid var(--line);
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; justify-content: space-between; font-size: 10px; color: #b0abba;
}
.nav-support {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid transparent; background: transparent; border-radius: 6px;
  padding: 3px 6px; font-size: 10.5px; color: #8f89a0; cursor: pointer;
}
.nav-support svg { width: 13px; height: 13px; }
.nav-support:hover { background: #fff; border-color: var(--line-2); color: var(--violet-d); }
/* 在线版/桌面版客服入口统一在顶栏「帮助」右侧 */
.nav-quota { font-size: 10px; color: #8f89a0; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 999px; white-space: nowrap; background: #fff; cursor: pointer; font-family: inherit; }
.nav-quota:hover { color: var(--violet-d); border-color: var(--violet); }
html.is-desktop .nav-quota { display: none; }
html.is-tauri .top-actions .tb-btn[data-act="myProjects"] { display: none; }
.nav-mode { margin-left: auto; }

.main { min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* ================= 视图工具条 ================= */
.view-bar {
  height: 48px; flex: 0 0 48px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px; background: #fff; border-bottom: 1px solid var(--line);
}
.view-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.view-title h1 { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.chip {
  font-size: 10px; color: var(--violet-d); background: var(--violet-soft);
  border: 1px solid var(--violet-soft-2); border-radius: 4px; padding: 1px 6px;
  white-space: nowrap; font-weight: 600;
}
.view-tools { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.v-btn {
  height: 27px; padding: 0 10px; border-radius: 6px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-size: 11.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 5px;
  transition: border-color .14s, color .14s, background .14s;
}
.v-btn:hover { border-color: var(--violet); color: var(--violet-d); }
.v-primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.v-primary:hover { background: var(--violet-d); border-color: var(--violet-d); color: #fff; }

/* 分析菜单 */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 32px; z-index: 30;
  width: 196px; background: #fff; border: 1px solid var(--line-2);
  border-radius: 9px; box-shadow: 0 16px 34px -16px rgba(30, 16, 60, .35);
  padding: 5px;
}
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 8px 9px; border-radius: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer;
}
.menu button:hover { background: var(--violet-soft); color: var(--violet-d); }

/* ================= 数据表 ================= */
.sheet-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #fff; }
.sheet { flex: 1; overflow: auto; padding: 0 0 10px; }
.grid { border-collapse: separate; border-spacing: 0; font-size: 12px; table-layout: fixed; }
.grid th, .grid td { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.grid thead th {
  position: sticky; top: 0; z-index: 5; background: #faf9fc;
  padding: 0; height: 36px; font-weight: 600; color: var(--ink-2);
}
.grid .g-corner {
  position: sticky; left: 0; top: 0; z-index: 8; width: 42px; min-width: 42px;
  background: #f6f4fa; border-right: 1px solid var(--line-2);
}
.grid .g-rowh {
  position: sticky; left: 0; z-index: 4; width: 42px; min-width: 42px;
  background: #faf9fc; text-align: center; font-size: 10.5px;
  color: #a09aad; font-family: var(--mono); font-weight: 400;
}
.grid .g-col { width: 118px; min-width: 118px; }
.col-head {
  display: flex; align-items: center; gap: 3px; padding: 0 5px; height: 36px;
}
.col-head input {
  min-width: 0; flex: 1; border: 0; background: transparent;
  font-size: 11.5px; font-weight: 600; color: var(--ink); outline: none;
  border-radius: 4px; padding: 3px 4px;
}
.col-head input:focus { background: #fff; box-shadow: 0 0 0 2px var(--violet-soft-2); }
.col-head .x-tag {
  font-size: 9px; color: #0e7490; background: #e0f2fe; border-radius: 3px;
  padding: 0 4px; font-weight: 700;
}
.col-del {
  width: 16px; height: 16px; border: 0; background: none; color: #c5c0ce;
  cursor: pointer; font-size: 12px; padding: 0; line-height: 1; opacity: 0;
}
.grid thead th:hover .col-del { opacity: 1; }
.col-del:hover { color: var(--red); }
.grid td { padding: 0; background: #fff; }
.grid td input {
  width: 100%; height: 30px; border: 0; background: transparent;
  padding: 0 8px; font-family: var(--mono); font-size: 11.8px; color: var(--ink);
  outline: none; text-align: right;
}
.grid td input:focus { background: #faf7ff; box-shadow: inset 0 0 0 1.5px var(--violet); }
.grid tbody tr:nth-child(even) td { background: #fdfdfe; }
.grid tbody tr:hover td { background: #faf9fe; }
.grid td.empty-cell input::placeholder { color: #d3cedb; }
.sheet-hint {
  flex: 0 0 auto; padding: 8px 14px; border-top: 1px solid var(--line);
  background: #fbfafd; font-size: 11px; color: var(--sub);
}
kbd {
  font: 10.5px/1 var(--mono); background: #fff; border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 4px; padding: 1px 4px;
}

/* ================= 图表 ================= */
.chart-stage {
  flex: 1; min-height: 0; overflow: auto;
  background:
    radial-gradient(circle at 1px 1px, #ddd8e6 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  display: flex; flex-direction: column; align-items: center;
  padding: 26px 22px 22px; gap: 12px;
}
.chart-paper {
  background: #fff; border: 1px solid var(--line);
  box-shadow: 0 18px 44px -26px rgba(30, 16, 60, .3);
  border-radius: 4px; padding: 6px; max-width: 100%;
}
.chart-paper svg { display: block; max-width: 100%; height: auto; }
.chart-meta {
  font-size: 10.5px; color: #9a95a7; text-align: center;
  max-width: 620px; line-height: 1.7;
}

/* ================= 示意图 ================= */
.schem-body { flex: 1; min-height: 0; display: flex; background: #fff; }
.schem-palette {
  width: 200px; flex: 0 0 200px; overflow-y: auto;
  background: #faf9fc; border-right: 1px solid var(--line);
  padding: 8px 8px 18px;
}
.sch-cat { margin-bottom: 10px; }
.sch-cat > h4 {
  padding: 4px 6px 6px; font-size: 10.5px; font-weight: 700;
  letter-spacing: .6px; color: #9993a6;
}
.sch-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.sch-comp {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 3px 3px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; cursor: pointer; transition: border-color .14s, background .14s, transform .1s;
}
.sch-comp:hover { border-color: var(--violet); background: var(--violet-soft); }
.sch-comp:active { transform: scale(.96); }
.sch-comp svg { display: block; width: 100%; height: 34px; pointer-events: none; }
.sch-comp span {
  max-width: 100%; font-size: 9.5px; line-height: 1.25; color: var(--sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.schem-stage {
  flex: 1; min-width: 0; min-height: 0; overflow: auto;
  background:
    radial-gradient(circle at 1px 1px, #ddd8e6 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
  padding: 24px 22px 18px;
  /* 用 margin:auto 居中而不是 align-items:center，放大溢出时左侧仍可滚动/拖动查看 */
  display: flex; flex-direction: column; align-items: flex-start; gap: 12px;
  cursor: all-scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.schem-stage::-webkit-scrollbar { width: 0; height: 0; }
.schem-paper svg circle[data-resize="nw"],
.schem-paper svg circle[data-resize="se"] { cursor: nwse-resize; }
.schem-paper svg circle[data-resize="ne"],
.schem-paper svg circle[data-resize="sw"] { cursor: nesw-resize; }
.schem-stage.is-panning, .schem-stage.is-panning * { cursor: all-scroll !important; }
.schem-stage.is-connecting, .schem-stage.is-connecting * { cursor: crosshair !important; }
.schem-stage svg { user-select: none; -webkit-user-select: none; }
.schem-paper svg g[data-item] { cursor: move; }
.schem-paper {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  box-shadow: 0 18px 44px -26px rgba(30, 16, 60, .3);
  padding: 0; line-height: 0; max-width: 100%;
  margin-left: auto; margin-right: auto; flex: 0 0 auto;
}
.schem-stage > .chart-meta { margin-left: auto; margin-right: auto; }
.schem-paper.is-zoomed { max-width: none; }
.schem-zoom {
  display: flex; align-items: center; gap: 1px;
  border: 1px solid var(--line); border-radius: 7px; padding: 1px; margin-right: 2px;
  background: #fff;
}
.schem-zoom .z-btn { padding: 4px 8px; font-size: 14px; line-height: 1; font-weight: 600; }
.schem-zoom .z-val {
  padding: 4px 6px; min-width: 50px; text-align: center;
  font-family: var(--mono); font-size: 11px; color: var(--ink-2);
}
.schem-paper svg { display: block; max-width: 100%; height: auto; touch-action: none; }
.schem-paper.is-zoomed svg { width: 100%; max-width: none; height: auto; }
.schem-empty {
  padding: 60px 40px; text-align: center; color: #9993a6;
  font-size: 12.5px; line-height: 1.9;
}
#viewSchematic .view-bar {
  height: auto; min-height: 48px; flex: 0 0 auto;
  flex-wrap: wrap; padding: 6px 14px; row-gap: 5px;
}
#viewSchematic .view-title h1 { max-width: 300px; }
#viewSchematic .view-tools { flex-wrap: wrap; justify-content: flex-end; row-gap: 4px; }
#viewSchematic .v-btn { white-space: nowrap; flex: 0 0 auto; }
.sch-val {
  flex: 0 0 38px; text-align: right; font-family: var(--mono);
  font-size: 10.5px; font-weight: 500; color: var(--sub);
}
.sch-check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); cursor: pointer; }
.sch-check input { accent-color: var(--violet); }
.sch-color {
  width: 46px; height: 26px; padding: 2px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 6px; background: #fff;
}
.sch-btns { display: flex; gap: 6px; margin-top: 8px; }
.sch-btns .mini-btn { flex: 1; }
html[data-theme="dark"] .schem-body { background: var(--panel); }
html[data-theme="dark"] .schem-palette { background: #17141e; }
html[data-theme="dark"] .sch-comp { background: var(--panel-2); }
html[data-theme="dark"] .schem-stage {
  background:
    radial-gradient(circle at 1px 1px, #3a3448 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
}

/* ================= 结果 ================= */
.result-stage {
  flex: 1; min-height: 0; overflow: auto; padding: 26px 22px 40px;
  display: flex; justify-content: center; align-items: flex-start;
}
.result-paper {
  width: 100%; max-width: 860px; background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 18px 40px -30px rgba(30, 16, 60, .3);
  padding: 30px 34px 34px;
}
.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 18px; }
.rp-head h2 { font-size: 17px; }
.rp-sub { font-size: 11.5px; color: var(--sub); margin-top: 3px; }
.rp-kicker { font-size: 10px; letter-spacing: 1px; color: var(--violet-d); font-weight: 700; text-transform: uppercase; }
.rp-section { margin-bottom: 22px; }
.rp-section h3 { font-size: 12.5px; margin-bottom: 9px; color: var(--ink-2); }
.rp-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rp-table th, .rp-table td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: right; }
.rp-table th:first-child, .rp-table td:first-child { text-align: left; }
.rp-table thead th { background: #fbfaff; font-size: 11px; color: var(--sub); font-weight: 600; }
.rp-table td { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.rp-table td.sig { color: var(--violet-d); font-weight: 700; }
.rp-note {
  background: #fbf9ff; border: 1px solid var(--violet-soft-2); border-radius: 8px;
  padding: 12px 14px; font-size: 12px; color: var(--ink-2); line-height: 1.8;
}
.rp-note b { color: var(--violet-d); }
.rp-meta { margin-top: 22px; padding-top: 12px; border-top: 1px dashed var(--line-2); font-size: 10.5px; color: #a8a2b4; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ================= 右侧检查器 ================= */
.inspector {
  background: #faf9fc; border-left: 1px solid var(--line);
  overflow: hidden; padding: 0; display: flex; flex-direction: column;
}
.insp-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; }
.insp-note { font-size: 10.5px; color: #a19bab; line-height: 1.7; margin: 4px 0 8px; }
.inspector > .insp-note {
  flex: 0 0 auto; margin: 0; background: #faf9fc;
  padding: 9px 12px 12px; border-top: 1px solid var(--line);
}
.insp-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; font-weight: 700; letter-spacing: .7px; color: #9993a6;
  text-transform: uppercase; padding: 2px 2px 10px;
}
/* 设置面板收起按钮 */
.insp-fold {
  flex: 0 0 auto; width: 22px; height: 20px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 5px; background: #fff;
  color: var(--sub); font-size: 13px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.insp-fold:hover { border-color: var(--violet); color: var(--violet-d); background: var(--violet-soft); }
.insp-group { margin-bottom: 16px; }
.insp-group > h4 {
  font-size: 10.5px; color: #9993a6; font-weight: 700; letter-spacing: .5px;
  margin: 0 0 7px 2px;
}
.insp-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.insp-row > label { font-size: 12px; color: var(--ink-2); flex: 0 0 auto; }
.insp-row .grow { flex: 1; min-width: 0; }
.insp-field {
  height: 27px; border: 1px solid var(--line-2); border-radius: 6px; background: #fff;
  padding: 0 7px; font-size: 11.5px; color: var(--ink-2); outline: none; width: 100%;
}
.insp-field:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 58, 237, .08); }
textarea.insp-field.sch-data {
  height: auto; min-height: 58px; padding: 6px 7px; line-height: 1.55;
  resize: vertical; font-family: var(--mono); font-size: 11px;
}
select.insp-field { cursor: pointer; }
.insp-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.insp-check { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); cursor: pointer; margin-bottom: 7px; }
.insp-check input { accent-color: var(--violet); }
.insp-empty { font-size: 11.5px; color: #aaa5b5; line-height: 1.8; padding: 6px 4px; }
.mini-btn {
  width: 100%; height: 29px; border: 1px solid var(--line-2); background: #fff;
  border-radius: 6px; font-size: 11.5px; color: var(--ink-2); cursor: pointer;
}
.mini-btn:hover { border-color: var(--violet); color: var(--violet-d); }
.mini-btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.mini-btn.primary:hover { background: var(--violet-d); }
.stat-list { display: grid; gap: 6px; }
.stat-item {
  display: flex; justify-content: space-between; gap: 8px; font-size: 11.5px;
  padding: 6px 8px; background: #fff; border: 1px solid var(--line); border-radius: 6px;
}
.stat-item span { color: var(--sub); }
.stat-item b { font-family: var(--mono); font-weight: 600; color: var(--ink-2); }
.theme-row { display: flex; gap: 6px; flex-wrap: wrap; }
.theme-chip {
  border: 1px solid var(--line-2); background: #fff; border-radius: 6px;
  padding: 4px 7px; font-size: 10.5px; color: var(--ink-2); cursor: pointer;
}
.theme-chip.on { border-color: var(--violet); color: var(--violet-d); background: var(--violet-soft); }
.swatch-row { display: flex; gap: 5px; flex-wrap: wrap; }
.swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, .08); cursor: pointer; position: relative; }
.swatch.on::after { content: ""; position: absolute; inset: 3px; border: 2px solid #fff; border-radius: 3px; }

/* ================= 弹窗 ================= */
.modal-root {
  position: fixed; inset: 0; z-index: 100; background: rgba(24, 16, 40, .38);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  backdrop-filter: blur(2px);
}
.modal {
  width: 100%; max-width: 430px; background: #fff; border-radius: 12px;
  box-shadow: 0 30px 70px -24px rgba(20, 10, 40, .5);
  padding: 20px 22px 18px; max-height: 86vh; overflow-y: auto;
}
.modal.wide { max-width: 620px; }
.modal h3 { font-size: 15px; margin-bottom: 4px; }
.modal .m-sub { font-size: 11.5px; color: var(--sub); margin-bottom: 16px; }
.modal .m-row { margin-bottom: 12px; }
.modal .m-row > label { display: block; font-size: 11.5px; color: var(--ink-2); margin-bottom: 5px; }
.modal .m-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.modal .btn-cancel { border: 1px solid var(--line-2); background: #fff; border-radius: 7px; height: 32px; padding: 0 14px; font-size: 12px; cursor: pointer; }
.modal .btn-go { border: 0; background: var(--violet); color: #fff; border-radius: 7px; height: 32px; padding: 0 16px; font-size: 12px; cursor: pointer; }
.modal .btn-go:hover { background: var(--violet-d); }
.modal .m-msg { font-size: 12px; color: var(--ink-2); line-height: 1.8; }
.modal .m-msg p { margin: 0 0 8px; }
.modal .m-msg ul { margin: 0; padding-left: 18px; }
.modal .m-msg code { font-family: var(--mono); font-size: 11px; background: #f5f3fa; border-radius: 3px; padding: 1px 4px; }
.proj-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; }
.proj-list li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.proj-list li:last-child { border-bottom: 0; }
.proj-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.proj-meta b { font-size: 12.5px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-meta span { font-size: 10.5px; color: var(--sub); }
.proj-ops { display: flex; gap: 6px; }
.proj-empty { padding: 22px 12px; text-align: center; font-size: 12px; color: var(--sub); border: 1px dashed var(--line-2); border-radius: 8px; }
.proj-more { display: flex; justify-content: center; margin-top: 10px; }
.proj-more .v-btn { font-size: 12px; }
.proj-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 8px; }
.proj-check { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sub); cursor: pointer; }
.proj-check input { width: 14px; height: 14px; accent-color: var(--violet); cursor: pointer; }
.proj-del-selected { color: #d9534f; border-color: rgba(217, 83, 79, .35); }
.proj-del-selected:disabled { opacity: .45; cursor: default; }
.proj-del-selected:not(:disabled):hover { background: rgba(217, 83, 79, .08); }
.m-input { width: 100%; height: 36px; margin-top: 10px; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px; font: inherit; font-size: 13px; color: var(--ink); outline: none; box-sizing: border-box; }
.m-input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 92, 255, .12); }

/* ================= Toast ================= */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #241a38; color: #fff; border-radius: 8px;
  padding: 9px 16px; font-size: 12px; z-index: 400;
  box-shadow: 0 14px 30px -14px rgba(0, 0, 0, .5);
  animation: toastIn .18s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

.signif-list { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; }
.signif-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px 26px; gap: 4px; align-items: center; }
.signif-row .insp-field { height: 26px; font-size: 11px; padding: 0 4px; }
.signif-row .sig-label { text-align: center; font-weight: 600; }

/* ================= 免疫印迹拼图 ================= */
.blot-row-editor {
  display: grid; grid-template-columns: minmax(0, 1fr) 48px auto auto;
  gap: 5px; align-items: center; margin-bottom: 6px;
}
.blot-row-editor .insp-field { height: 28px; font-size: 12px; }
.blot-row-editor .blot-h { padding: 0 4px; text-align: center; }
.mini-icon {
  width: 26px; height: 28px; border: 1px solid var(--line-2); background: #fff;
  border-radius: 6px; font-size: 11px; color: var(--ink-2); cursor: pointer;
}
.mini-icon:hover { border-color: var(--violet); color: var(--violet-d); }
.mini-icon.danger:hover { border-color: #d8a0a0; color: #b04545; }

.crop-stage {
  position: relative; display: inline-block; max-width: 100%; line-height: 0;
  border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden;
  cursor: crosshair; touch-action: none; user-select: none;
}
.crop-stage img { display: block; max-width: 100%; max-height: 56vh; }
.crop-box {
  position: absolute; border: 1.5px solid var(--violet); background: rgba(124, 58, 237, .12);
  box-shadow: 0 0 0 9999px rgba(20, 10, 40, .18); pointer-events: none;
}
.crop-fields { display: grid; grid-template-columns: 1fr 96px; gap: 8px; margin-top: 12px; }
.crop-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--ink-2); }
.crop-fields .insp-field { height: 30px; }
.crop-hint { font-size: 11px; color: #9a95a7; margin-top: 8px; }
.modal.wide { max-width: 700px; }
/* 示意图模板选择 */
.tpl-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tpl-pick-head h3 { margin: 0; }
.tpl-pick-close {
  width: 28px; height: 28px; flex: 0 0 28px; border: 0; border-radius: 6px;
  background: none; color: var(--sub); font-size: 20px; line-height: 1; cursor: pointer;
}
.tpl-pick-close:hover { background: var(--violet-soft); color: var(--violet-d); }
.tpl-pick-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tpl-pick-card {
  text-align: left; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; padding: 12px 12px 14px; cursor: pointer;
  transition: border-color .14s, box-shadow .14s;
}
.tpl-pick-card:hover { border-color: var(--violet); box-shadow: 0 6px 18px -10px rgba(90, 60, 160, .45); }
.tpl-pick-card b { display: block; margin-bottom: 4px; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.tpl-pick-card small { display: block; font-size: 10.5px; color: var(--sub); line-height: 1.55; }
html[data-theme="dark"] .tpl-pick-card { background: var(--panel-2); }
@media (max-width: 640px) { .tpl-pick-grid { grid-template-columns: 1fr; } }

/* ================= 响应式 ================= */
@media (max-width: 1180px) {
  .workspace { grid-template-columns: 188px minmax(0, 1fr) 250px; }
}
@media (max-width: 1020px) {
  .workspace { grid-template-columns: 180px minmax(0, 1fr); }
  .inspector {
    position: fixed; right: 0; top: 52px; bottom: 0; width: 260px; z-index: 40;
    box-shadow: -16px 0 34px -24px rgba(20, 10, 40, .4);
    transform: translateX(100%); transition: transform .2s;
  }
  .app.insp-open .inspector { transform: none; }
  .insp-toggle { display: inline-flex !important; }
}
@media (max-width: 780px) {
  .workspace { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .nav {
    flex-direction: row; overflow-x: auto; overflow-y: hidden;
    border-right: 0; border-bottom: 1px solid var(--line);
    padding: 6px 8px; gap: 12px; flex: 0 0 auto;
  }
  .nav-sec { margin-bottom: 0; display: flex; align-items: center; gap: 6px; }
  .nav-head { padding: 0; white-space: nowrap; }
  .nav-list { display: flex; gap: 4px; }
  .nav-item { white-space: nowrap; max-width: 150px; }
  .nav-empty, .nav-foot { display: none; }
  .view-bar { height: auto; min-height: 48px; flex: 0 0 auto; flex-wrap: wrap; padding: 7px 10px; gap: 6px; }
  .view-title { width: 100%; }
  .view-tools { margin-left: 0; flex-wrap: wrap; }
  .top-actions .tb-btn[data-act="new"],
  .top-actions .tb-btn[data-act="open"],
  .top-actions .tb-btn[data-act="importCsv"] { display: none; }
  .proj-name { width: 120px; }
  .save-state { display: none; }
  .chart-stage { padding: 14px 10px; }
  .schem-stage { padding: 14px 10px; }
  .schem-palette { width: 148px; flex-basis: 148px; padding: 6px 6px 14px; }
  .sch-grid { grid-template-columns: repeat(2, 1fr); }
  .result-stage { padding: 14px 10px 30px; }
  .result-paper { padding: 20px 16px 24px; }
  .grid .g-col { width: 96px; min-width: 96px; }
}

/* ============ 更新提示（与 SeqKan DNA 一致） ============ */
.update-mask {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(17, 24, 39, .3);
  backdrop-filter: blur(2px);
}
.update-mask[hidden] { display: none; }

.update-card {
  position: relative;
  width: 500px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px);
  display: flex; flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .24);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  animation: updIn .2s ease-out;
}
@keyframes updIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.update-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.update-arc { position: absolute; display: block; border-radius: 50%; background: #f4f1fd; }
.update-arc-a { width: 420px; height: 420px; left: -70px; top: -160px; }
.update-arc-b { width: 560px; height: 560px; right: -250px; bottom: -270px; opacity: .8; }

.update-close {
  position: absolute; top: 12px; right: 14px; z-index: 2;
  width: 28px; height: 28px; padding: 0;
  border: none; background: transparent; color: #9aa0a6;
  font-size: 19px; line-height: 1; cursor: pointer; border-radius: 6px;
}
.update-close:hover { background: #f2f3f5; color: #1d1d1f; }

.update-body {
  position: relative;
  flex: 1 1 auto; min-height: 240px;
  padding: 38px 42px 30px;
  overflow: auto;
}
.update-version {
  margin: 0;
  font-size: 28px; font-weight: 600; color: #1d1d1f; letter-spacing: .2px;
}
.update-sub { margin: 10px 0 0; font-size: 12.5px; color: #9aa0a6; }
.update-notes {
  margin-top: 30px;
  font-size: 13.5px; line-height: 1.9; color: #4b5058;
  white-space: pre-wrap;
}
.update-notes:empty { display: none; }

.update-progress-wrap { margin-top: 22px; }
.update-bar { height: 6px; border-radius: 5px; background: #eceef1; overflow: hidden; }
.update-fill {
  height: 100%; width: 0; border-radius: 5px;
  background: #6d4bd8; transition: width .2s ease-out;
}
.update-progress-row {
  display: flex; justify-content: space-between;
  margin-top: 7px; font-size: 11.5px; color: #9aa0a6;
}
.update-progress-row span:first-child { font-weight: 700; color: #1d1d1f; }

.update-tip { margin-top: 12px; font-size: 12px; color: #9aa0a6; line-height: 1.6; }
.update-tip.error { color: #c53030; }

.update-foot {
  position: relative;
  border-top: 1px solid #ededf0;
  padding: 16px 42px 18px;
  background: #fff;
}
.update-reco { display: flex; align-items: center; gap: 16px; }
.update-reco-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.update-reco-copy b { font-size: 13.5px; font-weight: 600; color: #1d1d1f; }
.update-reco-copy span { font-size: 12.5px; color: #9aa0a6; }
.update-reco-link { flex: none; font-size: 13px; color: #6d4bd8; text-decoration: none; }
.update-reco-link:hover { text-decoration: underline; }

.update-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 18px; margin-top: 14px;
}
.upd-link {
  padding: 4px 2px; border: none; background: none;
  color: #8a8f98; font-size: 12.5px; cursor: pointer;
}
.upd-link:hover { color: #1d1d1f; text-decoration: underline; }

.update-cta {
  height: 36px; padding: 0 24px;
  border: none; border-radius: 18px;
  background: #6d4bd8; color: #fff;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.update-cta:hover { background: #5b3bc0; }
.update-cta:disabled { opacity: .55; cursor: not-allowed; }

/* ================= 桌面端专属：精简标识 ================= */
html.is-tauri .app-id,
html.is-tauri .app-id + .top-divider { display: none; }
/* 桌面版：语言与背景由原生「视图」菜单提供，隐藏顶栏菜单按钮 */
html.is-tauri .prefs-wrap,
html.is-tauri .prefs-divider { display: none; }
/* 在线版：没有本地文件可覆盖，隐藏「保存」，另存为即可下载 .plot */
html:not(.is-tauri) [data-act="save"] { display: none; }

/* ================= 启动欢迎动画（仅桌面端） ================= */
.welcome {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  background: radial-gradient(120% 120% at 50% 0%, #f7f3ff 0%, #ffffff 46%, #f1ecff 100%);
  pointer-events: all;
  animation: welcomeOut .5s ease 1.55s forwards;
}
html.is-tauri .welcome { display: flex; }
.welcome-card {
  display: flex; flex-direction: column; align-items: center; gap: 15px;
  animation: welcomeIn .55s cubic-bezier(.22, .9, .28, 1) both;
}
.welcome-mark {
  width: 76px; height: 76px; border-radius: 22px;
  box-shadow: 0 18px 42px rgba(84, 36, 160, .22);
  animation: welcomeFloat 1.7s ease-in-out infinite;
}
.welcome-copy { text-align: center; }
.welcome-copy b {
  display: block; font-size: 22px; font-weight: 700;
  letter-spacing: .3px; color: #2a1b46;
}
.welcome-copy span {
  display: block; margin-top: 5px;
  font-size: 12.5px; letter-spacing: 1.6px; color: #8b81a5;
}
.welcome-bar {
  width: 152px; height: 3px; border-radius: 999px;
  background: #ece5fa; overflow: hidden;
}
.welcome-bar i {
  display: block; width: 0; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #8b5cf6, #4c1d95);
  animation: welcomeBar 1.35s cubic-bezier(.4, 0, .2, 1) .12s forwards;
}
@keyframes welcomeIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes welcomeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes welcomeBar {
  from { width: 0; }
  to { width: 100%; }
}
@keyframes welcomeOut {
  to { opacity: 0; visibility: hidden; }
}

/* ================= 顶栏：菜单 / 客服角标 ================= */
.support-btn { position: relative; }
.support-dot {
  position: absolute; top: -5px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ef4444; color: #fff; font-size: 10px; line-height: 16px;
  font-weight: 700; text-align: center; box-shadow: 0 0 0 2px var(--panel);
}
.prefs-wrap { position: relative; display: inline-flex; align-items: center; }
.prefs-caret { margin-left: 4px; font-size: 9px; opacity: .6; }
.prefs-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80; width: 176px;
  padding: 8px; background: #fff; border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: 0 16px 36px rgba(24, 18, 44, .16);
}
.prefs-menu[hidden] { display: none; }
.prefs-group + .prefs-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.prefs-title { padding: 4px 8px 5px; font-size: 11px; color: var(--sub); }
.prefs-opt {
  display: flex; align-items: center; width: 100%; height: 30px; padding: 0 8px;
  border: 0; border-radius: 6px; background: none; color: var(--ink-2);
  font: inherit; font-size: 12.5px; text-align: left; cursor: pointer;
}
.prefs-opt:hover { background: var(--violet-soft); color: var(--violet-d); }
.prefs-opt.on { color: var(--violet-d); font-weight: 600; }
.prefs-opt.on::before { content: '✓'; width: 14px; font-size: 11px; }
.prefs-opt:not(.on)::before { content: ''; width: 14px; }

/* ================= 客服弹窗 / 未读提示 ================= */
.sk-chat-mask {
  position: fixed; inset: 0; z-index: 9500; display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 22px; background: rgba(10, 8, 18, .42);
}
.sk-chat-mask[hidden] { display: none; }
.sk-chat-box {
  display: flex; flex-direction: column; width: 400px; height: 590px;
  max-width: calc(100vw - 24px); max-height: calc(100vh - 44px);
  border-radius: 16px; overflow: hidden; background: #fff;
  box-shadow: 0 24px 70px rgba(2, 8, 20, .45);
}
.sk-chat-frame { flex: 1; width: 100%; min-height: 0; border: 0; background: #fff; }
.sk-chat-mini {
  display: flex; align-items: center; justify-content: flex-end; gap: 14px;
  height: 32px; padding: 0 12px; background: #f6f7fa; border-top: 1px solid #e9eef0;
}
.sk-chat-mini button { border: 0; background: none; color: #667085; font: inherit; font-size: 11.5px; cursor: pointer; }
.sk-chat-mini button:hover { color: var(--violet-d); }
.sk-chat-toast {
  position: fixed; top: 18px; right: 18px; z-index: 9600; width: 286px;
  padding: 11px 34px 12px 13px; background: #fff; border-left: 4px solid var(--violet);
  border-radius: 10px; box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
  font-size: 13px; line-height: 1.5; color: #0f172a; cursor: pointer;
}
.sk-chat-toast[hidden] { display: none; }
.sk-chat-toast b { display: block; margin-bottom: 2px; color: var(--violet-d); font-size: 12.5px; }
.sk-chat-toast p { margin: 0; color: #475569; }
.sk-chat-toast button {
  position: absolute; top: 6px; right: 8px; border: 0; background: none;
  color: #94a3b8; font-size: 16px; line-height: 1; cursor: pointer;
}
@media (max-width: 560px) {
  .sk-chat-mask { padding: 0; }
  .sk-chat-box { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; }
}

/* ================= 深色主题 ================= */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121017;
  --panel: #1c1924;
  --panel-2: #24202d;
  --ink: #ece9f3;
  --ink-2: #c6c1d1;
  --sub: #948fa4;
  --line: #2d2938;
  --line-2: #3c3749;
  --violet: #8b5cf6;
  --violet-d: #b79bfa;
  --violet-dd: #d9c9ff;
  --violet-soft: #281f3c;
  --violet-soft-2: #3b2c59;
  --green: #4ade80;
  --red: #f87171;
}
html[data-theme="dark"] .topbar,
html[data-theme="dark"] .view-bar,
html[data-theme="dark"] .sheet-wrap { background: var(--panel); }
html[data-theme="dark"] .nav { background: #17141e; }
html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .nav-item.on {
  background: var(--panel-2); border-color: var(--line-2); color: var(--ink); box-shadow: none;
}
html[data-theme="dark"] .nav-add,
html[data-theme="dark"] .nav-quota,
html[data-theme="dark"] .nav-support:hover,
html[data-theme="dark"] .v-btn,
html[data-theme="dark"] .mini-btn,
html[data-theme="dark"] .mini-icon,
html[data-theme="dark"] .theme-chip,
html[data-theme="dark"] .modal .btn-cancel,
html[data-theme="dark"] kbd { background: var(--panel-2); }
html[data-theme="dark"] .grid thead th,
html[data-theme="dark"] .grid .g-rowh { background: #221f2a; }
html[data-theme="dark"] .grid .g-corner { background: #26222f; }
html[data-theme="dark"] .grid td,
html[data-theme="dark"] .sheet-hint { background: var(--panel); }
html[data-theme="dark"] .grid tbody tr:nth-child(even) td { background: #1f1c27; }
html[data-theme="dark"] .grid tbody tr:hover td { background: #272230; }
html[data-theme="dark"] .grid td input:focus,
html[data-theme="dark"] .col-head input:focus,
html[data-theme="dark"] .proj-name:focus { background: #2c2638; }
html[data-theme="dark"] .sheet-hint { background: #1e1b26; }
html[data-theme="dark"] .nav-count { background: #2c2638; color: #a8a2b6; }
html[data-theme="dark"] .col-head .x-tag { background: #12343f; color: #7dd3fc; }
html[data-theme="dark"] .menu,
html[data-theme="dark"] .modal,
html[data-theme="dark"] .proj-list,
html[data-theme="dark"] .m-input,
html[data-theme="dark"] .insp-field,
html[data-theme="dark"] .stat-item { background: var(--panel-2); }
html[data-theme="dark"] .modal .m-msg code { background: #2c2638; }
html[data-theme="dark"] .inspector,
html[data-theme="dark"] .inspector > .insp-note { background: #17141e; }
html[data-theme="dark"] .chart-stage {
  background:
    radial-gradient(circle at 1px 1px, #3a3448 1px, transparent 0) 0 0 / 18px 18px,
    var(--bg);
}
html[data-theme="dark"] .result-paper { background: var(--panel); }
html[data-theme="dark"] .rp-table thead th { background: #26222f; }
html[data-theme="dark"] .rp-note { background: #241d33; }
html[data-theme="dark"] .v-primary:hover { background: #7c3aed; border-color: #7c3aed; }
html[data-theme="dark"] .mini-btn.primary:hover,
html[data-theme="dark"] .modal .btn-go:hover { background: #7c3aed; }
html[data-theme="dark"] .welcome {
  background: radial-gradient(120% 120% at 50% 0%, #261f36 0%, #15121c 46%, #1e1831 100%);
}
html[data-theme="dark"] .welcome-copy b { color: #f0ecf7; }
html[data-theme="dark"] .welcome-bar { background: #2e2740; }
html[data-theme="dark"] .update-card,
html[data-theme="dark"] .update-foot { background: #1d1a25; }
html[data-theme="dark"] .update-version,
html[data-theme="dark"] .update-reco-copy b,
html[data-theme="dark"] .update-progress-row span:first-child { color: #f2eff7; }
html[data-theme="dark"] .update-notes { color: #c9c4d4; }
html[data-theme="dark"] .update-foot { border-top-color: #2f2a3a; }
html[data-theme="dark"] .update-arc { background: #2a2338; }
html[data-theme="dark"] .update-bar { background: #2f2a3a; }
html[data-theme="dark"] .update-close:hover { background: #2c2738; color: #fff; }
html[data-theme="dark"] .prefs-menu { background: var(--panel-2); border-color: var(--line-2); }
html[data-theme="dark"] .prefs-opt:hover { background: #2c2638; }
html[data-theme="dark"] .sk-chat-mini { background: #1d1a25; border-top-color: #2f2a3a; }
html[data-theme="dark"] .sk-chat-mini button { color: #a8a2b6; }
html[data-theme="dark"] .sk-chat-toast { background: #1d1a25; color: #ece9f3; }
html[data-theme="dark"] .sk-chat-toast p { color: #c9c4d4; }
html[data-theme="dark"] .sk-chat-toast button { color: #8f8a9d; }

@media (max-width: 900px) {
  .prefs-menu { right: -6px; }
}
