/* Resume Editor — 工具栏与侧边栏 Chrome */

/* —— 顶部工具栏 —— */
.toolbar {
  position: relative;
  flex: 0 0 auto;
  z-index: 200;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid #d8d8d8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.toolbar-left {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.toolbar-brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 1;
  text-decoration: none;
}

.toolbar-brand .brand-logo {
  width: auto;
  height: 28px;
  max-width: min(160px, 46vw);
  display: block;
  flex-shrink: 1;
  object-fit: contain;
  object-position: left center;
}

.toolbar-tips {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 28em;
  height: 22px;
  overflow: hidden;
}

.toolbar-tip {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  font-size: 12px;
  line-height: 22px;
  color: #6a6a6a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.toolbar-tip.is-in {
  opacity: 1;
  transform: translateY(0);
}

.toolbar-tip.is-out {
  opacity: 0;
  transform: translateY(-10px);
}

@media (prefers-reduced-motion: reduce) {
  .toolbar-tip {
    transition: opacity 0.2s ease;
    transform: none;
  }
  .toolbar-tip.is-out {
    transform: none;
  }
}


/* —— 预览缩放 —— */
.zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-right: 4px;
  padding: 2px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafafa;
}

.zoom-group .btn-zoom {
  min-width: 32px;
  min-height: 30px;
  padding: 4px 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  color: #333;
  cursor: pointer;
  border-radius: 3px;
}

.zoom-group .btn-zoom:hover {
  background: #FFF0E6;
  color: #FF6700;
}

.zoom-group .zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #555;
  user-select: none;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  position: relative;
}

