/* ============================================================
   nda-builder.css
   员工保密协议生成器 · 合同纸感 + 双栏实时预览
   主色保密绿 #10B981 + 风险红 #DC2626 + 提示蓝 #2563EB
   Design tokens（深主题覆盖在文末）
   ============================================================ */

.ndab {
  --ndab-primary: #10b981;
  --ndab-primary-deep: #047857;
  --ndab-primary-soft: #d1fae5;
  --ndab-red: #dc2626;
  --ndab-red-soft: #fee2e2;
  --ndab-blue: #2563eb;
  --ndab-blue-soft: #dbeafe;
  --ndab-yellow: #d97706;
  --ndab-yellow-soft: #fef3c7;
  --ndab-gray: #6b7280;
  --ndab-gray-soft: #f3f4f6;
  --ndab-ink: #1f2937;
  --ndab-ink-soft: #6b7280;
  --ndab-line: #e5e7eb;
  --ndab-bg: #fafbfc;
  --ndab-card: #ffffff;
  --ndab-shadow: 0 2px 12px rgba(16, 185, 129, 0.06), 0 1px 3px rgba(16, 185, 129, 0.04);
  --ndab-shadow-lg: 0 20px 40px rgba(16, 185, 129, 0.10), 0 4px 16px rgba(16, 185, 129, 0.06);
  --ndab-radius: 16px;
  --ndab-radius-sm: 10px;
}

.ndab {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px 48px;
  color: var(--ndab-ink);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--ndab-bg);
  font-size: 14.5px;
  line-height: 1.7;
}

.ndab-wrap { position: relative; z-index: 1; }

/* ========== Hero ========== */
.ndab-hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 48px 48px 40px;
  margin-bottom: 28px;
  background:
    radial-gradient(120% 140% at 15% 0%, var(--ndab-primary-soft) 0%, transparent 55%),
    radial-gradient(100% 130% at 85% 100%, var(--ndab-gray-soft) 0%, transparent 58%),
    linear-gradient(180deg, #fff 0%, #fafbfc 100%);
  border: 1px solid var(--ndab-line);
  text-align: center;
}
.ndab-hero::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 0; height: 5px;
  background: linear-gradient(90deg, var(--ndab-primary), var(--ndab-gray), var(--ndab-primary));
  opacity: .9;
}
.ndab-hero-badge {
  display: inline-block;
  padding: 6px 16px;
  font-size: 12px; font-weight: 700;
  color: var(--ndab-primary-deep);
  background: var(--ndab-primary-soft);
  border-radius: 999px;
  margin-bottom: 16px;
  letter-spacing: .5px;
  border: 1px solid rgba(16, 185, 129, 0.15);
}
.ndab-hero h1 {
  font-size: 30px; font-weight: 800;
  color: var(--ndab-primary-deep);
  margin: 0 0 12px;
  letter-spacing: .5px;
}
.ndab-hero h1 i {
  font-style: normal;
  background: linear-gradient(90deg, var(--ndab-primary), var(--ndab-blue));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ndab-hero p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--ndab-ink-soft);
  font-size: 14px;
  line-height: 1.9;
}
.ndab-hero p em {
  font-style: normal;
  font-weight: 700;
  color: var(--ndab-primary);
}
.ndab-hero p em.blue { color: var(--ndab-blue); }
.ndab-hero p em.red { color: var(--ndab-red); }
.ndab-hero p em.green { color: var(--ndab-primary); }
.ndab-hero p em.gray { color: var(--ndab-gray); }

/* ========== 卡片通用 ========== */
.ndab-card {
  background: var(--ndab-card);
  border-radius: var(--ndab-radius);
  box-shadow: var(--ndab-shadow);
  padding: 28px;
  margin-bottom: 24px;
  border: 1px solid var(--ndab-line);
}
.ndab-card h2 {
  font-size: 17px; font-weight: 800;
  color: var(--ndab-primary-deep);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px dashed var(--ndab-line);
  display: flex; align-items: center; gap: 10px;
}
.ndab-card h2 span {
  font-size: 12px; font-weight: 500;
  color: var(--ndab-ink-soft);
  margin-left: auto;
}

