/* Mathematica 12 网页复刻 · 对话框（dialog.css）
 * 真机：白底、1px 灰边框、标题栏浅灰、按钮右下对齐（对齐真机 dialog 观感）。
 */

.dialog-layer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-layer[hidden] { display: none; }

.dialog {
  min-width: 360px;
  max-width: 720px;
  max-height: 80vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #9a9a9a;
  box-shadow: 4px 4px 18px rgba(0, 0, 0, 0.22);
  font: 12px/1.5 var(--ui-font);
  color: #1a1a1a;
}

.dialog-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 8px;
  background: #f0f0f0;
  border-bottom: 1px solid #d8d8d8;
  font-weight: 600;
}
.dialog-close {
  width: 22px;
  height: 20px;
  border: 0;
  background: transparent;
  font: 13px/1 var(--ui-font);
  color: #333;
  cursor: pointer;
}
.dialog-close:hover { background: #e81123; color: #fff; }

.dialog-body { padding: 12px 16px; }
.dialog-body p { margin: 4px 0; }
.dialog-body code { font-family: var(--mono); font-size: 12px; }

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 16px 14px 16px;
}

.dialog-btn {
  min-width: 72px;
  height: 24px;
  padding: 0 12px;
  border: 1px solid #a8a8a8;
  border-radius: 3px;
  background: #f5f5f5;
  font: 12px/1 var(--ui-font);
  color: #1a1a1a;
  cursor: pointer;
}
.dialog-btn:hover { background: #e9f2fb; border-color: #7aa9d6; }
.dialog-btn.primary { border-color: #5f95c8; background: #dfeefb; }

/* 对话框内控件（调色板 / 查找 / 参考表） */
.dialog-input {
  height: 23px;
  padding: 0 6px;
  border: 1px solid #b0b0b0;
  background: #ffffff;
  font: 12px/1 var(--ui-font);
  color: #1a1a1a;
}

.palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 4px 0;
}
.palette-btn {
  min-width: 66px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid #b8b8b8;
  border-radius: 3px;
  background: #f7f7f7;
  font: 12px/1 var(--ui-font);
  color: #1a1a1a;
  cursor: pointer;
}
.palette-btn:hover { background: #e8f1fa; border-color: #7aa9d6; }
.palette-btn-char { font: 16px/1 var(--cell-font); min-width: 40px; }
.palette-swatch {
  width: 34px;
  height: 26px;
  border: 1px solid #9a9a9a;
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
}

.reference-table {
  width: 100%;
  border-collapse: collapse;
  margin: 6px 0;
}
.reference-table th,
.reference-table td {
  border: 1px solid #dcdcdc;
  padding: 3px 8px;
  text-align: left;
  vertical-align: top;
  font-size: 12px;
}
.reference-table th { background: #f2f2f2; }

.demo-list { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; }
.demo-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 8px;
  border: 1px solid #dcdcdc;
  border-radius: 3px;
  background: #fafafa;
  font: 12px/1.4 var(--ui-font);
  color: #1a1a1a;
  cursor: pointer;
  text-align: left;
}
.demo-item:hover { background: #e8f1fa; border-color: #7aa9d6; }
.demo-item code { font-family: var(--mono); font-size: 12px; }
.demo-item span { color: #666666; font-size: 12px; }

/* HLP-03：自写文档中心 / 示例库 / 快速入门教程 */
.example-cat-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.example-cat {
  border: 1px solid #dcdcdc;
  border-radius: 3px;
  background: #fafafa;
  font: 12px/1.3 var(--ui-font);
  color: #1a1a1a;
  cursor: pointer;
  padding: 3px 8px;
}
.example-cat[data-active="true"], .example-cat:hover { background: #e8f1fa; border-color: #7aa9d6; }
.example-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0; max-height: 520px; overflow: auto; }
.example-item { border: 1px solid #e0e0e0; border-radius: 3px; background: #fcfcfc; padding: 5px 8px; }
.example-title { font-weight: 600; font-size: 12px; margin-bottom: 1px; }
.example-expr { display: block; font-family: var(--mono); font-size: 12px; color: #1a1a1a; }
.example-expected { font-size: 12px; color: #333333; white-space: pre-wrap; }
.example-note { font-size: 11px; color: #666666; margin-top: 1px; }
.example-residual {
  display: inline-block;
  margin-top: 2px;
  padding: 0 4px;
  border: 1px solid #d8a24a;
  border-radius: 2px;
  background: #fff8e8;
  color: #8a5a00;
  font-size: 11px;
}
.example-actions { display: flex; gap: 6px; margin-top: 4px; }
.example-action {
  border: 1px solid #c8c8c8;
  border-radius: 2px;
  background: #fdfdfd;
  color: #1a1a1a;
  font: 11px/1.2 var(--ui-font);
  padding: 2px 8px;
  cursor: pointer;
}
.example-action:hover { background: #e8eef7; }
.tutorial-step { border-top: 1px dashed #dcdcdc; padding-top: 5px; margin-top: 6px; }
.tutorial-step p { margin: 2px 0; font-size: 12px; }

.welcome-box { display: flex; gap: 18px; }
.welcome-left h2 { margin: 4px 0; font: 700 18px/1.2 var(--ui-font); color: #b02020; }
.welcome-right { flex: 1 1 auto; }
.welcome-right p { margin: 6px 0; }