/* ==========================================================================
   小萌实用工具 · 会议议程生成器 专属样式
   融合宜小萌平台办公协同视觉规范与党政公文稳重风格
   ========================================================================== */

:root {
  --ink: #101b39;
  --muted: #64708b;
  --line: #dce4f2;
  --accent: #c8161d;
  --accent-hover: #a31016;
  --accent-soft: #fff1f0;
  --accent-border: #ffccc7;
  --blue: #3158b7;
  --cyan: #18b9d5;
  --bg-app: #f5f8ff;
  --bg-sidebar: #ffffff;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-app);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 页面主网格：左侧侧边栏 + 右侧工作区 */
.app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 500px minmax(0, 1fr);
}

/* 侧边栏 */
.sidebar {
  position: relative;
  z-index: 10;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.98);
  border-right: 1px solid rgba(49, 88, 183, 0.12);
  box-shadow: 4px 0 20px rgba(16, 27, 57, 0.04);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #edf2fa;
}

.brand-logo {
  height: 34px;
  width: auto;
  display: block;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.workbench-return {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #ccd9ed;
  border-radius: 8px;
  background: #ffffff;
  color: var(--blue);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.15s;
}

.workbench-return:hover {
  background: #f0f5ff;
  border-color: #9cb5db;
  transform: translateY(-1px);
}

/* 标签切换导航 */
.sidebar-tabs {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}

.tab-btn {
  flex: 1;
  padding: 11px 12px;
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--ink);
  background: #f1f5f9;
}

.tab-btn.active {
  color: var(--accent);
  font-weight: 600;
  background: #ffffff;
  border-bottom-color: var(--accent);
}

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 24px;
}

/* 表单分块与控件 */
.form-section {
  margin-bottom: 20px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 13px;
  background: var(--accent);
  border-radius: 2px;
}

.form-group {
  margin-bottom: 12px;
}

.form-row {
  display: flex;
  gap: 10px;
}

.form-row .form-group {
  flex: 1;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 5px;
}

.form-label .required {
  color: var(--accent);
  margin-left: 2px;
}

.form-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink);
  background: #ffffff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200, 22, 29, 0.12);
}

.form-textarea {
  resize: vertical;
  min-height: 54px;
  line-height: 1.5;
}

/* 预设标签 */
.tags-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  user-select: none;
  transition: all 0.12s;
}

.tag-badge:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.tag-badge.selected {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent-border);
  font-weight: 600;
}

/* 议程项目卡片 */
.agenda-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: #f8fafc;
  position: relative;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.agenda-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.agenda-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.agenda-card-index {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 4px;
}

.agenda-card-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.icon-btn:hover {
  background: #e2e8f0;
  color: var(--ink);
}

.icon-btn.delete:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* 按钮通用 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  user-select: none;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #334155;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: var(--ink);
}

.btn-outline-primary {
  background: transparent;
  border-color: var(--accent-border);
  color: var(--accent);
}

.btn-outline-primary:hover {
  background: var(--accent-soft);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 11.5px;
}

/* ------------------ 右侧工作区 ------------------ */
.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #4a4e51;
  position: relative;
  overflow: hidden;
}

/* 顶部操作条 */
.preview-toolbar {
  min-height: 46px;
  height: auto;
  background: #2f3336;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  z-index: 10;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
  overflow-x: auto;
  gap: 12px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  white-space: nowrap;
}

.toolbar-btn {
  background: #3f4448;
  border: 1px solid #555b60;
  color: #e2e8f0;
  padding: 4px 9px;
  border-radius: 4px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: #50565b;
  color: #ffffff;
}

.toolbar-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.zoom-indicator {
  font-size: 12px;
  min-width: 44px;
  text-align: center;
  color: #cbd5e1;
  font-family: monospace;
}

/* 预览视口与缩放阶段 */
.preview-viewport {
  flex: 1;
  overflow: auto;
  position: relative;
  scroll-behavior: smooth;
}

.zoom-stage {
  transform-origin: top center;
  transition: transform 0.15s ease-out;
  display: flex;
  justify-content: center;
  min-width: 100%;
}

/* 悬浮状态信息 (现代暗色玻璃质感) */
.preview-footer-status {
  position: absolute;
  bottom: 16px;
  right: 24px;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 11.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 25;
  pointer-events: none;
}

.status-sep {
  color: #475569;
  font-size: 10px;
}

.status-badge-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 500;
}

.status-badge-mini.safe {
  color: #4ade80;
}

