/* ── 业务约定书工作区 (Engagement Agreement Studio) ── */
.engagement-modal-box {
  width: 96vw !important;
  max-width: 1450px !important;
  height: 92vh !important;
  max-height: 92vh !important;
  padding: 1.5rem !important;
  display: flex !important;
  flex-direction: column !important;
  background: #F8FAFC !important;
  border: 1px solid #E2E8F0 !important;
  border-radius: 14px !important;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18) !important;
}

.engagement-workspace {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: transparent;
}

/* 左侧编辑器 (与发票一致的卡片式圆角面板) */
.engagement-editor-pane {
  width: 500px;
  min-width: 380px;
  max-width: 800px;
  flex-shrink: 0;
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-sizing: border-box;
}

/* 中间拖拽杆 (与发票完全一致的胶囊把手) */
.engagement-resizer {
  width: 10px;
  flex-shrink: 0;
  cursor: col-resize;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
  z-index: 10;
  margin: 0 0.35rem;
}
.engagement-resizer::before {
  content: "";
  display: block;
  width: 4px;
  height: 48px;
  border-radius: 2px;
  background: #CBD5E1;
  transition: all 0.15s ease;
}
.engagement-resizer:hover::before,
.engagement-resizer.is-resizing::before {
  background: #0284C7;
  width: 6px;
  height: 72px;
  box-shadow: 0 0 6px rgba(2, 132, 199, 0.4);
}

/* 右侧 A4 预览区 */
.engagement-preview-pane {
  flex: 1;
  min-width: 320px;
  background: #64748B;
  background: radial-gradient(circle, #475569 0%, #334155 100%);
  border-radius: 10px;
  padding: 1.5rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
}

.engagement-paper-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  transform-origin: top center;
  transition: transform 0.05s ease-out;
}

.engagement-paper {
  width: 794px; /* A4 standard 96dpi */
  min-width: 794px;
  max-width: 794px;
  min-height: 1123px;
  background: #FFFFFF;
  border-radius: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  padding: 46px 54px;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0F172A;
  font-size: 11px;
  line-height: 1.55;
  flex-shrink: 0;
}

/* 纸张内部元素 */
.eng-paper-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 2px solid #0284C7;
}
.eng-paper-header-left {
  flex: 1;
  text-align: left;
}
.eng-paper-header-right {
  text-align: right;
  margin-left: 16px;
}
.eng-paper-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}
.eng-company-title {
  font-size: 16px;
  font-weight: 800;
  color: #0F172A;
  line-height: 1.2;
}
.eng-doc-title {
  font-size: 12.5px;
  font-weight: 700;
  color: #0369A1;
  margin-top: 2px;
}
.eng-doc-sub {
  font-size: 9.5px;
  color: #64748B;
}

.eng-paper-parties {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  padding: 7px 12px;
  margin: 8px 0 12px 0;
  display: flex;
  gap: 20px;
}

