/* 企业邮件签名生成器 - TWC 风格作用域样式（#esg-app 内生效，不污染全站） */

/* ---------- 布局：左内容 / 中预览 / 右外观，三栏 ---------- */
#esg-app {
  grid-template-columns: 400px minmax(0, 1fr) 300px;
}
#esg-app > .esg-panel--preview,
#esg-app > .esg-panel--settings {
  position: sticky;
  top: 88px; /* 避开 72px 粘性顶栏 + 16px 间距 */
}

/* ---------- 折叠分组 ---------- */
#esg-app .esg-group {
  border: var(--twc-border);
  border-radius: var(--twc-radius-md);
  background: var(--twc-surface);
  margin-bottom: 12px;
  overflow: hidden;
}
#esg-app .esg-group__head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--twc-text-sm);
  font-weight: 600;
  color: var(--twc-ink);
  font-family: inherit;
}
#esg-app .esg-group__head:hover { background: var(--twc-bg); }
#esg-app .esg-group__chev {
  flex-shrink: 0;
  color: var(--twc-faint);
  transition: transform 0.2s var(--twc-ease);
}
#esg-app .esg-group[data-open="0"] .esg-group__chev { transform: rotate(-90deg); }
#esg-app .esg-group__body { padding: 2px 14px 14px; }
#esg-app .esg-group[data-open="0"] .esg-group__body { display: none; }
#esg-app .esg-group__body .twc-wb-row:first-child { margin-top: 4px; }
#esg-app .esg-group__body > .twc-wb-field { margin-top: 12px; }
#esg-app .esg-group__body > .twc-wb-field:first-child { margin-top: 4px; }

/* ---------- 行内小字 / 必填 ---------- */
#esg-app .esg-hint {
  font-size: var(--twc-text-xs);
  color: var(--twc-muted);
  line-height: 1.5;
}
#esg-app .esg-req {
  font-style: normal;
  font-weight: 600;
  font-size: 11px;
  color: #d93025;
}
#esg-app .esg-inline {
  display: flex;
  align-items: center;
  gap: 8px;
}
#esg-app .esg-inline .twc-input { flex: 1; min-width: 0; }
#esg-app .esg-color {
  width: 44px;
  height: 36px;
  padding: 3px;
  border: var(--twc-border);
  border-radius: var(--twc-radius-sm);
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- 预览区页签 ---------- */
#esg-app .esg-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
#esg-app .esg-tab {
  padding: 6px 14px;
  border-radius: var(--twc-radius-full);
  border: var(--twc-border);
  background: var(--twc-surface);
  font-size: var(--twc-text-sm);
  font-weight: 600;
  color: var(--twc-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s var(--twc-ease);
}
#esg-app .esg-tab:hover { border-color: var(--twc-faint); color: var(--twc-ink); }
#esg-app .esg-tab.is-active {
  background: var(--twc-ink);
  border-color: var(--twc-ink);
  color: #fff;
}

/* ---------- 签名预览 ---------- */
#esg-app .esg-preview {
  border: var(--twc-border);
  border-radius: var(--twc-radius-md);
  background: #fff;
  padding: 20px;
  max-height: 660px;
  overflow: auto;
  transition: background 0.2s;
}
#esg-app .esg-preview.is-dark { background: #1a202c; }

/* ---------- HTML 源码 ---------- */
#esg-app .esg-code {
  border: var(--twc-border);
  border-radius: var(--twc-radius-md);
  background: #1e293b;
  color: #e2e8f0;
  padding: 16px;
  font-family: var(--twc-font-mono);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 660px;
  overflow: auto;
  margin: 0;
}

/* ---------- 窄屏 ---------- */
@media (min-width: 1401px) {
  #esg-app > .twc-panel { min-height: 650px; }
}
@media (max-width: 1400px) {
  #esg-app { grid-template-columns: 1fr; }
  #esg-app > .esg-panel--preview,
  #esg-app > .esg-panel--settings { position: static; }
  #esg-app .esg-preview,
  #esg-app .esg-code { max-height: 480px; }
}