.status-badge-mini.tolerable {
  color: #fbbf24;
}

.status-badge-mini.overflow_banxin,
.status-badge-mini.critical {
  color: #f87171;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.safe {
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.6);
}

.status-dot.tolerable {
  background: #fbbf24;
  box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}

.status-dot.overflow_banxin,
.status-dot.critical {
  background: #f87171;
  box-shadow: 0 0 6px rgba(248, 113, 113, 0.6);
}

/* 提示 Toast */
.toast-msg {
  position: fixed;
  top: 60px;
  right: 24px;
  background: #101b39;
  color: #ffffff;
  padding: 9px 16px;
  border-radius: 6px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  z-index: 999;
  animation: slideIn 0.2s ease-out forwards;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 滚动条定制 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* 页脚备案与声明规范 */
.name-card-footer {
  flex: none;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px 14px;
  padding: 4px 12px;
  color: #7a869a;
  font: 11px/20px "Microsoft YaHei", sans-serif;
  background: #f7faff;
  border-top: 1px solid #e6eef8;
}

.name-card-footer a,
.name-card-footer button {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

.name-card-footer button {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.name-card-footer a:hover,
.name-card-footer button:hover {
  color: var(--blue);
}

.tool-legal-dialog {
  width: min(700px, calc(100% - 32px));
  max-height: 80vh;
  padding: 24px;
  border: 1px solid #dce4f2;
  border-radius: 16px;
  color: #64708b;
  background: #fff;
  font: 13.5px/1.8 "Microsoft YaHei", sans-serif;
  box-shadow: 0 24px 80px rgba(16, 27, 57, 0.2);
  overflow: auto;
}

.tool-legal-dialog::backdrop {
  background: rgba(16, 27, 57, 0.5);
}

.tool-legal-dialog h2 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #101b39;
}

.tool-legal-dialog p {
  margin: 10px 0;
}

.tool-legal-dialog form {
  text-align: right;
  margin-top: 16px;
}

.tool-legal-dialog form button {
  border: 1px solid #dce4f2;
  border-radius: 6px;
  background: #f7faff;
  color: var(--blue);
  padding: 6px 14px;
  font: inherit;
  cursor: pointer;
}

/* ------------------ 响应式断点与移动端适配 ------------------ */
.mobile-view-tabs {
  display: none;
}

@media (max-width: 1080px) {
  .app {
    grid-template-columns: 440px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .app {
    grid-template-columns: 380px minmax(0, 1fr);
  }
  .brand-logo {
    height: 28px;
  }
  .preview-toolbar {
    padding: 8px 12px;
    height: auto;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .preview-toolbar .toolbar-group {
    flex-shrink: 0;
    white-space: nowrap;
  }
  .preview-toolbar label,
  .preview-toolbar span,
  .preview-toolbar button,
  .preview-toolbar select {
    white-space: nowrap;
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow-y: auto;
  }
  #app {
    height: auto !important;
    min-height: 100vh;
  }
  .app {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 30px);
  }
  
  /* 移动端顶部切换栏 */
  .mobile-view-tabs {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 100;
    background: #ffffff;
    border-bottom: 2px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }
  .mobile-view-btn {
    flex: 1;
    padding: 12px 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    background: #f8fafc;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.15s;
  }
  .mobile-view-btn.active {
    color: var(--accent);
    background: #ffffff;
    border-bottom-color: var(--accent);
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    max-height: none;
    overflow: visible;
    border-right: none;
    box-shadow: none;
  }
  .sidebar.mobile-hidden {
    display: none !important;
  }
  
  .workspace {
    width: 100%;
    min-height: 80vh;
    height: auto;
    overflow: visible;
  }
  .workspace.mobile-hidden {
    display: none !important;
  }
  .preview-viewport {
    overflow-x: auto;
    overflow-y: visible;
    padding: 10px 0 30px;
  }
  .a4-page-wrapper {
    padding: 12px 4px 40px;
  }
}

.development-notice{width:min(400px,calc(100vw - 40px));padding:32px;border:1px solid #dce5f2;border-radius:20px;box-shadow:0 24px 80px #12254d33;text-align:center;color:#24324b;background:#fff;box-sizing:border-box}
.development-notice::backdrop{background:#172d4d66;backdrop-filter:blur(3px)}
.development-notice-icon{display:inline-grid;place-items:center;width:46px;height:46px;border-radius:50%;background:#edf4ff;color:#3563c2;font:700 26px Georgia,serif}
.development-notice h2{font-size:20px;line-height:1.6;margin:20px 0 26px;font-weight:650}
.development-notice button{border:0;border-radius:10px;padding:11px 30px;background:#315bc4;color:#fff;font-family:inherit;font-size:14px;font-weight:600;cursor:pointer}
.development-notice button:hover{background:#254cae}

/* ==========================================================================
   新增自定义断行、自定义时间选择、组织要素管理、主要议程排版方式样式
   ========================================================================== */

/* 内联微型按钮 */
.btn-text-sm {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  transition: background 0.15s;
}

.btn-text-sm:hover {
  background: var(--accent-soft);
  text-decoration: underline;
}

.btn-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* 时间自定义选择面板 */
.time-picker-panel {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.time-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #e2e8f0;
}

.time-picker-preview {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 10px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 组织要素卡片与列表 */
.meta-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.meta-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.meta-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.meta-label-input {
  width: 120px !important;
  font-weight: 700;
  color: var(--ink);
  background: #f8fafc;
}

.meta-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.quick-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 8px 0 12px;
}

/* 主要议程排版方式双选卡片 */
.agenda-placement-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.placement-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 480px) {
  .placement-options {
    grid-template-columns: 1fr;
  }
}

.placement-option {
  display: flex;
  flex-direction: column;
  padding: 10px 12px;
  border-radius: 6px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.15s;
}

.placement-option:hover {
  border-color: #94a3b8;
  background: #f1f5f9;
}

.placement-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 2px rgba(200, 22, 29, 0.1);
}

.placement-option .option-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 4px;
}

.placement-option.active .option-title {
  color: var(--accent);
}

.placement-option .option-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

/* ==========================================================================
   新增 A4 参考尺寸卡、版心与切边标线、超出一页高度警示样式
   ========================================================================== */

.a4-page-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* 纸张信息条 */
.a4-page-header-bar {
  width: 210mm;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dce4f2;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(16, 27, 57, 0.04);
  box-sizing: border-box;
  font-size: 12px;
}

/* ==========================================================================
   预览工具栏：现代 Dark Slate 质感设计与分段胶囊控制器
   ========================================================================== */
.preview-toolbar {
  min-height: 48px;
  height: auto;
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 18px;
  z-index: 20;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow-x: auto;
  gap: 14px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

.page-count-badge {
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

/* 分段胶囊控制器 (Segmented Pill Group) */
.pill-group {
  display: inline-flex;
  align-items: center;
  background: #1e293b;
  padding: 3px;
  border-radius: 8px;
  border: 1px solid #334155;
  gap: 2px;
}

.pill-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.pill-btn:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.06);
}

.pill-btn.active {
  background: #3b82f6;
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* 手动分页步进器 */
.split-stepper {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #1e293b;
  border: 1px solid #334155;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  color: #cbd5e1;
}

.stepper-label {
  font-size: 11.5px;
  color: #94a3b8;
  margin-right: 2px;
}

.stepper-val {
  font-weight: 600;
  color: #ffffff;
  min-width: 28px;
  text-align: center;
}

/* 行距控制器组合 */
.line-height-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #1e293b;
  border: 1px solid #334155;
  padding: 3px 8px;
  border-radius: 8px;
}

.stepper-box {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.line-height-val {
  font-family: monospace;
  font-size: 12px;
  font-weight: 600;
  color: #38bdf8;
  min-width: 44px;
  text-align: center;
}

.btn-stepper {
  background: #334155;
  border: 1px solid #475569;
  color: #ffffff;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: all 0.12s;
  user-select: none;
}

.btn-stepper:hover {
  background: #475569;
  color: #ffffff;
  border-color: #64748b;
}

.btn-stepper:active {
  transform: scale(0.95);
}

/* 快速行距预设按钮 */
.preset-pills {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-left: 1px solid #334155;
  padding-left: 6px;
}

.preset-pill {
  background: transparent;
  border: 1px solid #334155;
  color: #94a3b8;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s;
}

.preset-pill:hover {
  background: #334155;
  color: #f8fafc;
}

.preset-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 600;
}

/* 突出的一键智能自适应按钮 */
.btn-autofit-glow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid #60a5fa;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
  transition: all 0.18s ease;
  white-space: nowrap;
}

.btn-autofit-glow:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.5);
  transform: translateY(-1px);
}

.btn-autofit-glow:active {
  transform: translateY(0);
}

.toolbar-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #cbd5e1;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: #334155;
  color: #ffffff;
  border-color: #475569;
}