/* ========== 双栏布局：左输入 + 右预览（桌面 sticky） ========== */
.ndab-split {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: 28px;
  align-items: start;
}
.ndab-left, .ndab-right { min-width: 0; }
@media (min-width: 901px) {
  .ndab-right {
    position: sticky;
    top: 20px;
    align-self: start;
  }
}

.ndab-sub-section {
  font-size: 13.5px; font-weight: 800;
  color: var(--ndab-primary-deep);
  margin: 22px 0 12px;
  padding-left: 10px;
  border-left: 3px solid var(--ndab-primary);
  display: flex; align-items: center; gap: 8px;
}
.ndab-sub-section:first-child { margin-top: 0; }
.ndab-sub-section .ndab-hint {
  margin-left: 6px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ndab-ink-soft);
}

.ndab-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* ========== 表单 ========== */
.ndab-field { margin-bottom: 14px; }
.ndab-lab {
  display: block;
  font-size: 13px; font-weight: 700;
  color: var(--ndab-ink);
  margin-bottom: 8px;
}
.ndab-lab .ndab-hint {
  font-size: 11.5px; font-weight: 400;
  color: var(--ndab-ink-soft);
  margin-left: 6px;
}
.ndab-input {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid var(--ndab-line);
  border-radius: var(--ndab-radius-sm);
  background: #fff;
  color: var(--ndab-ink);
  transition: border-color .2s, box-shadow .2s, background .2s;
  font-family: inherit;
  box-sizing: border-box;
}
.ndab-input:focus {
  outline: none;
  border-color: var(--ndab-primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.ndab-input::placeholder { color: #9ca3af; }
select.ndab-input {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  cursor: pointer;
}
input[type="number"].ndab-input {
  appearance: textfield;
  -moz-appearance: textfield;
}
input[type="number"].ndab-input::-webkit-outer-spin-button,
input[type="number"].ndab-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.ndab-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.ndab-prefix {
  position: absolute;
  left: 14px;
  color: var(--ndab-ink-soft);
  font-weight: 600;
  font-size: 14px;
  pointer-events: none;
}
.ndab-input-wrap .ndab-input { padding-left: 30px; }
.ndab-suffix {
  margin-left: 8px;
  color: var(--ndab-ink-soft);
  font-size: 13px;
  white-space: nowrap;
}

/* ========== 保密范围卡片（可勾选） ========== */
.ndab-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}
.ndab-check {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--ndab-line);
  border-radius: var(--ndab-radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
  color: var(--ndab-ink);
  box-shadow: 0 1px 2px rgba(16, 185, 129, 0.04);
}
.ndab-check:hover {
  transform: translateY(-1px);
  border-color: var(--ndab-primary);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}
.ndab-check input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.ndab-check::before {
  content: "📄";
  font-size: 16px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ndab-gray-soft);
  border-radius: 8px;
  transition: background .2s;
}
.ndab-check:has(#ndabScopeTech)::before { content: "💻"; }
.ndab-check:has(#ndabScopeBiz)::before { content: "📊"; }
.ndab-check:has(#ndabScopeClient)::before { content: "🤝"; }
.ndab-check:has(#ndabScopeFinance)::before { content: "💰"; }
.ndab-check:has(#ndabScopeSalary)::before { content: "💵"; }
.ndab-check:has(#ndabScopeOther)::before { content: "✏️"; }
.ndab-check span {
  flex: 1;
  line-height: 1.5;
}
.ndab-check::after {
  content: "";
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--ndab-line);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: transparent;
  transition: all .18s;
}
.ndab-check:has(input:checked) {
  border-color: var(--ndab-primary);
  background: linear-gradient(135deg, #f0fdf9 0%, var(--ndab-primary-soft) 100%);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}
.ndab-check:has(input:checked)::before {
  background: var(--ndab-primary-soft);
}
.ndab-check:has(input:checked)::after {
  content: "✓";
  background: var(--ndab-primary);
  border-color: var(--ndab-primary);
  color: #fff;
}
.ndab-check:has(input:checked) span {
  font-weight: 700;
  color: var(--ndab-primary-deep);
}
.ndab-check:has(input:focus-visible) {
  outline: 2px solid var(--ndab-primary);
  outline-offset: 2px;
}

/* ========== 按钮 ========== */
.ndab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
}
.ndab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 700;
  border-radius: var(--ndab-radius-sm);
  border: none;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  white-space: nowrap;
}
.ndab-btn-go {
  background: linear-gradient(135deg, var(--ndab-primary), var(--ndab-primary-deep));
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.ndab-btn-go:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}
.ndab-btn-ghost {
  background: #fff;
  color: var(--ndab-primary);
  border: 1.5px solid var(--ndab-primary-soft);
}
.ndab-btn-ghost:hover {
  background: var(--ndab-primary-soft);
  border-color: var(--ndab-primary);
}

/* ========== 风险提示横幅 ========== */
.ndab-risk-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: var(--ndab-red-soft);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--ndab-red);
  border-radius: var(--ndab-radius-sm);
  color: #991b1b;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.8;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.12);
  margin-bottom: 14px;
  animation: ndabRiskIn .3s ease;
}
.ndab-risk-banner::before {
  content: "⚠️";
  font-size: 16px;
  flex-shrink: 0;
}
.ndab-risk-banner[hidden] { display: none !important; }

@keyframes ndabRiskIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

/* ========== 右栏预览：合同纸感 ========== */
.ndab-preview {
  width: 100%;
  min-height: 520px;
  max-height: 72vh;
  padding: 28px 32px;
  border: 1px solid var(--ndab-line);
  border-radius: 6px;
  background: #fff !important;
  font-size: 13.5px;
  color: var(--ndab-ink);
  line-height: 2.1;
  letter-spacing: .3px;
  font-family: "FangSong", "仿宋", "STFangsong", "Songti SC", "SimSun", serif;
  resize: vertical;
  box-sizing: border-box;
  box-shadow:
    0 1px 2px rgba(31, 41, 55, 0.04),
    0 8px 24px rgba(31, 41, 55, 0.08);
  transition: border-color .2s, box-shadow .2s;
}
.ndab-preview:focus {
  outline: none;
  border-color: var(--ndab-primary);
  box-shadow:
    0 0 0 3px rgba(16, 185, 129, 0.15),
    0 8px 24px rgba(31, 41, 55, 0.08);
}
.ndab-preview::placeholder {
  color: #9ca3af;
  font-family: inherit;
}

/* ========== 条款说明 ========== */
.ndab-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px dashed var(--ndab-line);
}
.ndab-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.ndab-section h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ndab-ink);
  margin: 0 0 16px;
  padding-left: 10px;
  border-left: 3px solid var(--ndab-primary);
}

/* ========== 保密 vs 竞业对比表 ========== */
.ndab-compare-table {
  border: 1px solid var(--ndab-line);
  border-radius: var(--ndab-radius-sm);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--ndab-shadow);
}
.ndab-compare-row {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1.15fr;
  border-bottom: 1px solid var(--ndab-line);
  transition: background .15s;
}
.ndab-compare-row:last-child { border-bottom: none; }
.ndab-compare-row > span {
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.7;
}
.ndab-compare-row > span:first-child {
  font-weight: 700;
  color: var(--ndab-ink);
}
.ndab-compare-head {
  background: var(--ndab-primary-soft);
  color: var(--ndab-primary-deep);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: .3px;
  border-bottom: 1px solid #a7f3d0;
}
.ndab-compare-head > span { color: var(--ndab-primary-deep); }
.ndab-compare-row:not(.ndab-compare-head):nth-of-type(even) {
  background: var(--ndab-gray-soft);
}
.ndab-compare-row:not(.ndab-compare-head):hover > span {
  background: var(--ndab-primary-soft);
}
.ndab-compare-row b {
  color: var(--ndab-red);
  font-weight: 700;
}

