/* 本地网页编辑器：只有 editor_server.py 可用时才会显示工具栏。 */
.home-shortcuts.has-custom-layout {
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.home-shortcuts.has-custom-layout .desktop-folder {
  position: absolute;
  pointer-events: auto;
}

.site-editor-toolbar,
.site-editor-panel,
.site-editor-toast {
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
}

.site-editor-toolbar {
  position: fixed;
  z-index: 30000;
  top: 14px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  max-width: calc(100vw - 24px);
  padding: 7px;
  border: 1px solid rgba(45, 127, 184, 0.28);
  border-radius: 13px;
  background: rgba(255, 253, 251, 0.96);
  box-shadow: 0 12px 34px rgba(36, 56, 67, 0.16);
  transform: translateX(-50%);
  backdrop-filter: blur(12px);
}

.site-editor-toolbar button,
.site-editor-panel button,
.site-editor-panel input,
.site-editor-panel select,
.site-editor-panel textarea {
  font: inherit;
}

.site-editor-toolbar button,
.site-editor-panel button {
  border: 1px solid #d9e7f2;
  border-radius: 8px;
  color: #243843;
  background: #fffdfb;
  cursor: pointer;
}

.site-editor-toolbar button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  white-space: nowrap;
}

.site-editor-toolbar button:hover,
.site-editor-panel button:hover {
  border-color: #2d7fb8;
  background: #f3f8fd;
}

.site-editor-toolbar button:disabled,
.site-editor-panel button:disabled {
  border-color: #d9e7f2;
  color: #9aabb6;
  background: #f5f7f8;
  cursor: not-allowed;
  opacity: 0.72;
}

.site-editor-toolbar .site-editor-save {
  border-color: #2d7fb8;
  color: #fff;
  background: #2d7fb8;
}

.site-editor-toolbar .site-editor-save:hover {
  color: #fff;
  background: #246d9f;
}

.site-editor-toolbar .site-editor-save.is-dirty::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #ffcf65;
  content: "";
  vertical-align: 1px;
}

.site-editor-mode-label {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 7px;
  color: #4c6270;
  font-size: 12px;
  white-space: nowrap;
}

.site-editor-mode-label::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff7f6a;
  box-shadow: 0 0 0 3px rgba(255, 127, 106, 0.16);
  content: "";
}

.site-editor-preview .site-editor-mode-label::before {
  background: #9fb1bd;
  box-shadow: none;
}

.site-editor-panel {
  position: fixed;
  z-index: 29990;
  top: 68px;
  right: 14px;
  bottom: 14px;
  display: flex;
  width: min(430px, calc(100vw - 28px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(45, 127, 184, 0.28);
  border-radius: 16px;
  color: #243843;
  background: rgba(255, 253, 251, 0.985);
  box-shadow: 0 20px 60px rgba(36, 56, 67, 0.2);
}

.site-editor-panel[hidden] {
  display: none;
}

.site-editor-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 12px;
  border-bottom: 1px solid #d9e7f2;
}

.site-editor-panel-header h2 {
  margin: 0;
  color: #2d7fb8;
  font-size: 17px;
}

.site-editor-panel-header button {
  width: 31px;
  height: 31px;
  padding: 0;
}

.site-editor-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  border-bottom: 1px solid #d9e7f2;
}

.site-editor-tabs button {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #4c6270;
  font-size: 12px;
}

.site-editor-tabs button.is-active {
  border-color: #2d7fb8;
  color: #2d7fb8;
  background: #eaf4ff;
}

.site-editor-panel-body {
  flex: 1 1 auto;
  padding: 14px 16px 28px;
  overflow-y: auto;
}

.site-editor-section[hidden] {
  display: none;
}

.site-editor-section h3,
.site-editor-property h3 {
  margin: 0 0 10px;
  color: #2d7fb8;
  font-size: 14px;
}

.site-editor-subheading {
  margin: 18px 0 10px;
  color: #243843;
  font-size: 13px;
  font-weight: 650;
}

.site-editor-help,
.site-editor-muted {
  color: #4c6270;
  font-size: 12px;
  line-height: 1.65;
}

.site-editor-property {
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid #d9e7f2;
  border-radius: 10px;
  background: #f7fbff;
}

.site-editor-property-name {
  margin: 0 0 10px;
  overflow: hidden;
  color: #4c6270;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-editor-font-row,
.site-editor-inline-row,
.site-editor-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-editor-font-row input {
  width: 84px;
}

.site-editor-section label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  color: #4c6270;
  font-size: 12px;
}

.site-editor-section input,
.site-editor-section select,
.site-editor-section textarea,
.site-editor-property input {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid #c9dce9;
  border-radius: 7px;
  color: #243843;
  background: #fff;
}

.site-editor-section textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.55;
}

