:root {
  font:
    13px "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  color: #263b4c;
  background: #eef2f6;
  --accent: #087e91;
  --line: #dce3e9;
  --tree: 232px;
  --properties: 340px;
  --dock: 210px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 7px 10px;
  color: #344c60;
}
button:hover {
  background: #e9f5f8;
  border-color: #95c5ce;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.hidden {
  display: none !important;
}
a {
  color: var(--accent);
  text-decoration: none;
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font-size: 15px;
  font-weight: 600;
}
h2 {
  font-size: 14px;
}
p {
  line-height: 1.65;
}
small,
.muted {
  color: #8797a3;
  font-size: 11px;
}
.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #08a79e, #397bd7);
  color: white;
  border-radius: 9px;
  font-weight: 800;
  flex-shrink: 0;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #173d55;
  font-size: 13px;
  font-weight: 700;
  min-width: 244px;
}
.brand small {
  display: block;
  font-weight: 400;
  margin-top: 2px;
}
.app-header {
  height: 60px;
  background: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.document-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.document-title span {
  font-size: 11px;
  color: #8797a3;
}
#user {
  font-size: 11px;
  color: #8297a8;
}
.app-header > button {
  border: 0;
}
.ribbon {
  height: 48px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 6px 16px;
  background: #f9fbfd;
  border-bottom: 1px solid var(--line);
}
.tool-group {
  display: flex;
  gap: 6px;
  padding-right: 14px;
  border-right: 1px solid var(--line);
}
.ribbon-status {
  flex: 1;
  color: #708593;
  font-size: 12px;
}
.ribbon > a {
  font-size: 11px;
}
.workbench {
  display: grid;
  grid-template-columns: var(--tree) 5px minmax(300px, 1fr) 5px var(
      --properties
    );
  height: calc(100vh - 134px);
  min-height: 540px;
  overflow: hidden;
}
.tree-panel,
.properties {
  background: #fff;
  min-width: 0;
  overflow: auto;
}
.tree-panel {
  display: flex;
  flex-direction: column;
}
.panel-heading {
  height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 14px;
  font-weight: 600;
  background: #f9fbfd;
}
.panel-heading button {
  border: 0;
  background: transparent;
  padding: 2px 5px;
}
.side-title {
  font-size: 10px;
  letter-spacing: 1px;
  color: #8497a6;
  padding: 20px 16px 7px;
}
#case-list {
  max-height: 160px;
  overflow: auto;
  padding: 0 7px;
}
#case-list > p {
  padding: 8px;
}
#case-list button,
nav button,
.tree-action {
  width: 100%;
  border: 0;
  text-align: left;
  background: transparent;
  padding: 10px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#case-list button.selected,
nav button.selected {
  background: #e4f2f6;
  color: #00788d;
  font-weight: 600;
}
nav {
  padding: 0 7px;
}
nav button {
  position: relative;
  padding-left: 32px;
  margin: 1px 0;
}
nav button:before {
  content: "◇";
  position: absolute;
  left: 12px;
  color: #7395aa;
}
.tree-action {
  width: calc(100% - 14px);
  margin: 0 7px;
}
.tree-foot {
  margin: auto 16px 16px;
  padding-top: 24px;
  font-size: 11px;
  color: #648292;
}
.tree-foot small {
  display: block;
  margin-top: 5px;
}
.tree-foot i {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #1dada4;
  border-radius: 50%;
  margin-right: 6px;
}
.splitter {
  background: #edf1f5;
  touch-action: none;
}
.splitter:hover,
.splitter:focus {
  background: #8ac4d0;
  outline: none;
}
.vertical {
  cursor: col-resize;
}
.horizontal {
  cursor: row-resize;
  height: 5px;
}
.center {
  min-width: 0;
  display: grid;
  grid-template-rows: 39px minmax(200px, 1fr) 5px var(--dock);
  overflow: hidden;
}
.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding-right: 8px;
  gap: 8px;
}
.view-tabs {
  display: flex;
  height: 100%;
  flex-shrink: 0;
}
.view-tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 12px;
}
.view-tabs button.selected {
  color: #087e91;
  border-bottom: 2px solid #087e91;
  background: #f0f9fa;
}
.view-tools {
  display: flex;
  gap: 3px;
}
.view-tools button {
  border: 0;
  background: transparent;
  padding: 5px;
  font-size: 11px;
  white-space: nowrap;
}
.view-tools button[aria-pressed="true"] {
  background: #d8edf3;
  color: #006c83;
}
.view-toolbar select {
  width: 105px;
  padding: 3px;
  margin: 0;
  font-size: 11px;
}
.viewport {
  position: relative;
  overflow: hidden;
  background: radial-gradient(ellipse at 55% 45%, #fff 0, #edf3f8 75%);
}
.viewport > canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.viewport-label {
  position: absolute;
  top: 20px;
  left: 22px;
  pointer-events: none;
  display: grid;
  gap: 5px;
}
.viewport-label strong {
  font-size: 12px;
  color: #3d677b;
}
.viewport-label span {
  font-size: 10px;
  color: #839aa9;
}
.viewport-bottom {
  position: absolute;
  bottom: 12px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #7e94a6;
  pointer-events: none;
}
.dock {
  min-height: 0;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.dock-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--line);
  height: 34px;
  flex-shrink: 0;
  gap: 5px;
}
.dock-tabs button {
  border: 0;
  border-radius: 0;
  font-size: 11px;
  height: 100%;
  background: transparent;
}
.dock-tabs button.selected {
  color: #087e91;
  border-bottom: 2px solid #087e91;
  font-weight: 600;
}
.dock-tabs span {
  margin-left: auto;
  font-size: 10px;
  max-width: 40%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  padding-right: 12px;
  color: #7f94a5;
}
.dock-content {
  padding: 8px 12px;
  overflow: auto;
  min-height: 0;
  flex: 1;
}
.progress {
  height: 2px;
  background: #edf2f5;
  flex-shrink: 0;
}
#progress-fill {
  height: 100%;
  background: #05a696;
  width: 0;
  transition: width 0.3s;
}
.dock pre {
  margin: 0;
  max-height: none;
  font-size: 11px;
  color: #587084;
}
.monitor-title {
  display: flex;
  gap: 15px;
  align-items: center;
}
.monitor-title select {
  padding: 3px;
  width: auto;
  margin: 0;
  font-size: 11px;
}
.monitor-title span {
  font-size: 10px;
  color: #8b9aa5;
}
#monitor-canvas {
  height: calc(100% - 25px);
  min-height: 90px;
  width: 100%;
}
.property-body {
  padding: 18px 15px;
}
.panel-title {
  margin-bottom: 20px;
}
.panel-title p {
  color: #8a9ba7;
  font-size: 10px;
  margin-top: 7px;
}
.badge {
  font-size: 9px;
  font-weight: 400;
  color: #6892a6;
  background: #edf6f9;
  border-radius: 3px;
  padding: 3px 5px;
}
label {
  display: grid;
  gap: 7px;
  font-size: 12px;
  color: #4e6577;
  margin-bottom: 17px;
}
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #d3dfe7;
  border-radius: 4px;
  background: #fcfdff;
  color: #2d4659;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #d3edf1;
  border-color: #45a8b3;
}
input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #087e91;
}
textarea {
  height: 240px;
  font:
    11px/1.7 Consolas,
    monospace;
  resize: vertical;
}
.field-help {
  font:
    9px Consolas,
    monospace;
  color: #9cabb5;
  overflow-wrap: anywhere;
}
.toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  padding: 8px 0;
}
.full {
  width: 100%;
}
details {
  border-top: 1px solid var(--line);
  padding: 13px 0;
  margin-top: 14px;
}
summary {
  cursor: pointer;
  font-size: 11px;
  color: #617c90;
}
summary .badge {
  float: right;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font:
    11px/1.7 Consolas,
    monospace;
  max-height: 300px;
  overflow: auto;
}
.stat {
  padding: 11px 0;
  border-bottom: 1px solid #edf2f6;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.stat span {
  font-size: 11px;
  color: #7d919f;
}
.stat strong {
  font-size: 12px;
  max-width: 60%;
  text-align: right;
}
.scope {
  font-size: 10px;
  background: #f4f8fb;
  color: #7f95a4;
  padding: 10px;
  margin: 12px 0;
}
.message {
  position: fixed;
  bottom: 32px;
  left: calc(var(--tree) + 20px);
  max-width: min(650px, 65vw);
  padding: 10px 16px;
  border: 1px solid #c1e4dd;
  border-radius: 6px;
  background: #eefaf6;
  color: #357967;
  z-index: 8;
  box-shadow: 0 3px 16px #244b6010;
  font-size: 12px;
  cursor: pointer;
}
.message.error {
  color: #ac463c;
  background: #fff4f0;
  border-color: #edc9c0;
}
.file-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid #eef2f5;
}
.file-row span {
  font-size: 11px;
  overflow-wrap: anywhere;
}
.file-row button {
  padding: 3px 6px;
  font-size: 10px;
}
#catalog-count {
  font-size: 11px;
  color: #7c909f;
  margin-bottom: 12px;
}
#catalog-search,
#catalog-kind {
  margin-bottom: 8px;
}
.catalog-row {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.catalog-row code {
  color: #087e91;
  font-size: 11px;
  overflow-wrap: anywhere;
}
.catalog-row p {
  font-size: 10px;
  overflow-wrap: anywhere;
  color: #8a9aa7;
}
footer {
  height: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 14px;
  border-top: 1px solid var(--line);
  background: #f7f9fb;
  color: #7c92a3;
  font-size: 10px;
}
.login {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(at 20% 20%, #def6f1, transparent 50%), #f2f6fb;
  z-index: 20;
}
.login form {
  background: white;
  border: 1px solid #dce8ed;
  border-radius: 18px;
  padding: 40px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 90px #295d7610;
}
.login h1 {
  font-size: 23px;
  margin: 22px 0 8px;
}
.login p {
  color: #8093a2;
  font-size: 13px;
  margin-bottom: 24px;
}
.login button {
  width: 100%;
  margin-bottom: 18px;
}
.login #login-error {
  color: #b04335;
}
.login a {
  font-size: 12px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
  width: min(420px, 90vw);
  box-shadow: 0 20px 100px #203d5040;
  color: #294758;
}
dialog::backdrop {
  background: #203e5040;
}
dialog p {
  margin: 20px 0;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
@media (max-width: 1250px) {
  :root {
    --tree: 190px;
    --properties: 285px;
  }
  .view-tools button {
    font-size: 10px;
    padding: 3px;
  }
  .view-toolbar {
    flex-wrap: wrap;
    height: auto;
    min-height: 39px;
  }
  .center {
    grid-template-rows: minmax(39px, auto) minmax(200px, 1fr) 5px var(--dock);
  }
  .brand {
    min-width: 190px;
  }
  .ribbon {
    gap: 5px;
  }
  .ribbon > a {
    display: none;
  }
}
@media (max-width: 850px) {
  .workbench {
    grid-template-columns: 155px 4px minmax(220px, 1fr) 4px 245px;
    overflow-x: auto;
  }
  .document-title {
    display: block;
  }
  .document-title span {
    font-size: 9px;
  }
  .ribbon {
    overflow-x: auto;
    white-space: nowrap;
  }
  .ribbon-status,
  #user,
  #reset-layout {
    display: none;
  }
  .brand {
    min-width: 160px;
    font-size: 11px;
  }
  .app-header {
    padding: 0 12px;
    gap: 10px;
  }
  footer span:nth-child(2) {
    display: none;
  }
  .view-tools {
    flex-wrap: wrap;
  }
}
/* 紧凑工作台：解释按需展开，常用区域优先展示操作。 */
#case-select {
  max-width: 240px;
  min-width: 180px;
  background: #f3f8fc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px;
}
#groups .side-title {
  font-size: 12px;
  color: #26536c;
  font-weight: 700;
  margin: 12px 12px 4px;
}
#groups button {
  padding: 6px 18px;
}
#groups button::before {
  display: none;
}
#group-subtitle:empty {
  display: none;
}
#stage-extra {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
#stage-extra label {
  display: block;
  margin: 8px 0;
  overflow-wrap: anywhere;
}
#stage-extra input {
  width: 100%;
}
#post-canvas {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  touch-action: none;
}
.ai-panel {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px 12px;
  overflow: hidden !important;
}
#ai-reply {
  flex: 1;
  min-height: 20px;
  overflow: auto;
  line-height: 1.6;
}
#ai-reply p {
  white-space: pre-wrap;
}
#ai-reply td {
  max-width: 240px;
  word-break: break-word;
  white-space: pre-wrap;
}
#ai-reply table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
#ai-reply td,
#ai-reply th {
  text-align: left;
  padding: 4px 7px;
  border-bottom: 1px solid var(--line);
}
.ai-question {
  font-weight: 600;
  color: #265c8b;
}
.ai-error {
  color: #b53636;
}
.ai-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ai-actions span {
  margin-right: auto;
  font-size: 11px;
  color: #4b6679;
}
.ai-actions button {
  padding: 4px 8px;
}
#ai-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
#ai-input {
  flex: 1;
  resize: none;
  min-height: 42px;
  max-height: 70px;
  border: 1px solid #a8cbdc;
  border-radius: 7px;
  padding: 8px;
}
#ai-send {
  min-width: 64px;
}
#scene-info:empty {
  display: none;
}
@media (max-width: 1000px) {
  #case-select {
    min-width: 120px;
    max-width: 160px;
  }
  .document-title {
    display: none;
  }
}