/* ========== 违约金风险卡 ========== */
.ndab-risk-card {
  padding: 18px 22px;
  border-radius: var(--ndab-radius-sm);
  background: var(--ndab-red-soft);
  border: 1px solid #fecaca;
  border-left: 4px solid var(--ndab-red);
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.10);
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ndab-ink);
}
.ndab-risk-card b {
  color: #991b1b;
  font-weight: 700;
}

/* ========== 免责声明 ========== */
.ndab-disclaimer {
  padding: 18px 22px;
  border-radius: var(--ndab-radius-sm);
  background: #fffbeb;
  border: 1px solid #fde68a;
  margin-top: 8px;
}
.ndab-disclaimer p {
  font-size: 12.5px;
  color: #78350f;
  margin: 0;
  line-height: 1.8;
}
.ndab-disclaimer b { color: var(--ndab-yellow); }

/* ========== 打印样式 ========== */
@media print {
  .ndab { background: #fff; padding: 0; }
  .ndab-card, .ndab-disclaimer, .ndab-compare-table, .ndab-risk-card {
    box-shadow: none;
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
  .ndab-btn, .ndab-row, .ndab-hero::before { display: none !important; }
  .ndab-right { position: static !important; }
  .ndab-preview {
    min-height: 0;
    max-height: none;
    box-shadow: none;
    border: 1px solid #999;
  }
}

/* ========== 深主题覆盖 ========== */
:root[data-theme="dark"] .ndab,
[data-theme="dark"] .ndab {
  --ndab-ink: #e5e7eb;
  --ndab-ink-soft: #9ca3af;
  --ndab-line: #374151;
  --ndab-bg: #0f172a;
  --ndab-card: #1e293b;
  --ndab-primary-soft: #064e3b;
  --ndab-gray-soft: #1f2937;
  --ndab-red-soft: #450a0a;
  --ndab-blue-soft: #1e3a5f;
  --ndab-yellow-soft: #422006;
  background: var(--ndab-bg);
}
:root[data-theme="dark"] .ndab-hero,
[data-theme="dark"] .ndab-hero {
  background:
    radial-gradient(120% 140% at 15% 0%, rgba(16, 185, 129, 0.15) 0%, transparent 55%),
    radial-gradient(100% 130% at 85% 100%, rgba(107, 114, 128, 0.15) 0%, transparent 58%),
    linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  border-color: #374151;
}
:root[data-theme="dark"] .ndab-hero h1,
[data-theme="dark"] .ndab-hero h1 { color: #34d399; }
:root[data-theme="dark"] .ndab-hero-badge,
[data-theme="dark"] .ndab-hero-badge {
  background: #064e3b;
  color: #34d399;
  border-color: #065f46;
}
:root[data-theme="dark"] .ndab-input,
[data-theme="dark"] .ndab-input {
  background: #0f172a;
  color: #e5e7eb;
  border-color: #374151;
}
:root[data-theme="dark"] select.ndab-input,
[data-theme="dark"] select.ndab-input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}
:root[data-theme="dark"] .ndab-check,
[data-theme="dark"] .ndab-check {
  background: #1f2937;
  border-color: #374151;
  color: #e5e7eb;
}
:root[data-theme="dark"] .ndab-check::before,
[data-theme="dark"] .ndab-check::before { background: #374151; }
:root[data-theme="dark"] .ndab-check::after,
[data-theme="dark"] .ndab-check::after {
  background: #1f2937;
  border-color: #475569;
}
:root[data-theme="dark"] .ndab-check:has(input:checked),
[data-theme="dark"] .ndab-check:has(input:checked) {
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  border-color: var(--ndab-primary);
}
:root[data-theme="dark"] .ndab-check:has(input:checked)::before,
[data-theme="dark"] .ndab-check:has(input:checked)::before { background: #065f46; }
:root[data-theme="dark"] .ndab-check:has(input:checked) span,
[data-theme="dark"] .ndab-check:has(input:checked) span { color: #6ee7b7; }
:root[data-theme="dark"] .ndab-btn-ghost,
[data-theme="dark"] .ndab-btn-ghost {
  background: transparent;
  color: #34d399;
  border-color: #064e3b;
}
:root[data-theme="dark"] .ndab-btn-ghost:hover,
[data-theme="dark"] .ndab-btn-ghost:hover {
  background: #064e3b;
  border-color: var(--ndab-primary);
}
:root[data-theme="dark"] .ndab-risk-banner,
[data-theme="dark"] .ndab-risk-banner {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #fca5a5;
}
:root[data-theme="dark"] .ndab-preview,
[data-theme="dark"] .ndab-preview {
  background: #0f172a !important;
  color: #cbd5e1;
  border-color: #374151;
}
:root[data-theme="dark"] .ndab-compare-table,
[data-theme="dark"] .ndab-compare-table {
  background: #1e293b;
  border-color: #374151;
}
:root[data-theme="dark"] .ndab-compare-head,
[data-theme="dark"] .ndab-compare-head {
  background: #064e3b;
  color: #34d399;
  border-bottom-color: #065f46;
}
:root[data-theme="dark"] .ndab-compare-row,
[data-theme="dark"] .ndab-compare-row { border-color: #374151; }
:root[data-theme="dark"] .ndab-compare-row:not(.ndab-compare-head):nth-of-type(even),
[data-theme="dark"] .ndab-compare-row:not(.ndab-compare-head):nth-of-type(even) {
  background: #1f2937;
}
:root[data-theme="dark"] .ndab-compare-row:not(.ndab-compare-head):hover > span,
[data-theme="dark"] .ndab-compare-row:not(.ndab-compare-head):hover > span {
  background: rgba(16, 185, 129, 0.12);
}
:root[data-theme="dark"] .ndab-compare-row b,
[data-theme="dark"] .ndab-compare-row b { color: #fca5a5; }
:root[data-theme="dark"] .ndab-risk-card,
[data-theme="dark"] .ndab-risk-card {
  background: #450a0a;
  border-color: #7f1d1d;
  color: #e5e7eb;
}
:root[data-theme="dark"] .ndab-risk-card b,
[data-theme="dark"] .ndab-risk-card b { color: #fca5a5; }
:root[data-theme="dark"] .ndab-disclaimer,
[data-theme="dark"] .ndab-disclaimer {
  background: #1a2535;
  border-color: #78350f;
}
:root[data-theme="dark"] .ndab-disclaimer p,
[data-theme="dark"] .ndab-disclaimer p { color: #fbbf24; }
:root[data-theme="dark"] .ndab-sub-section,
[data-theme="dark"] .ndab-sub-section { color: #34d399; }
:root[data-theme="dark"] .ndab-section h3,
[data-theme="dark"] .ndab-section h3 { color: #e5e7eb; }

/* ========== 响应式 ========== */
@media (max-width: 900px) {
  .ndab-split { grid-template-columns: 1fr; }
  .ndab-right { position: static; }
}
@media (max-width: 640px) {
  .ndab { padding: 16px 12px 32px; }
  .ndab-hero { padding: 32px 20px 26px; }
  .ndab-hero h1 { font-size: 22px; }
  .ndab-card { padding: 20px 16px; }
  .ndab-grid-2 { grid-template-columns: 1fr; }
  .ndab-btn { width: 100%; justify-content: center; }
  .ndab-preview {
    min-height: 360px;
    padding: 20px 18px;
    font-size: 13px;
  }
  .ndab-compare-row { grid-template-columns: 1fr; }
  .ndab-compare-head { display: none; }
  .ndab-compare-row > span:first-child {
    background: var(--ndab-primary-soft);
    color: var(--ndab-primary-deep);
    font-weight: 800;
    font-size: 12.5px;
  }
}
