/* ============================================================
   蚁后科学 · 原型与 PRD 工作台
   设计基调：中性冷灰工作台 + 靛蓝主色，右侧 PRD 用靛紫标识
   ============================================================ */
:root {
  --gb-primary: #4f46e5;      /* 靛蓝主色 */
  --gb-primary-600: #4338ca;
  --gb-accent: #7c3aed;       /* PRD 靛紫 */
  --gb-accent-2: #a855f7;
  --ink: #1f2430;
  --ink-soft: #4b5563;
  --ink-muted: #8b93a3;
  --line: #e6e8ee;
  --bg: #eceef3;              /* 工作台底色 */
  --surface: #ffffff;
  --radius: 14px;
  --shadow-lg: 0 24px 60px -20px rgba(31, 36, 48, .28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* 背景网格纹理，弱化的工作台质感 */
body {
  background-image:
    linear-gradient(rgba(79, 70, 229, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, .035) 1px, transparent 1px);
  background-size: 26px 26px;
  display: flex;
  flex-direction: column;
}

/* ---------- 顶栏 ---------- */
.topbar {
  height: 60px;
  flex: 0 0 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(31, 36, 48, .02);
  z-index: 10;
}
.topbar__brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.topbar__logo {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--gb-primary), var(--gb-accent));
  color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.topbar__title { display: flex; flex-direction: column; line-height: 1.2; }
.topbar__title strong { font-size: 15px; }
.topbar__title small { font-size: 11px; color: var(--ink-muted); }

.topbar__nav {
  flex: 1 1 auto;
  display: flex; align-items: center;
  padding: 0 4px;
  position: relative;
}

/* ---------- 功能模块下拉选择器 ---------- */
.nav-select__trigger {
  display: inline-flex; align-items: center; gap: 10px;
  min-width: 220px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px; font-family: inherit; font-weight: 600;
  padding: 8px 12px; border-radius: 10px;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.nav-select__trigger:hover { border-color: var(--gb-primary); }
.nav-select__trigger.is-open {
  border-color: var(--gb-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.nav-select__label { flex: 1 1 auto; text-align: left; }
.nav-select__caret {
  flex: 0 0 auto; color: var(--ink-muted); font-size: 11px;
  transition: transform .18s;
}
.nav-select__trigger.is-open .nav-select__caret { transform: rotate(180deg); }

.nav-select__menu {
  position: absolute; top: calc(100% + 6px); left: 4px;
  min-width: 260px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(31, 36, 48, .3);
  padding: 6px;
  display: none; flex-direction: column; gap: 2px;
  z-index: 30;
}
.nav-select__menu.is-open { display: flex; }
.nav-select__opt {
  display: flex; align-items: center; gap: 10px;
  border: none; background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px; font-family: inherit; text-align: left;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-select__opt:hover { background: #f2f3f7; color: var(--ink); }
.nav-select__opt-dot {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%;
  background: var(--line);
}
.nav-select__opt-text { flex: 1 1 auto; }
.nav-select__opt-check {
  flex: 0 0 auto; color: var(--gb-primary); font-weight: 700;
  opacity: 0; font-size: 13px;
}
.nav-select__opt.is-active {
  background: rgba(79, 70, 229, .1);
  color: var(--gb-primary-600); font-weight: 600;
}
.nav-select__opt.is-active .nav-select__opt-dot { background: var(--gb-primary); }
.nav-select__opt.is-active .nav-select__opt-check { opacity: 1; }
.topbar__actions { flex: 0 0 auto; }
.topbar__actions { display: flex; align-items: center; gap: 7px; }
.topbar__status { min-width: 64px; font-size: 12px; color: var(--ink-muted); text-align: right; }
.topbar__status.is-editing { color: #2563eb; }
.topbar__status.is-saving { color: #b45309; }
.topbar__status.is-error { color: #dc2626; }

/* ---------- 端切换分段控件 ---------- */
.seg {
  flex: 0 0 auto; display: inline-flex; gap: 2px;
  background: #f0f1f5; border: 1px solid var(--line);
  border-radius: 10px; padding: 3px;
}
.seg__btn {
  border: none; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12.5px; color: var(--ink-soft);
  padding: 6px 14px; border-radius: 7px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; transition: background .15s, color .15s;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--surface); color: var(--gb-primary-600); font-weight: 600; box-shadow: 0 1px 3px rgba(31,36,48,.12); }
.btn-ghost {
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-soft); font-size: 13px; font-family: inherit;
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.btn-ghost:hover { border-color: var(--gb-primary); color: var(--gb-primary); }
.btn-note {
  border: 1px solid #f1c878; background: #fff9e9; color: #9a641d;
  font-size: 13px; font-family: inherit; font-weight: 700;
  padding: 7px 9px 7px 12px; border-radius: 8px; cursor: pointer;
}
.btn-note span {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  margin-left: 5px; padding: 0 5px; border-radius: 999px;
  background: #e89b28; color: #fff; font-size: 10px;
}
.btn-edit, .btn-save {
  border: none; color: #fff; font-size: 13px; font-family: inherit; font-weight: 600;
  padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.btn-edit { background: #2563eb; }
.btn-save { background: #16a34a; }
.btn-edit:hover, .btn-save:hover { filter: brightness(.95); }
.btn-save:disabled { opacity: .55; cursor: wait; }
[hidden] { display: none !important; }

/* ---------- 主体布局 ---------- */
.workspace {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 270px minmax(320px, 1fr) 420px;
  min-height: 0;
  transition: grid-template-columns .28s ease;
}
.workspace.structure-collapsed { grid-template-columns: 0 minmax(320px, 1fr) 420px; }
.workspace.prd-collapsed { grid-template-columns: 270px minmax(320px, 1fr) 0; }
.workspace.structure-collapsed.prd-collapsed { grid-template-columns: 0 minmax(320px, 1fr) 0; }

/* ---------- 左：产品结构图 ---------- */
.structure {
  min-width: 0; overflow: hidden; background: rgba(255,255,255,.96);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.workspace.structure-collapsed .structure { border-right: none; }
.structure__head { padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.structure__head strong { display: block; font-size: 15px; }
.structure__head small { display: block; font-size: 11px; color: var(--ink-muted); margin-top: 3px; }
.structure__legend {
  padding: 9px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px;
  font-size: 10.5px; color: var(--ink-muted); border-bottom: 1px solid var(--line);
}
.structure__legend span { display: inline-flex; align-items: center; gap: 5px; }
.structure__body { flex: 1 1 auto; overflow-y: auto; padding: 10px; }
.structure__foot { padding: 10px 12px; border-top: 1px solid var(--line); font-size: 10.5px; line-height: 1.5; color: var(--ink-muted); }
.structure__foot code { font-family: var(--mono); color: var(--gb-primary-600); }
.structure-port { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 9px; overflow: hidden; }
.structure-port.is-active { border-color: rgba(79,70,229,.45); box-shadow: 0 0 0 2px rgba(79,70,229,.08); }
.structure-port__head {
  width: 100%; border: none; background: #f7f8fb; padding: 10px 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-family: inherit;
}
.structure-port.is-active .structure-port__head { background: rgba(79,70,229,.08); }
.structure-port__label { font-size: 13px; font-weight: 700; color: var(--ink); }
.structure-modules { padding: 5px 8px 8px; }
.structure-module { border-bottom: 1px solid #f0f1f5; }
.structure-module:last-child { border-bottom: none; }
.structure-module summary {
  list-style: none; cursor: pointer; display: grid; grid-template-columns: 8px 1fr auto;
  align-items: center; gap: 7px; padding: 7px 3px; font-size: 12px; color: var(--ink-soft);
}
.structure-module summary::-webkit-details-marker { display: none; }
.structure-module summary small { color: var(--ink-muted); font-size: 10px; }
.structure-module ul { margin: 0 0 7px 22px; padding: 0; list-style: none; }
.structure-module li { font-size: 11px; color: var(--ink-muted); padding: 3px 0; }
.structure-module li::before { content: "–"; margin-right: 5px; color: #c1c6d0; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #c4c8d1; }
.status-dot--pending { background: #f59e0b; }
.status-dot--planned { background: #64748b; }
.status-dot--prototype, .status-dot--prototyped { background: #2563eb; }
.status-dot--developing { background: #7c3aed; }
.status-dot--implemented { background: #16a34a; }
.status-dot--excluded { background: #cbd5e1; }
.status-chip { font-size: 9.5px; padding: 2px 6px; border-radius: 999px; background: #eef0f4; color: var(--ink-soft); }
.status-chip--pending { background: #fff7ed; color: #b45309; }
.status-chip--prototype { background: #eff6ff; color: #1d4ed8; }
.status-chip--implemented { background: #ecfdf5; color: #047857; }

/* ---------- 左：手机舞台 ---------- */
.stage {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 12px; min-height: 0; overflow: hidden; position: relative;
}
.stage.has-state-panel { padding-right: 258px; }
.prototype-state-panel {
  position: absolute; z-index: 7; top: 18px; right: 16px; bottom: 18px;
  width: 226px; overflow: hidden;
  border: 1px solid rgba(79,70,229,.2); border-radius: 16px;
  background: rgba(255,255,255,.97); box-shadow: 0 18px 45px rgba(31,36,48,.14);
  display: flex; flex-direction: column;
}
.prototype-state-panel__head {
  padding: 15px 15px 13px;
  color: #fff; background: linear-gradient(135deg,#4338ca,#7c3aed);
}
.prototype-state-panel__head--community { background: linear-gradient(135deg,#397c9f,#6d9f9a); }
.prototype-state-panel__head--shop { background: linear-gradient(135deg,#a06d55,#c08f64); }
.prototype-state-panel__head--mine { background: linear-gradient(135deg,#5452aa,#8f78c9); }
.prototype-state-panel__head > span {
  display: inline-flex; margin-bottom: 7px; padding: 2px 7px;
  border-radius: 999px; background: rgba(255,255,255,.18);
  font-size: 9px; font-weight: 700;
}
.prototype-state-panel__head strong { display: block; font-size: 15px; }
.prototype-state-panel__head small { display: block; margin-top: 4px; opacity: .76; font-size: 9.5px; line-height: 1.45; }
.prototype-state-panel__body { flex: 1; overflow-y: auto; padding: 13px; }
.state-control { display: block; margin-bottom: 14px; }
.state-control > span, .state-toggle strong { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; color: var(--ink); }
.state-control select {
  width: 100%; padding: 9px 28px 9px 9px;
  border: 1px solid var(--line); border-radius: 9px;
  color: var(--ink-soft); background: #f8f9fc; font: 10.5px var(--font);
}
.state-toggle {
  min-height: 54px; margin-bottom: 14px; padding: 10px;
  border: 1px solid var(--line); border-radius: 11px; background: #f8f9fc;
  display: grid; grid-template-columns: 1fr 39px; align-items: center; gap: 8px;
  cursor: pointer;
}
.state-toggle span { min-width: 0; }
.state-toggle strong { margin: 0; }
.state-toggle small { display: block; margin-top: 3px; color: var(--ink-muted); font-size: 9px; }
.state-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.state-toggle i {
  position: relative; width: 39px; height: 23px; border-radius: 13px;
  background: #d9dde5; transition: background .16s;
}
.state-toggle i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 19px; height: 19px;
  border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(31,36,48,.18);
  transition: transform .16s;
}
.state-toggle input:checked + i { background: #7c3aed; }
.state-toggle input:checked + i::after { transform: translateX(16px); }
.state-preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.state-preset-grid button {
  min-height: 33px; padding: 5px; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-soft); background: #fff; font: 9.5px var(--font); cursor: pointer;
}
.state-preset-grid button.is-active { color: #4338ca; border-color: #8b83e9; background: #f1efff; font-weight: 700; }
.state-reset {
  width: 100%; padding: 9px; border: 0; border-radius: 9px;
  color: #4338ca; background: #eeecff; font: 600 10.5px var(--font); cursor: pointer;
}
.stage__hint {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 8;
  white-space: nowrap; padding: 7px 11px; border-radius: 8px;
  background: rgba(30,64,175,.92); color: #fff; font-size: 11.5px;
  box-shadow: 0 8px 22px rgba(30,64,175,.25);
}
/* 缩放容器：JS 按可用高度算出 scale，宽高随缩放收缩，避免留白/裁切 */
.device-holder {
  transform-origin: top center;
  flex: 0 0 auto;
}

/* iPhone 15 Pro 风格机身：393 × 852 屏 */
.device {
  position: relative;
  width: 413px; height: 872px;
  background: #0b0d12;
  border-radius: 54px;
  padding: 10px;
  box-shadow: var(--shadow-lg), inset 0 0 0 2px #2a2d36;
  flex: 0 0 auto;
}
.device__island {
  position: absolute; top: 22px; left: 50%; transform: translateX(-50%);
  width: 120px; height: 34px; background: #000; border-radius: 20px; z-index: 5;
}
.device__statusbar {
  position: absolute; top: 20px; left: 0; right: 0; z-index: 4;
  height: 44px; padding: 0 34px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--ink);
  pointer-events: none;
}
.sb-right { display: inline-flex; align-items: center; gap: 6px; }
.sb-signal, .sb-wifi, .sb-battery { display: inline-block; }
.sb-signal { width: 17px; height: 11px;
  background: linear-gradient(90deg,#1f2430 0 60%,#c7ccd6 60% 100%);
  -webkit-mask: repeat-x left bottom/4px 100% linear-gradient(#000 0 0);
  clip-path: polygon(0 60%,20% 60%,20% 100%,0 100%,0 60%, 26% 40%,46% 40%,46% 100%,26% 100%, 52% 22%,72% 22%,72% 100%,52% 100%, 78% 2%,98% 2%,98% 100%,78% 100%); }
.sb-wifi { width: 16px; height: 12px; background: var(--ink);
  clip-path: polygon(50% 100%, 30% 62%, 70% 62%); position: relative; }
.sb-battery { width: 25px; height: 12px; border: 1.5px solid var(--ink);
  border-radius: 3px; position: relative; padding: 1.5px; }
.sb-battery::before { content:""; position:absolute; left:1.5px; top:1.5px; bottom:1.5px;
  width: 70%; background: var(--ink); border-radius: 1px; }
.sb-battery::after { content:""; position:absolute; right:-3px; top:3.5px;
  width: 2px; height: 4px; background: var(--ink); border-radius: 0 1px 1px 0; }

.device__screen {
  position: absolute;
  inset: 10px;
  width: calc(100% - 20px); height: calc(100% - 20px);
  border: none; border-radius: 44px;
  background: #fff; display: block;
}
.device__screen[hidden] { display: none; }
.device__home {
  position: absolute; bottom: 9px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: 3px;
  background: rgba(0,0,0,.28); z-index: 5;
}

/* ---------- 桌面框（后台端）1280×800 ---------- */
.desktop-holder { transform-origin: top center; flex: 0 0 auto; }
.desktop {
  width: 1280px; height: 800px;
  background: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(31,36,48,.08);
  display: flex; flex-direction: column;
}
.desktop__bar {
  flex: 0 0 auto; height: 42px; background: #e9ebf0;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
}
.desktop__dots { display: inline-flex; gap: 7px; }
.desktop__dots i { width: 12px; height: 12px; border-radius: 50%; background: #cfd3dc; display: block; }
.desktop__dots i:nth-child(1) { background: #ff5f57; }
.desktop__dots i:nth-child(2) { background: #febc2e; }
.desktop__dots i:nth-child(3) { background: #28c840; }
.desktop__url {
  flex: 0 1 auto; font-size: 12.5px; color: var(--ink-soft);
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 14px; min-width: 260px; text-align: center;
}
.desktop__bar-pad { flex: 1 1 auto; }
.desktop__screen { flex: 1 1 auto; width: 100%; border: none; background: #fff; display: block; }

/* ---------- 右：PRD 面板 ---------- */
.prd {
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-width: 0; overflow: hidden;
}
.workspace.prd-collapsed .prd { border-left: none; }

.prd__head {
  flex: 0 0 auto;
  padding: 16px 18px;
  background: linear-gradient(120deg, var(--gb-accent), var(--gb-primary));
  color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.prd__head-title { display: flex; align-items: center; gap: 10px; }
.prd__doc-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: rgba(255,255,255,.18);
  display: grid; place-items: center; font-size: 16px;
}
.prd__head-title strong { display: block; font-size: 15px; }
.prd__head-title small { display: block; font-size: 11px; opacity: .82; margin-top: 2px; }
.prd__close {
  width: 28px; height: 28px; border-radius: 8px;
  border: none; background: rgba(255,255,255,.16); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
}
.prd__close:hover { background: rgba(255,255,255,.3); }

.prd__body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px 40px; }
.prd__body::-webkit-scrollbar { width: 8px; }
.prd__body::-webkit-scrollbar-thumb { background: #d5d8e0; border-radius: 4px; }
.prd__file { padding: 9px 16px; border-bottom: 1px solid var(--line); background: #fafbfe; overflow: hidden; }
.prd__file span { display: block; font-size: 9.5px; color: var(--ink-muted); margin-bottom: 2px; }
.prd__file a { display: block; color: var(--gb-primary-600); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.prd__file a:hover { text-decoration: underline; }

/* 页面标题条 */
.prd-pagetitle {
  font-size: 18px; font-weight: 700; margin: 4px 0 14px;
  display: flex; align-items: center; gap: 8px;
}
.prd-pagetitle::before {
  content: ""; width: 4px; height: 18px; border-radius: 2px;
  background: linear-gradient(var(--gb-accent), var(--gb-primary));
}

/* 页面研发标注：只在文档面板展开时呈现 */
.prd-dev-annotations {
  margin: 0 0 16px;
  border: 1px solid #e9c978;
  border-radius: 12px;
  overflow: hidden;
  background: #fffbf1;
  box-shadow: 0 8px 24px rgba(100, 71, 19, .08);
}
.prd-dev-annotations__head {
  min-height: 48px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid #f1dfb1;
  background: linear-gradient(120deg, #fff7df, #fffaf0);
}
.prd-dev-annotations__head span { min-width: 0; }
.prd-dev-annotations__head strong { display: block; color: #583d12; font-size: 13px; }
.prd-dev-annotations__head small { display: block; margin-top: 2px; color: #987039; font-size: 10px; font-weight: 500; }
.prd-dev-annotations__head b {
  flex: 0 0 auto;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f0a629;
  color: #fff;
  font-size: 10px;
}
.prd-dev-annotations__list { max-height: 340px; overflow-y: auto; }
.prd-dev-annotations__list::-webkit-scrollbar { width: 6px; }
.prd-dev-annotations__list::-webkit-scrollbar-thumb { background: #e3d5b4; border-radius: 999px; }
.prd-dev-annotation-card {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  border: 0;
  border-top: 1px solid #f3e6c6;
  background: rgba(255, 255, 255, .7);
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.prd-dev-annotation-card:first-child { border-top: 0; }
.prd-dev-annotation-card:hover { background: #fff4d8; }
.prd-dev-annotation-card.is-active {
  background: #f2f0ff;
  box-shadow: inset 3px 0 #6b5bd2;
}
.prd-dev-annotation-card__number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #f0a629;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(120, 77, 9, .18);
}
.prd-dev-annotation-card.is-active .prd-dev-annotation-card__number { background: #6b5bd2; }
.prd-dev-annotation-card__copy { min-width: 0; }
.prd-dev-annotation-card__copy small {
  display: block;
  color: #9a6a20;
  font-size: 9px;
  font-weight: 700;
}
.prd-dev-annotation-card__copy strong {
  display: block;
  margin: 2px 0 3px;
  color: #2b2e3a;
  font-size: 12px;
}
.prd-dev-annotation-card__copy p {
  margin: 0;
  color: #666b78;
  font-size: 10.5px;
  line-height: 1.5;
}

/* 研发标注圆点绘制在工作台最外层，避免被原型 iframe 的层级或重绘覆盖 */
.workbench-dev-annotation-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  pointer-events: none;
}
.workbench-dev-annotation-marker {
  position: absolute;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #f0a629;
  color: #fff;
  box-shadow: 0 4px 12px rgba(105, 68, 15, .4);
  display: grid;
  place-items: center;
  font: 800 11px/1 -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  pointer-events: auto;
  cursor: pointer;
  transition: transform .16s, background .16s, box-shadow .16s;
}
.workbench-dev-annotation-marker:hover,
.workbench-dev-annotation-marker.is-active {
  transform: scale(1.16);
  background: #6b5bd2;
  box-shadow: 0 0 0 4px rgba(107, 91, 210, .2), 0 6px 15px rgba(52, 42, 117, .3);
}
.workbench-dev-annotation-marker[hidden] { display: none !important; }

/* 元信息卡片 */
.prd-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
  background: var(--line);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  margin-bottom: 18px;
}
.prd-meta__cell { background: var(--surface); padding: 9px 12px; }
.prd-meta__k { font-size: 11px; color: var(--ink-muted); margin-bottom: 3px; }
.prd-meta__v { font-size: 13px; color: var(--ink); font-weight: 600; }
.prd-meta__v.is-date { color: #dc2626; }
.prd-meta__v.is-status { color: var(--gb-primary-600); }

/* 分区块 */
.prd-section { margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.prd-section__head {
  width: 100%; border: none; font-family: inherit; text-align: left;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 13px; cursor: pointer;
  background: #f7f8fb; font-size: 13px; font-weight: 700; color: var(--ink);
  user-select: none;
}
.prd-section__head:hover { background: #f1f2f7; }
.prd-section__tag {
  font-size: 10px; font-weight: 700; color: #fff;
  background: var(--gb-accent); padding: 2px 7px; border-radius: 5px;
}
.prd-section__chev { margin-left: auto; color: var(--ink-muted); transition: transform .2s; }
.prd-section.is-collapsed .prd-section__chev { transform: rotate(-90deg); }
.prd-section__body { padding: 12px 13px; font-size: 13px; line-height: 1.7; color: var(--ink-soft); }
.prd-section.is-collapsed .prd-section__body { display: none; }

/* 正文元素 */
.prd-section__body p { margin: 0 0 8px; }
.prd-section__body ul { margin: 4px 0 8px; padding-left: 18px; }
.prd-section__body li { margin-bottom: 5px; }
.prd-section__body strong { color: var(--ink); }
.prd-section__body code {
  font-family: var(--mono); font-size: 12px;
  background: #f0f1f5; padding: 1px 5px; border-radius: 4px; color: var(--gb-primary-600);
}

/* 提示框 */
.prd-callout {
  border-radius: 8px; padding: 9px 11px; margin: 8px 0;
  font-size: 12.5px; line-height: 1.6; border: 1px solid;
}
.prd-callout--warn { background: #fff7ed; border-color: #fdba74; color: #9a3412; }
.prd-callout--info { background: #eff6ff; border-color: #93c5fd; color: #1e40af; }
.prd-callout--rule { background: #f5f3ff; border-color: #c4b5fd; color: #5b21b6; }

/* 表格 */
.prd-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 6px 0; }
.prd-table th, .prd-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.prd-table th { background: #f7f8fb; font-weight: 700; color: var(--ink); white-space: nowrap; }
.prd-table td { color: var(--ink-soft); }
.prd-table .yes { color: #16a34a; font-weight: 700; }
.prd-table .no { color: #dc2626; font-weight: 700; }
.prd-copy-table td:first-child { width: 92px; white-space: nowrap; font-weight: 600; color: var(--ink); }
.prd-copy-table td:last-child { word-break: break-word; }

/* ---------- 保存反馈 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 100; transform: translate(-50%, 18px);
  max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px;
  background: #1f2937; color: #fff; font-size: 13px; box-shadow: 0 14px 34px rgba(15,23,42,.25);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.toast--success { background: #166534; }
.toast--warn { background: #92400e; }
.toast--error { background: #b91c1c; }

/* ---------- 客户会议标注 ---------- */
.annotation-mask {
  position: fixed; inset: 0; z-index: 70; border: 0;
  background: rgba(24, 28, 39, .28); backdrop-filter: blur(1px);
}
.annotation-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80;
  width: min(430px, 94vw); background: #fff; border-left: 1px solid var(--line);
  box-shadow: -20px 0 55px rgba(31, 36, 48, .18);
  display: flex; flex-direction: column;
  transform: translateX(102%); transition: transform .22s ease;
}
.annotation-drawer.is-open { transform: translateX(0); }
.annotation-drawer__head {
  min-height: 72px; padding: 15px 18px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(135deg, #fff9e9, #fff);
}
.annotation-drawer__head strong { display: block; font-size: 15px; }
.annotation-drawer__head small { display: block; margin-top: 4px; color: var(--ink-muted); font-size: 11px; }
.annotation-drawer__tools { display: flex; align-items: center; gap: 7px; }
.annotation-drawer__head button {
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink-soft); font-size: 18px; cursor: pointer;
}
.annotation-drawer__head .annotation-export {
  width: auto; padding: 0 10px; color: #80591f; font-size: 10.5px; font-weight: 700;
}
.annotation-storage {
  padding: 7px 14px; border-bottom: 1px solid var(--line);
  background: #f3f8f5; color: #24724e; font-size: 10px; line-height: 1.4;
}
.annotation-storage.is-checking { background: #f5f6f8; color: var(--ink-muted); }
.annotation-storage.is-browser { background: #fff8e8; color: #8a5b18; }
.annotation-storage.is-error { background: #fff1f0; color: #b33d36; }
.annotation-tabs { padding: 10px 14px; display: flex; gap: 6px; border-bottom: 1px solid var(--line); }
.annotation-tabs button {
  flex: 1; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink-muted); font: 12px var(--font); cursor: pointer;
}
.annotation-tabs button.is-active { border-color: #e6b75d; background: #fff8e6; color: #8a5b18; font-weight: 700; }
.annotation-list { flex: 1 1 auto; overflow-y: auto; padding: 13px 14px; background: #f7f8fb; }
.annotation-empty { padding: 48px 20px; text-align: center; color: var(--ink-muted); font-size: 12px; }
.annotation-card { padding: 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 5px 16px rgba(31,36,48,.04); }
.annotation-card + .annotation-card { margin-top: 10px; }
.annotation-card__meta { display: flex; align-items: center; gap: 7px; }
.annotation-card__status { padding: 3px 7px; border-radius: 999px; background: #fff2d7; color: #9b641c; font-size: 9px; font-weight: 800; }
.annotation-card.is-confirmed .annotation-card__status { background: #eaf6ef; color: #18764b; }
.annotation-card__page { margin-left: auto; color: var(--ink-muted); font-size: 10px; }
.annotation-card h3 { margin: 9px 0 0; font-size: 13px; }
.annotation-card p { margin: 6px 0 0; color: var(--ink-soft); font-size: 11.5px; line-height: 1.55; white-space: pre-wrap; }
.annotation-card__conclusion { margin-top: 8px; padding: 8px; border-radius: 8px; background: #f0f8f4; color: #276246; font-size: 11px; line-height: 1.5; }
.annotation-card textarea {
  width: 100%; min-height: 58px; margin-top: 9px; padding: 8px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px; outline: none; font: 11px/1.45 var(--font);
}
.annotation-card textarea:focus { border-color: #e4b85f; box-shadow: 0 0 0 3px rgba(228,184,95,.15); }
.annotation-card__actions { margin-top: 9px; display: flex; gap: 6px; }
.annotation-card__actions button {
  padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink-soft); font: 10.5px var(--font); cursor: pointer;
}
.annotation-card__actions .is-primary { margin-left: auto; border-color: #dba84c; background: #fff7e4; color: #885814; font-weight: 700; }
.annotation-form { flex: 0 0 auto; padding: 13px 14px 16px; border-top: 1px solid var(--line); background: #fff; }
.annotation-form strong { display: block; margin-bottom: 8px; font-size: 12px; }
.annotation-form input,.annotation-form textarea {
  width: 100%; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px;
  outline: none; font: 11px/1.45 var(--font);
}
.annotation-form textarea { min-height: 58px; margin-top: 7px; resize: vertical; }
.annotation-form input:focus,.annotation-form textarea:focus { border-color: #e0b056; box-shadow: 0 0 0 3px rgba(224,176,86,.14); }
.annotation-form button {
  width: 100%; margin-top: 8px; padding: 9px; border: 0; border-radius: 8px;
  background: #97671f; color: #fff; font: 700 11px var(--font); cursor: pointer;
}

/* 空文档占位 */
.prd-empty { text-align: center; color: var(--ink-muted); padding: 40px 20px; font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 230px minmax(300px, 1fr) 360px; }
  .workspace.structure-collapsed { grid-template-columns: 0 minmax(300px, 1fr) 360px; }
  .workspace.prd-collapsed { grid-template-columns: 230px minmax(300px, 1fr) 0; }
  .topbar__title small, .topbar__status { display: none; }
  .seg__btn { padding-left: 9px; padding-right: 9px; }
  .stage.has-state-panel { padding-right: 220px; }
  .prototype-state-panel { width: 192px; right: 10px; }
}
@media (max-width: 860px) {
  .topbar { overflow-x: auto; }
  .topbar__brand { display: none; }
  .workspace, .workspace.structure-collapsed, .workspace.prd-collapsed, .workspace.structure-collapsed.prd-collapsed {
    grid-template-columns: 1fr; grid-template-rows: auto minmax(420px, 1fr) auto;
  }
  .structure { max-height: 34vh; border-right: none; border-bottom: 1px solid var(--line); }
  .workspace.structure-collapsed .structure { display: none; }
  .prd { border-left: none; border-top: 1px solid var(--line); max-height: 45vh; }
  .workspace.prd-collapsed .prd { display: none; }
  .stage.has-state-panel { padding-right: 20px; padding-bottom: 210px; }
  .prototype-state-panel { top: auto; left: 16px; right: 16px; bottom: 10px; width: auto; max-height: 188px; }
  .prototype-state-panel__head { padding: 10px 13px; }
  .prototype-state-panel__body { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 10px; }
  .state-control, .state-toggle { margin: 0; }
  .state-reset { display: none; }
}
/* 手机访问：进入纯原型体验，不展示工作台控制与设备外框 */
@media (max-width: 767px) {
  html,
  body {
    width: 100%;
    height: 100%;
    height: 100dvh;
    overflow: hidden;
    background: #fff;
  }
  body { background-image: none; }
  .topbar,
  .structure,
  .prd,
  .prototype-state-panel,
  .annotation-mask,
  .annotation-drawer,
  .toast {
    display: none !important;
  }
  .workspace,
  .workspace.structure-collapsed,
  .workspace.prd-collapsed,
  .workspace.structure-collapsed.prd-collapsed {
    width: 100%;
    height: 100%;
    height: 100dvh;
    min-height: 0;
    display: block;
  }
  .stage,
  .stage.has-state-panel {
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
    display: block;
  }
  .device-holder {
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    margin: 0 !important;
    transform: none !important;
  }
  .device {
    width: 100%;
    height: 100%;
    height: 100dvh;
    padding: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .device__screen {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
  }
  .device__island,
  .device__statusbar,
  .device__home {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .topbar, .nav-select__caret, .nav-select__opt, .prd-section__chev { transition: none !important; }
}