.toolbar-btn.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: #3b82f6;
  color: #60a5fa;
  font-weight: 600;
}

.page-meta-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-num-tag {
  font-weight: 700;
  color: #101b39;
  background: #edf2fa;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11.5px;
}

.page-size-info {
  color: #64748b;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.page-capacity-info {
  display: flex;
  align-items: center;
}

.page-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 6px;
}

.page-status-badge.ok {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

.page-status-badge.overflow {
  background: #fff1f0;
  color: #cf1322;
  border: 1px solid #ffa39e;
  animation: pulseNotice 2s infinite;
}

@keyframes pulseNotice {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.82; }
}

/* 版心警戒线 225mm (距顶 262mm) */
.a4-banxin-limit-line {
  position: absolute;
  top: 262mm;
  left: 28mm;
  right: 26mm;
  height: 0;
  border-top: 1.5px dashed rgba(200, 22, 29, 0.35);
  pointer-events: none;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
}

.a4-banxin-limit-line .limit-tag {
  font-size: 10.5px;
  color: #c8161d;
  background: rgba(255, 241, 240, 0.95);
  border: 1px solid #ffa39e;
  border-radius: 3px;
  padding: 1px 6px;
  transform: translateY(-50%);
  font-family: var(--gw-font-song), sans-serif;
  font-weight: 600;
  line-height: 1.3;
}