[hidden] {
  display: none !important;
}

/* 欧拉网格按方向排列，窄属性区保留三列完整输入。 */
.euler-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 8px 0 12px;
}
.euler-table th {
  text-align: left;
  font-size: 12px;
  padding: 5px 2px;
}
.euler-table th:first-child {
  width: 30px;
}
.euler-table td {
  padding: 3px 2px;
}
.euler-table input {
  width: 100%;
  min-width: 0;
  padding: 7px 4px;
  box-sizing: border-box;
}
.grid-section-title {
  font-weight: 650;
  margin: 8px 0;
}
.grid-metrics {
  font-size: 12px;
  line-height: 1.8;
  padding: 8px;
  background: #eef8fa;
  border-radius: 6px;
  margin-bottom: 12px;
}
.grid-fixed {
  font-size: 12px;
  margin: 8px 0;
}
.grid-status:empty {
  display: none;
}
.grid-status {
  color: #9a5a00;
  font-size: 12px;
}
#launcher {
  height: 100vh;
  overflow: auto;
  background: linear-gradient(150deg, #e6f7fa, #f6f9ff 52%, #f0f5fb);
}
.launcher-header {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 22px 6%;
  background: #ffffffc9;
  border-bottom: 1px solid #dce8ee;
}
.launcher-header h1 {
  font-size: 20px;
  margin: 0;
}
.launcher-header a {
  margin-left: auto;
}
.launcher-content {
  max-width: 1180px;
  margin: 36px auto;
  padding: 0 24px;
}
.launcher-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.launcher-title h2 {
  font-size: 28px;
  margin: 0;
}
.launcher-title p {
  margin: 8px 0 24px;
  color: #506776;
}
#case-search {
  width: min(360px, 100%);
  margin-bottom: 18px;
}
.case-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 18px;
  margin: 12px 0 28px;
}
.case-card {
  padding: 22px;
  background: white;
  border: 1px solid #dae8ec;
  border-radius: 14px;
  box-shadow: 0 5px 20px #17384e09;
}
.case-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.case-card p {
  font-size: 12px;
  color: #55717d;
}
.case-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}
#create-case-form {
  padding: 24px;
  max-width: 440px;
  background: white;
  border: 1px solid #b9dce5;
  border-radius: 12px;
  margin: 20px 0;
}
#launcher-error {
  color: #a44026;
}
#launcher-error:empty {
  display: none;
}