.site-editor-section textarea.site-editor-markdown-source {
  min-height: 45vh;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  tab-size: 2;
}

.site-editor-section input:focus,
.site-editor-section select:focus,
.site-editor-section textarea:focus,
.site-editor-property input:focus {
  border-color: #2d7fb8;
  outline: 2px solid rgba(45, 127, 184, 0.14);
}

.site-editor-list {
  display: grid;
  gap: 9px;
  margin-bottom: 14px;
}

.site-editor-card {
  padding: 11px;
  border: 1px solid #d9e7f2;
  border-radius: 10px;
  background: #fff;
}

.site-editor-card summary {
  color: #2d7fb8;
  font-size: 13px;
  cursor: pointer;
}

.site-editor-card details[open] summary {
  margin-bottom: 10px;
}

.site-editor-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
}

.site-editor-card-title strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-editor-card-meta {
  margin: 0;
  overflow: hidden;
  color: #637985;
  font-family: Consolas, "Courier New", monospace;
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-editor-edge-card {
  border-left: 3px solid rgba(45, 127, 184, 0.28);
}

.site-editor-image-editor {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #e3edf4;
}

.site-editor-image-editor > img {
  display: block;
  width: 100%;
  height: 128px;
  border: 1px solid #d9e7f2;
  border-radius: 8px;
  background: #f3f6f7;
  object-fit: cover;
  object-position: center;
}

.site-editor-image-picker {
  position: relative;
  display: grid;
  min-height: 36px;
  place-items: center;
  margin: 0 !important;
  padding: 7px 10px;
  border: 1px solid #b8d5e8;
  border-radius: 7px;
  color: #2d7fb8 !important;
  background: #f7fbff;
  cursor: pointer;
}

.site-editor-image-picker:hover {
  border-color: #2d7fb8;
  background: #eef7fd;
}

.site-editor-image-picker input {
  position: absolute;
  width: 1px !important;
  height: 1px;
  min-height: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  border: 0 !important;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.site-editor-image-picker:focus-within {
  outline: 2px solid rgba(45, 127, 184, 0.18);
  outline-offset: 2px;
}

.site-editor-image-pending {
  margin: 0;
  color: #9a6a18;
  font-size: 11px;
  line-height: 1.5;
}

.site-editor-panel button.site-editor-danger {
  border-color: rgba(255, 127, 106, 0.42);
  color: #b34f40;
}

.site-editor-panel button.site-editor-small {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12px;
}

.site-editor-panel button.site-editor-wide {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
}

.site-editor-divider {
  height: 1px;
  margin: 16px 0;
  border: 0;
  background: #d9e7f2;
}

.site-editor-toast {
  position: fixed;
  z-index: 31000;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 14px;
  border: 1px solid #b8d5e8;
  border-radius: 10px;
  color: #243843;
  background: #fffdfb;
  box-shadow: 0 12px 34px rgba(36, 56, 67, 0.18);
  font-size: 13px;
}

.site-editor-toast.is-error {
  border-color: rgba(255, 127, 106, 0.55);
  background: #fff4f1;
}

.site-editor-toast[hidden] {
  display: none;
}

.site-editor-active [data-editor-key] {
  outline: 1px dashed transparent;
  outline-offset: 3px;
}

.site-editor-active [data-editor-key]:hover {
  outline-color: rgba(45, 127, 184, 0.42);
}

.site-editor-active [data-editor-key].is-editor-selected {
  outline: 2px solid #ff7f6a;
  outline-offset: 4px;
}

.site-editor-active [contenteditable="plaintext-only"] {
  cursor: text;
}

.site-editor-active .desktop-folder {
  cursor: move;
  touch-action: none;
}

.site-editor-active .desktop-folder [contenteditable="plaintext-only"] {
  cursor: text;
  touch-action: auto;
  user-select: text;
}

.site-editor-active .archive-content a {
  cursor: text;
}

.site-editor-active .home-ip::after,
.site-editor-active .desktop-folder::after {
  position: absolute;
  inset: -5px;
  border: 1px dashed rgba(45, 127, 184, 0.42);
  border-radius: 10px;
  content: "";
  opacity: 0;
  pointer-events: none;
}

.site-editor-active .home-ip:hover::after,
.site-editor-active .desktop-folder:hover::after {
  opacity: 1;
}

@media (max-width: 700px) {
  .site-editor-toolbar {
    top: 8px;
    gap: 4px;
    padding: 5px;
  }

  .site-editor-toolbar button {
    min-height: 31px;
    padding: 0 8px;
    font-size: 11px;
  }

  .site-editor-mode-label {
    display: none;
  }

  .site-editor-panel {
    top: 52px;
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-editor-toolbar,
  .site-editor-panel,
  .site-editor-toast {
    scroll-behavior: auto;
  }
}