.a4-banxin-limit-line.is-overflow {
  border-top: 2px solid #e50012;
  box-shadow: 0 0 6px rgba(229, 0, 18, 0.5);
}

.a4-banxin-limit-line.is-overflow .limit-tag {
  background: #e50012;
  color: #ffffff;
  border-color: #b7000e;
  font-weight: 700;
}

/* A4 纸张切边底线 297mm */
.a4-page-limit-line {
  position: absolute;
  top: 297mm;
  left: 0;
  right: 0;
  height: 0;
  border-top: 1px solid rgba(100, 116, 139, 0.45);
  pointer-events: none;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
}

.a4-page-limit-line .limit-tag {
  font-size: 10px;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 1px 6px;
  transform: translateY(-50%);
  margin-right: 12px;
  font-family: sans-serif;
  line-height: 1.3;
}

.a4-page.has-overflow {
  box-shadow: 0 4px 25px rgba(200, 22, 29, 0.25), 0 0 0 1.5px rgba(200, 22, 29, 0.45);
}

/* 手动分页步进控制 */
.custom-split-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #2a2e33;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #444;
}

.btn-stepper {
  background: #3b424a;
  border: 1px solid #555;
  color: #fff;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.btn-stepper:hover {
  background: var(--blue);
}

.split-input {
  width: 32px;
  text-align: center;
  background: #181a1b;
  color: #fff;
  border: 1px solid #555;
  border-radius: 3px;
  padding: 1px 2px;
  font-size: 12px;
}

/* 打印适配 */
@media print {
  .a4-page-header-bar,
  .a4-banxin-limit-line,
  .a4-page-limit-line {
    display: none !important;
  }
  .a4-page-outer {
    display: block !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
  .a4-page-outer:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }
  .a4-page.has-overflow {
    box-shadow: none !important;
  }
}

/* ==========================================================================
   V4 新增：行距调节、A4容限进度标尺、15mm公文微调缓冲区、打印防白页强化
   ========================================================================== */

/* 行距控制条 */
.line-height-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: #2a2e33;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid #444;
}

.line-height-val {
  color: #4ade80;
  font-weight: 700;
  font-size: 11.5px;
  min-width: 38px;
  text-align: center;
}

/* 纸张信息条多行化与刻度进度条 */
.a4-page-header-bar {
  width: 210mm;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid #dce4f2;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(16, 27, 57, 0.04);
  box-sizing: border-box;
}

.header-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  width: 100%;
}

.page-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  white-space: normal;
  line-height: 1.35;
}

.page-status-badge.critical {
  background: #820014;
  color: #ffffff;
  border: 1px solid #5c0011;
  font-weight: 700;
  animation: pulseNotice 1s infinite;
}

/* 刻度进度条 Track */
.a4-gauge-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.a4-gauge-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 9999px;
  position: relative;
  display: flex;
  overflow: visible;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.gauge-zone {
  height: 100%;
}

.zone-safe {
  background: #4ade80;
  border-top-left-radius: 9999px;
  border-bottom-left-radius: 9999px;
}

.zone-tolerable {
  background: #facc15;
}