.toolbar-overflow {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-more-btn {
  display: none;
}

.zoom-reset-m { display: none; }

.btn {
  appearance: none;
  border: 1px solid #1a1a1a;
  background: #fff;
  color: #1a1a1a;
  font-size: 13px;
  padding: 6px 14px;
  min-height: 34px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover {
  background: #f4f4f4;
}

.btn:active { transform: translateY(1px); }

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-accent {
  background: #FF6700;
  border-color: #FF6700;
  color: #fff;
}

.btn-accent:hover {
  background: #E55C00;
  border-color: #E55C00;
}

.btn.active-edit {
  background: #FF6700;
  border-color: #FF6700;
  color: #fff;
}

.btn.active-edit:hover {
  background: #E55C00;
  border-color: #E55C00;
}

.btn-ghost {
  border-color: #ccc;
  color: #444;
}

.btn-ghost:hover {
  border-color: #999;
  background: #fafafa;
}

.btn-danger {
  border-color: #c44;
  color: #c44;
}

.btn-danger:hover {
  background: #fff5f5;
}

.btn-sm {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon-sm {
  appearance: none;
  border: 1px solid #ddd;
  background: #fff;
  color: #555;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
}

.btn-icon-sm:hover {
  border-color: #999;
  color: #111;
  background: #f7f7f7;
}

.btn-icon-sm:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-icon-sm.danger:hover {
  border-color: #c44;
  color: #c44;
  background: #fff5f5;
}

/* —— 侧边栏（左内容 / 右样式） —— */
.sidebar {
  display: none;
  width: var(--sidebar-w, 360px);
  max-width: 100%;
  height: 100%;
  align-self: stretch;
  position: relative;
  top: 0;
  flex: 0 0 var(--sidebar-w, 360px);
  background: #f0f1f3;
  overflow: hidden;
  flex-direction: column;
  z-index: 150;
  margin: 0;
  padding: 0;
}

.sidebar-left {
  border-right: 1px solid #d8d8d8;
  border-left: none;
}

.sidebar-right {
  border-left: 1px solid #d8d8d8;
  border-right: none;
}

.sidebar-header {
  flex-shrink: 0;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  background: #fff;
  border-bottom: 1px solid #ddd;
  letter-spacing: 0.02em;
}

.mobile-panel-tabs {
  display: none;
  flex-shrink: 0;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #ddd;
  z-index: 180;
}

.mobile-sheet-chrome {
  display: contents;
}

.mobile-sheet-rail,
.mobile-sheet-toggle {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sidebar-tab {
  flex: 1;
  appearance: none;
  border: none;
  background: transparent;
  padding: 12px 8px;
  font-size: 13px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.sidebar-tab:hover { color: #222; }

.sidebar-tab.is-active {
  color: #FF6700;
  border-bottom-color: #FF6700;
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  scroll-behavior: smooth;
  min-height: 0;
}

.sidebar-panel { display: block; }

/* 大屏：编辑时左右侧栏同时显示，隐藏移动端 tabs */
@media (min-width: 1200px) {
  body.is-editing .sidebar-left,
  body.is-editing .sidebar-right {
    display: flex;
  }

  .mobile-panel-tabs {
    display: none !important;
  }
}

/* 小屏：编辑时只显示一个侧栏；tabs 可见 */
@media (max-width: 1199px) {
  body.is-editing .mobile-panel-tabs {
    display: flex;
  }

  body.is-editing.panel-content .sidebar-left {
    display: flex;
  }

  body.is-editing.panel-style .sidebar-right {
    display: flex;
  }

  body.is-editing.panel-content .sidebar-right,
  body.is-editing.panel-style .sidebar-left {
    display: none;
  }
}

/* —— 面板卡片 —— */
.panel-card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.panel-card-title {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-card-title .hint {
  font-weight: 400;
  font-size: 11px;
  color: #888;
}

.field {
  margin-bottom: 10px;
}

.field:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.field-row {
  display: flex;
  gap: 8px;
}

.field-row .field { flex: 1; min-width: 0; }

.field input[type="text"],
.field input[type="email"],
.field input[type="tel"],
.field input[type="number"],
.field input[type="color"],
.field select {
  width: 100%;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 13px;
  color: #1a1a1a;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #FF6700;
  box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.16);
}

.sidebar textarea {
  appearance: none;
  -webkit-appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 10px 12px;
  background: #f7f7f8;
  color: #1a1a1a;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.01em;
  min-height: 44px;
  resize: none;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.sidebar textarea:hover {
  border-color: #cfcfcf;
  background: #fff;
}

.sidebar textarea:focus {
  outline: none;
  border-color: #FF6700;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.16);
}

.sidebar textarea::placeholder {
  color: #aaa;
}

.field textarea {
  min-height: 64px;
}

.field input[type="color"] {
  padding: 2px 4px;
  height: 34px;
  cursor: pointer;
}

.field-hint {
  font-size: 11px;
  color: #999;
  margin-top: 4px;
}

/* —— 照片控件 —— */
.photo-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.photo-thumb {
  width: 48px;
  height: 60px;
  object-fit: cover;
  background: #eee;
  border: 1px solid #ddd;
  border-radius: 3px;
  flex-shrink: 0;
}

.photo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* —— 分区列表 —— */
.section-item {
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fafafa;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.section-item.is-selected {
  border-color: #FF6700;
  box-shadow: 0 0 0 1px #FF6700;
  background: #fffaf6;
}

.section-item-body {
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  min-height: 0;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
  opacity: 1;
}
.section-item.is-collapsed .section-item-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.section-item-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: #fff;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.section-item:not(.is-collapsed) .section-item-head {
  border-bottom-color: #eee;
}

.section-item-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.section-item-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  color: var(--icon, #1a1a1a);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.section-item-heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: flex-start;
}

.section-item-title {
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  font-weight: 650;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-item-type {
  font-size: 10px;
  color: #888;
  background: #f0f0f0;
  padding: 1px 6px;
  border-radius: 999px;
  flex-shrink: 0;
  line-height: 1.4;
}

.section-item-actions {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.section-item-body {
  padding: 0 !important;
}
.section-item-inner {
  padding: 8px 10px 10px;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-item.is-hidden-preview {
  opacity: 0.65;
}

.section-item.is-hidden-preview .section-item-title::after {
  content: "（已隐藏）";
  font-weight: 400;
  font-size: 11px;
  color: #999;
  margin-left: 4px;
}

/* —— 条目编辑器 —— */
.entry-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.entry-list .add-row {
  margin-top: 0;
}

.entry-editor {
  border: 1px solid #e6e6e6;
  border-radius: 6px;
  margin-bottom: 0;
  background: #fff;
}

.entry-editor-head {
  /* accordion head styles below */
}

.entry-editor-label {
  font-size: 12px;
  font-weight: 700;
  color: #444;
}

.sub-list,
.bullet-list,
.skill-edit-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 6px;
}

.line-row {
  display: flex;
  gap: 6px;
  align-items: flex-start;
}

.line-row input {
  flex: 1;
  min-width: 0;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  padding: 6px 8px;
  font-size: 12px;
}

.line-row textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
}

.line-row input:focus {
  outline: none;
  border-color: #FF6700;
  box-shadow: 0 0 0 3px rgba(255, 103, 0, 0.16);
}

.add-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* —— 图标选择器 —— */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 4px;
}

.icon-pick {
  appearance: none;
  border: 1px solid #ddd;
  background: #fff;
  border-radius: 6px;
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 4px;
  transition: border-color 0.12s, background 0.12s;
}

.icon-pick svg {
  width: 18px;
  height: 18px;
  stroke: #555;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-pick:hover {
  border-color: #FF6700;
  background: #f3f9f7;
}

.icon-pick.is-selected {
  border-color: #FF6700;
  background: #FFF0E6;
  box-shadow: 0 0 0 2px rgba(44, 95, 86, 0.2);
}

.icon-pick.is-selected svg {
  stroke: currentColor;
  color: var(--icon, #1a1a1a);
}

/* —— 样式控件 —— */
.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.style-grid .field.span-2 {
  grid-column: 1 / -1;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.range-row input[type="range"] {
  flex: 1;
  min-width: 0;
}

.range-val {
  font-size: 12px;
  color: #555;
  min-width: 42px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-row input[type="color"] {
  width: 40px;
  height: 34px;
  padding: 2px;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

.color-row input[type="text"] {
  flex: 1;
  border: 1px solid #d0d0d0;
  border-radius: 5px;
  padding: 7px 9px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty-state {
  text-align: center;
  padding: 28px 16px;
  color: #888;
  font-size: 13px;
  background: #fff;
  border: 1px dashed #ccc;
  border-radius: 8px;
  margin-bottom: 12px;
}

.empty-state strong {
  display: block;
  color: #444;
  margin-bottom: 4px;
}

.add-section-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #444;
  margin-top: 6px;
}

.checkbox-row input {
  width: 15px;
  height: 15px;
  accent-color: #FF6700;
}

/* —— toast —— */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1a1a;
  color: #fff;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.toast.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.editor-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  padding-bottom: max(6px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #eee;
  background: #fff;
  color: #9a9a9a;
  font-size: 12px;
}

.editor-footer a {
  color: #666;
  text-decoration: none;
  font-weight: 600;
}

.editor-footer a:hover {
  color: #FF6700;
}

@media screen and (max-width: 820px) {
  .editor-footer {
    display: none;
  }

  .toolbar {
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    padding-top: max(8px, env(safe-area-inset-top, 0px));
  }

  .toolbar-left {
    flex: 0 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .toolbar-brand .brand-logo {
    height: 24px;
  }

  .toolbar-tips {
    display: none;
  }

  .toolbar-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    min-width: 0;
  }

  .btn-label-rest {
    display: none;
  }

  .toolbar-more-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .toolbar-overflow {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 320;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 196px;
    padding: 10px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.14);
  }

  .toolbar-overflow.is-open {
    display: flex;
  }

  .toolbar-overflow .zoom-group {
    margin: 0;
    justify-content: space-between;
  }

  .toolbar-overflow .btn {
    width: 100%;
  }

  .zoom-reset-pc { display: none; }
  .zoom-reset-m { display: inline; }

  .btn {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .btn-sm {
    min-height: 40px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .btn-icon-sm {
    width: 40px;
    height: 40px;
  }

  body.is-sheet-dragging {
    cursor: ns-resize;
    user-select: none;
    -webkit-user-select: none;
  }

  body.is-editing .sidebar-header {
    display: none;
  }

  body.is-editing .mobile-sheet-rail {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 32px;
    transform: none;
    background: transparent;
    z-index: 4;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
  }

  body.is-editing .mobile-sheet-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    left: 50%;
    top: auto;
    bottom: 0;
    z-index: 5;
    width: 44px;
    height: 22px;
    margin: 0;
    padding: 0;
    border: 1px solid #e6e6e6;
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    background: #fff;
    box-shadow: none;
    color: #666;
    transform: translateX(-50%);
    cursor: ns-resize;
    touch-action: none;
    appearance: none;
    -webkit-appearance: none;
  }

  body.is-editing .mobile-sheet-toggle:active {
    background: #f7f7f7;
  }

  .mobile-sheet-chevron {
    display: block;
    width: 7px;
    height: 7px;
    border-right: 2px solid #666;
    border-bottom: 2px solid #666;
    transform: rotate(45deg);
    margin-top: -3px;
    pointer-events: none;
    transition: transform 0.2s ease, margin 0.2s ease;
  }

  body.sheet-collapsed .mobile-sheet-chevron {
    transform: rotate(-135deg);
    margin-top: 3px;
  }

  body.is-editing.sheet-collapsed .mobile-sheet-rail {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    height: 24px;
  }

  body.is-editing.sheet-collapsed .mobile-sheet-toggle {
    cursor: pointer;
  }

  body.is-editing .sidebar {
    position: relative;
    top: 0;
    width: 100%;
    max-width: none;
    flex: 0 0 var(--mobile-sheet-h, 42dvh);
    height: var(--mobile-sheet-h, 42dvh);
    max-height: none;
    min-height: 0;
    margin: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    border-radius: 0;
  }

  body.is-editing .sidebar-left,
  body.is-editing .sidebar-right {
    border-left: none;
    border-right: none;
  }

  .mobile-panel-tabs {
    padding-bottom: 0;
  }

  .sidebar-tab {
    min-height: 44px;
    padding: 12px 8px;
    font-size: 14px;
  }

  .sidebar-body {
    padding: 10px 12px calc(16px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
  }

  .field input[type="text"],
  .field input[type="email"],
  .field input[type="tel"],
  .field input[type="number"],
  .field input[type="color"],
  .field select,
  .color-row input[type="text"] {
    font-size: 16px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .field textarea,
  .sidebar textarea {
    font-size: 16px;
    min-height: 44px;
    padding: 10px 12px;
  }

  .field-row {
    flex-direction: column;
    gap: 0;
  }

  .section-item-head {
    min-height: 48px;
    padding: 10px 12px;
    gap: 8px;
  }

  .section-item-actions {
    gap: 6px;
  }

  .photo-controls {
    flex-wrap: wrap;
  }

  .photo-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .toast {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    max-width: calc(100% - 24px);
  }

  .modal-root {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
    align-items: flex-end;
  }

  .modal-dialog {
    width: 100%;
  }

  .modal-actions .btn {
    min-height: 44px;
  }

  .add-section-bar .btn {
    min-height: 40px;
  }

  button,
  .btn,
  .sidebar-tab,
  .btn-zoom {
    touch-action: manipulation;
  }
}

@media screen and (max-width: 380px) {
  .toolbar-brand .brand-logo {
    height: 22px;
  }
}


/* —— 手风琴 —— */
.accordion-head {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: color 0.2s ease;
}

.accordion-head:hover {
  color: #FF6700;
}

.accordion-chevron {
  font-size: 12px;
  color: #888;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  transform: rotate(0deg);
  flex-shrink: 0;
}

.accordion-item.is-collapsed .accordion-chevron,
.section-item.is-collapsed .section-item-head .accordion-chevron {
  transform: rotate(-90deg);
}

/* 平滑展开：grid 0fr → 1fr */
.accordion-body,
.section-item-body {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.22s ease;
  opacity: 1;
}

.accordion-item.is-collapsed .accordion-body,
.section-item.is-collapsed .section-item-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}

.accordion-body > .accordion-inner,
.section-item-body > .section-item-inner,
.accordion-body,
.section-item-body {
  min-height: 0;
}

/* 内容包裹层，保证 overflow 裁切 */
.accordion-body {
  overflow: hidden;
}

.section-item-body {
  overflow: hidden;
}

.section-item-head {
  cursor: pointer;
  transition: background 0.2s ease;
}

.section-item-head .accordion-chevron {
  margin-left: 4px;
  flex-shrink: 0;
}

.section-item {
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.section-item:not(.is-collapsed) {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}


.btn-icon-sm .ui-icon {
  display: block;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.btn-icon-sm.is-off {
  color: #aaa;
  border-color: #e0e0e0;
}

.btn-icon-sm.is-off:hover {
  color: #FF6700;
  border-color: #FF6700;
}

.accordion-head.panel-card-title {
  margin-bottom: 0;
  padding-bottom: 4px;
}
.accordion-item:not(.is-collapsed) .accordion-head.panel-card-title {
  margin-bottom: 12px;
}

/* —— 折叠态压紧：padding 不能写在可折叠容器上 —— */
.section-item-body,
.accordion-body {
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  min-height: 0 !important;
}

.section-item-inner,
.accordion-inner {
  padding: 10px 10px 12px;
  min-height: 0;
  overflow: hidden;
}

.section-item.is-collapsed .section-item-body,
.accordion-item.is-collapsed .accordion-body {
  grid-template-rows: 0fr !important;
  opacity: 0;
  pointer-events: none;
  /* 彻底不占位 */
  max-height: 0;
  transition:
    grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.2s ease,
    max-height 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-item:not(.is-collapsed) .section-item-body,
.accordion-item:not(.is-collapsed) .accordion-body {
  max-height: 2000px;
}

.section-item.is-collapsed .section-item-head {
  border-bottom-color: transparent !important;
}

.section-item.is-collapsed {
  background: #fff;
}

/* —— 分区拖拽排序 —— */
.section-drag-handle {
  flex-shrink: 0;
  width: 16px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  letter-spacing: -2px;
  color: #b0b0b0;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.section-drag-handle:hover {
  color: #666;
}
.section-item[draggable="true"] {
  cursor: grab;
}
.section-item.is-dnd-shift,
.block[data-section].is-dnd-shift {
  will-change: transform;
  position: relative;
  z-index: 1;
}
body.is-dnd .section-item,
body.is-dnd .block[data-section] {
  /* live gap animation driven inline; keep layout stable */
}
.section-item.is-dragging,
.section-item.is-dragging .section-drag-handle {
  cursor: grabbing;
  opacity: 0.38;
}
.section-item.is-dragging {
  position: relative;
  z-index: 2;
  box-shadow: 0 0 0 1.5px #FF6700;
  background: #fff7f0;
}
.section-item.dnd-drop-before {
  box-shadow: inset 0 2.5px 0 0 #FF6700;
}
.section-item.dnd-drop-after {
  box-shadow: inset 0 -2.5px 0 0 #FF6700;
}

/* —— 条目手风琴 —— */
.entry-editor {
  padding: 0;
  overflow: hidden;
}
.entry-editor-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  margin-bottom: 0;
  cursor: pointer;
  user-select: none;
  line-height: 1.2;
}
.entry-editor-head .accordion-chevron {
  flex-shrink: 0;
  font-size: 11px;
  color: #999;
  transition: transform 0.22s ease;
}
.entry-editor.is-collapsed .entry-editor-head .accordion-chevron {
  transform: rotate(-90deg);
}
.entry-editor-label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-editor-date {
  font-weight: 400;
  color: #999;
  margin-left: 4px;
}
.entry-editor-body {
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  min-height: 0;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
  opacity: 1;
}
.entry-editor.is-collapsed .entry-editor-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}
.entry-editor.is-collapsed .entry-editor-inner {
  padding-top: 0;
  padding-bottom: 0;
}
.entry-editor-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 10px 10px;
}

/* —— 图标选择手风琴 —— */
.icon-picker-block {
  margin-top: 0;
  border: 1px solid #e8e8e8;
  border-radius: 6px;
  background: #fff;
  overflow: hidden;
}
.icon-picker-toggle {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border: none;
  background: #fff;
  cursor: pointer;
  text-align: left;
  color: inherit;
  line-height: 1.2;
}
.icon-picker-toggle:hover {
  background: #fafafa;
}
.icon-picker-toggle-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.icon-picker-toggle-label {
  font-size: 12px;
  font-weight: 650;
  color: #555;
}
.icon-picker-current {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.icon-picker-current svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  color: #1a1a1a;
  fill: none;
  stroke-width: 1.7;
}
.icon-picker-hint {
  font-size: 11px;
  color: #aaa;
}
.icon-picker-toggle .accordion-chevron {
  font-size: 11px;
  color: #999;
  transition: transform 0.22s ease;
}
.icon-picker-block.is-collapsed .icon-picker-toggle .accordion-chevron {
  transform: rotate(-90deg);
}
.icon-picker-body {
  display: grid;
  grid-template-rows: 1fr;
  overflow: hidden;
  min-height: 0;
  transition: grid-template-rows 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.22s ease;
  opacity: 1;
}
.icon-picker-block.is-collapsed .icon-picker-body {
  grid-template-rows: 0fr;
  opacity: 0;
  pointer-events: none;
}
.icon-picker-block.is-collapsed .icon-picker-inner {
  padding-top: 0;
  padding-bottom: 0;
}
.icon-picker-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 8px 8px;
}
.icon-picker {
  margin-top: 0;
}

/* —— 主题色弹窗 —— */
body.modal-open {
  overflow: hidden;
}
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal-root[hidden] {
  display: none !important;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.45);
  z-index: 0;
}
.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(400px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  padding: 20px 22px 16px;
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
}
.modal-message {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  color: #555;
  white-space: pre-wrap;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.modal-actions .btn.is-danger,
#modalOk.is-danger {
  background: #FF6700;
  border-color: #FF6700;
  color: #fff;
}
.modal-actions .btn.is-danger:hover,
#modalOk.is-danger:hover {
  filter: brightness(0.95);
}
.modal-root:not(.is-alert) #modalOk:not(.is-danger) {
  background: #FF6700;
  border-color: #FF6700;
  color: #fff;
}
.modal-root.is-alert #modalOk {
  background: #FF6700;
  border-color: #FF6700;
  color: #fff;
}