.eng-paper-clause-title {
  font-size: 11.5px;
  font-weight: 700;
  color: #0369A1;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* 客户签字栏 */
.eng-signature-box {
  margin-top: 12px;
  padding: 10px 14px;
  background: #F8FAFC;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
}
.eng-sig-line {
  height: 48px;
  border-bottom: 1.5px solid #0F172A;
  margin: 6px 0 6px 0;
}

/* Schedule 1 明显分界线 */
.eng-schedule-divider {
  margin: 18px 0 12px 0;
  height: 3px;
  background: #0284C7;
  border-radius: 2px;
}

/* 条款卡片组件 (左侧编辑) */
.clause-card {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #FFFFFF;
  margin-bottom: 0.65rem;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.clause-card.disabled {
  opacity: 0.55;
  background: #F8FAFC;
}
.clause-card-header {
  padding: 0.6rem 0.85rem;
  background: #F8FAFC;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #E2E8F0;
}
.clause-card-title {
  font-size: 0.84rem;
  font-weight: 700;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Joint Returns (Married Filing Jointly) 专属高亮与配色 */
.clause-card.clause-card-joint {
  border-color: #DDD6FE;
}
.clause-card.clause-card-joint .clause-card-header {
  background: linear-gradient(135deg, #FAF5FF 0%, #EDE9FE 100%);
  border-bottom: 1px solid #DDD6FE;
}
.clause-card.clause-card-joint .clause-card-title {
  color: #6D28D9;
}
.clause-card.clause-card-joint .eng-toggle input:checked + .eng-toggle-slider {
  background-color: #7C3AED;
}
.clause-card.clause-card-joint .clause-textarea:focus {
  border-color: #7C3AED;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
.clause-card-body {
  padding: 0.65rem 0.85rem;
}
.clause-textarea {
  width: 100%;
  min-height: 72px;
  padding: 6px 8px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-size: 0.8rem;
  font-family: inherit;
  line-height: 1.45;
  resize: vertical;
  color: #334155;
}
.clause-textarea:focus {
  outline: none;
  border-color: #0284C7;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.12);
}

/* 开关 Toggle */
.eng-toggle {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 20px;
}
.eng-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}
.eng-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CBD5E1;
  transition: .2s;
  border-radius: 20px;
}
.eng-toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
.eng-toggle input:checked + .eng-toggle-slider {
  background-color: #0284C7;
}
.eng-toggle input:checked + .eng-toggle-slider:before {
  transform: translateX(18px);
}

/* Schedule 1 项目行 */
.eng-item-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed #E2E8F0;
}
.eng-item-del-btn {
  background: transparent;
  border: none;
  color: #94A3B8;
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 5px;
  border-radius: 4px;
}
.eng-item-del-btn:hover {
  color: #DC2626;
  background: #FEE2E2;
}

/* 添加服务收费项专属按钮 */
.eng-btn-add-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: #EFF6FF;
  color: #0284C7;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.4;
  box-sizing: border-box;
}
.eng-btn-add-item:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #0369A1;
}

/* ── 业务约定书模版管理弹窗 (Engagement Template Modal) ── */
.engagement-tpl-modal-box {
  width: 90vw !important;
  max-width: 980px !important;
  max-height: 90vh !important;
  height: 90vh !important;
  display: flex !important;
  flex-direction: column !important;
  background: #FFFFFF !important;
  border-radius: 12px !important;
  padding: 1.5rem !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.35) !important;
  z-index: 1060 !important;
}

.engagement-tpl-modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 6px;
}

.eng-tpl-setting-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 1rem 1.2rem;
}

.eng-tpl-setting-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.eng-tpl-clauses-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.eng-tpl-clause-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.eng-tpl-clause-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.eng-tpl-clause-card.disabled {
  opacity: 0.65;
  background: #F8FAFC;
}

.eng-tpl-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  gap: 10px;
}

.eng-tpl-card-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.eng-tpl-card-num {
  font-size: 0.82rem;
  font-weight: 700;
  color: #0284C7;
  background: #E0F2FE;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}

.eng-tpl-card-title-input {
  flex: 1;
  font-weight: 600;
  font-size: 0.88rem;
  color: #0F172A;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  padding: 5px 8px;
  border-radius: 5px;
  transition: all 0.15s ease;
}

.eng-tpl-card-title-input:focus {
  border-color: #0284C7;
  background: #FFFFFF;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.eng-tpl-placeholder-badge {
  font-size: 0.72rem;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FDE68A;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.eng-tpl-card-textarea {
  width: 100%;
  min-height: 85px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, monospace;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #334155;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  padding: 8px 10px;
  box-sizing: border-box;
  resize: vertical;
  background: #FFFFFF;
}

.eng-tpl-card-textarea:focus {
  border-color: #0284C7;
  outline: none;
  box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.15);
}

.engagement-tpl-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.85rem;
  border-top: 1px solid #E2E8F0;
  margin-top: 0.85rem;
  flex-shrink: 0;
}

/* 移除数值输入框的上下微调箭头，支持直接输入纯数字与小数 */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
  margin: 0 !important;
}
input[type=number] {
  -moz-appearance: textfield !important;
}

/* 保存后状态（红底白字） */
.btn-inv-save.is-saved {
  background: #DC2626 !important;
  color: #FFFFFF !important;
  border-color: #DC2626 !important;
}
.btn-inv-save.is-saved:hover {
  background: #B91C1C !important;
  border-color: #B91C1C !important;
}