.zone-danger {
  background: #f87171;
  border-top-right-radius: 9999px;
  border-bottom-right-radius: 9999px;
}

.gauge-pointer {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 14px;
  background: #0f172a;
  border-radius: 2px;
  transform: translateX(-50%);
  z-index: 10;
  transition: left 0.2s ease-out;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.gauge-pointer::after {
  content: "";
  position: absolute;
  top: -3px;
  left: -3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  border: 1.5px solid #ffffff;
}

.gauge-pointer.safe { color: #16a34a; }
.gauge-pointer.tolerable { color: #d97706; }
.gauge-pointer.overflow_banxin { color: #dc2626; }
.gauge-pointer.critical { color: #7f1d1d; }

/* 刻度图例说明条（彻底解决字块被压缩折行问题） */
.a4-gauge-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
  user-select: none;
  padding: 0 2px;
}

.a4-gauge-legend .legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.a4-gauge-legend .legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.a4-gauge-legend .dot-safe { background: #4ade80; }
.a4-gauge-legend .dot-tolerable { background: #facc15; }
.a4-gauge-legend .dot-danger { background: #f87171; }

/* 纸面 15mm 容限微调区指示（透明化，绝不遮挡页码） */
.a4-tolerance-zone {
  position: absolute;
  top: 262mm;
  left: 28mm;
  right: 26mm;
  height: 15mm;
  background: transparent !important;
  border: 1px dashed rgba(217, 119, 6, 0.35);
  border-top: none;
  pointer-events: none;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-top: 2px;
  padding-right: 4px;
}

.a4-tolerance-zone .zone-tag {
  font-size: 9px;
  color: #b45309;
  background: transparent !important;
  padding: 0;
  border: none;
  font-family: var(--gw-font-song), sans-serif;
  font-weight: normal;
  user-select: none;
  opacity: 0.85;
}

/* 页码警戒红线 (277mm) */
.a4-page-number-limit-line {
  position: absolute;
  top: 277mm;
  left: 28mm;
  right: 26mm;
  height: 0;
  border-top: 1.5px solid rgba(220, 38, 38, 0.45);
  pointer-events: none;
  z-index: 18;
  display: flex;
  justify-content: flex-start;
}

.a4-page-number-limit-line .limit-tag {
  font-size: 9.5px;
  color: #dc2626;
  background: rgba(254, 226, 226, 0.95);
  border: 1px solid #f87171;
  border-radius: 3px;
  padding: 1px 5px;
  transform: translateY(-50%);
  font-family: var(--gw-font-song), sans-serif;
  font-weight: 600;
}

/* PDF 导出专用样式（临时激活，隐藏一切参考线与阴影） */
.exporting-pdf .a4-page-header-bar,
.exporting-pdf .a4-banxin-limit-line,
.exporting-pdf .a4-tolerance-zone,
.exporting-pdf .a4-page-number-limit-line,
.exporting-pdf .a4-page-limit-line,
.exporting-pdf .gw-page-ruler,
.exporting-pdf .no-print {
  display: none !important;
}

.exporting-pdf .a4-page {
  box-shadow: none !important;
  border: none !important;
}

/* 打印输出终极防白页规则 */
@media print {
  html, body {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #app, .app {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .sidebar,
  .sidebar.mobile-hidden,
  .no-print,
  .preview-toolbar,
  .a4-page-header-bar,
  .a4-banxin-limit-line,
  .a4-tolerance-zone,
  .a4-page-number-limit-line,
  .a4-page-limit-line,
  .name-card-footer,
  .tool-legal-dialog,
  .mobile-view-tabs,
  .preview-footer-status,
  .development-notice {
    display: none !important;
  }

  /* 彻底破除 mobile-hidden 导致的空白问题 */
  .workspace,
  .workspace.mobile-hidden {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .preview-viewport,
  .zoom-stage,
  .a4-page-wrapper {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    position: static !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
  }

  .a4-page-outer {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: auto !important;
    break-after: auto !important;
  }

  .a4-page {
    width: 210mm !important;
    min-height: 297mm !important;
    height: auto !important;
    position: relative !important;
    margin: 0 auto !important;
    padding: 37mm 26mm 35mm 28mm !important;
    box-shadow: none !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    box-sizing: border-box !important;
    background: #ffffff !important;
    overflow: visible !important;
  }

  .a4-page-outer:last-child .a4-page,
  .a4-page:last-child {
    page-break-after: auto !important;
    break-after: auto !important;
  }
}
