/* ===== 检查表单（checklist）· 安小助第 16 应用 · 深度重构版 ===== */

/* —— 页面主题：安全检查用「青绿」主调，报告随类别着色 —— */
.ck-page {
  --tool-accent: #12a150;
  --tone-main: #12a150;
  --tone-sub: #0d7f3e;
  --ck-a: #0f5132;
  --ck-ink: #16233b;
  --ck-mut: #7a8798;
  --ck-line: #e8edf3;
  --ck-soft: #f6f8fb;
}

/* 顶栏 hero 渐变（对应 toolHero tone:'checklist'） */
.tool-hero.is-checklist {
  --tool-hero: linear-gradient(128deg, #0b3d2e 0%, #0f7a4d 45%, #12b06b 100%);
  --tool-shadow: 0 10px 24px -12px rgba(15, 122, 77, .55);
}
.tool-hero.is-checklist .tool-hero-pretitle { color: #d7f5e5; }
.tool-hero.is-checklist .tool-hero-title   { color: #fff; }
.tool-hero.is-checklist .tool-hero-sub     { color: #b9ead1; }
.tool-hero.is-checklist .tool-hero-badge   { color: #0b3d2e; background: #d7f5e5; }
.tool-hero.is-checklist .tool-hero-ico {
  color: #0b3d2e; background: linear-gradient(135deg, #d7f5e5, #9be8c3);
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .35);
}

/* —— 表单卡片 —— */
.ck-form-card { position: relative; }
/* 检查表单示例文字（placeholder）适当调小 */
.ck-form-card input::placeholder,
.ck-form-card textarea::placeholder {
  font-size: 11px;
  opacity: .78;
  letter-spacing: 0;
}
.ck-form-card .ck-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ck-form-card .ck-chip {
  padding: 8px 16px; border-radius: 999px; border: 1px solid #dce4ee;
  background: #fff; color: #56637a; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .18s ease; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 1px 2px rgba(16, 42, 67, .04);
}
.ck-form-card .ck-chip:hover { border-color: #a8d8bd; color: var(--tone-main); transform: translateY(-1px); }
.ck-form-card .ck-chip.is-active {
  color: #fff; border-color: transparent;
  background: linear-gradient(135deg, var(--tone-main), var(--tone-sub));
  box-shadow: 0 6px 14px -5px rgba(18, 161, 80, .55);
}
.ck-form-card .ck-chip.is-active::before { content: '✓ '; font-weight: 800; }
.ck-form-card .ck-count {
  font-size: 12px; color: #93a1b0; margin-left: auto; align-self: center;
}

/* 文本域/输入聚焦统一走设计系统，这里微调占位与范围条 */
.ck-form-card textarea,
.ck-form-card input[type="range"] { accent-color: var(--tool-accent); }
.ck-form-card .ck-hint {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 12px; color: #8391a4; margin-top: 8px; line-height: 1.6;
}
.ck-form-card .ck-hint svg { flex: none; width: 14px; height: 14px; margin-top: 2px; color: var(--tone-main); }

/* —— 动作区 —— */
.ck-actions { display: flex; gap: 10px; }
.ck-actions .btn { flex: 1; }
.ck-actions .btn-primary {
  color: #fff; border: none;
  background: linear-gradient(135deg, var(--tone-main), var(--tone-sub));
  box-shadow: 0 8px 18px -6px rgba(18, 161, 80, .6);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s;
}
.ck-actions .btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 10px 22px -6px rgba(18, 161, 80, .7); }
.ck-actions .btn-primary:disabled { opacity: .55; box-shadow: none; }
.ck-actions .btn-ghost {
  color: var(--tone-main); border: 1px solid var(--tone-main);
  background: #fff;
}

/* —— 报头上方操作条（打印/下载/重新生成）—— */
.ck-report-headbar { display: flex; align-items: center; gap: 8px; padding: 4px 0 14px; }
.ck-report-headbar h3 { font-size: 16px; font-weight: 800; color: var(--ck-ink); display: flex; align-items: center; gap: 8px; }
.ck-report-headbar .edit-hint { font-size: 12px; font-weight: 500; color: #a2adbc; }
.ck-report-headbar .ck-ops { display: flex; gap: 8px; margin-left: auto; }
.ck-report-headbar .ck-ops .btn {
  padding: 7px 12px; font-size: 13px; border-radius: 10px;
}
.ck-report-headbar .ck-ops .btn-primary {
  background: linear-gradient(135deg, var(--tone-main), var(--tone-sub));
  box-shadow: 0 6px 14px -6px rgba(18, 161, 80, .55);
}
.ck-ops-mobile { display: flex; gap: 10px; margin-top: 16px; }
.ck-ops-mobile .btn { flex: 1; }
.ck-ops-mobile .btn-primary {
  background: linear-gradient(135deg, var(--tone-main), var(--tone-sub));
  box-shadow: 0 8px 18px -6px rgba(18, 161, 80, .55);
}
.ck-reinput { margin-left: 8px; color: var(--tone-main); font-size: 13px; }

/* —— 报告主体 —— */
.ck-report { display: flex; flex-direction: column; gap: 14px; }

/* 封面式报告头 */
.ck-report-head {
  position: relative; overflow: hidden;
  border-radius: 18px; padding: 20px 20px 18px; color: #fff;
  box-shadow: 0 14px 30px -14px rgba(15, 78, 52, .6);
}
.ck-report-head::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(120% 90% at 100% -10%, rgba(255, 255, 255, .22) 0%, transparent 46%),
    linear-gradient(180deg, rgba(255, 255, 255, .10), transparent 40%);
  pointer-events: none;
}
.ck-ring { position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); pointer-events: none; }
.ck-ring-a { width: 150px; height: 150px; right: -42px; top: -52px; }
.ck-ring-b { width: 92px; height: 92px; right: 18px; bottom: -38px; border-color: rgba(255, 255, 255, .18); }
.ck-rh-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; }
.ck-rh-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  color: rgba(255, 255, 255, .95); background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .32); border-radius: 999px; padding: 4px 12px;
  backdrop-filter: blur(4px);
}
.ck-rh-badge::before { content: '📋'; font-size: 11px; }
.ck-rh-date { font-size: 12px; color: rgba(255, 255, 255, .75); font-variant-numeric: tabular-nums; }
.ck-rh-title {
  position: relative; z-index: 1;
  font-size: 22px; font-weight: 800; letter-spacing: .5px;
  margin-top: 14px; line-height: 1.35; text-shadow: 0 1px 8px rgba(0, 0, 0, .12);
  padding-right: 64px;
}
.ck-rh-meta { position: relative; z-index: 1; margin-top: 6px; font-size: 12px; color: rgba(255, 255, 255, .78); }
.ck-rh-count {
  position: absolute; z-index: 1; right: 18px; bottom: 16px;
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12px; color: rgba(255, 255, 255, .85);
}
.ck-rh-count b { font-size: 34px; font-weight: 900; line-height: 1; letter-spacing: -.5px; }
.ck-rh-count span { font-size: 11px; opacity: .85; }

/* 三分统计栏 */
.ck-trench {
  display: flex; align-items: center;
  background: #fff; border: 1px solid var(--ck-line); border-radius: 16px;
  padding: 14px 8px; box-shadow: 0 6px 16px -12px rgba(16, 42, 67, .18);
}
.ck-stat { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.ck-stat-num { font-size: 24px; font-weight: 900; line-height: 1; color: var(--ck-ink); font-variant-numeric: tabular-nums; }
.ck-stat-num.is-ok { color: #12a150; }
.ck-stat-num.is-ng { color: #e34f3f; }
.ck-stat-label { font-size: 11px; color: var(--ck-mut); letter-spacing: .5px; }
.ck-divider { width: 1px; height: 30px; background: var(--ck-line); }

/* —— 手机端：勾选卡片 —— */
.ck-blocks { display: none; grid-template-columns: 1fr; gap: 10px; }
.ck-card {
  display: flex; gap: 12px;
  background: #fff; border: 1px solid var(--ck-line); border-radius: 16px;
  padding: 13px 14px; box-shadow: 0 4px 14px -12px rgba(16, 42, 67, .2);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ck-card:active { transform: scale(.995); }
.ck-card-no {
  flex: none; width: 32px; height: 32px; border-radius: 10px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 800; margin-top: 2px;
  box-shadow: 0 4px 10px -3px rgba(0, 0, 0, .25);
}
.ck-card-main { flex: 1; min-width: 0; }
.ck-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ck-card-cat {
  font-size: 11px; padding: 2.5px 9px; border-radius: 999px;
  font-weight: 700; letter-spacing: .3px;
}
.ck-card-result {
  font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px;
  color: #7a8798; background: #f1f4f8; border: 1px solid transparent;
  cursor: pointer; transition: all .15s ease; -webkit-tap-highlight-color: transparent;
}
.ck-card-result:hover { border-color: #c6d3e2; }
.ck-card-result.ok { color: #0d7f3e; background: #e6f6ed; }
.ck-card-result.ng { color: #c0392b; background: #fdeaea; }
.ck-card-item { margin-top: 7px; font-size: 14px; font-weight: 650; color: var(--ck-ink); line-height: 1.5; }
.ck-card-basis {
  margin-top: 7px; font-size: 12px; color: var(--ck-mut); line-height: 1.55;
  padding-left: 9px; border-left: 3px solid #dbe3ed; display: flex; flex-direction: column; gap: 1px;
}
.ck-card-basis b { color: #a2adbc; font-weight: 700; font-size: 11px; letter-spacing: .4px; }

/* —— 电脑端：可编辑宽表 —— */
.ck-table-wrap {
  display: none; overflow-x: auto;
  background: #fff; border: 1px solid var(--ck-line); border-radius: 16px;
  box-shadow: 0 6px 16px -12px rgba(16, 42, 67, .18);
}
.ck-table-edit { width: 100%; border-collapse: collapse; min-width: 720px; }
.ck-table-edit thead th {
  text-align: left; font-size: 12px; font-weight: 700; color: #fff;
  padding: 11px 12px; background: linear-gradient(135deg, var(--tone-main), var(--tone-sub));
  border-bottom: none; letter-spacing: .4px; white-space: nowrap;
}
.ck-table-edit thead th:first-child { border-top-left-radius: 16px; }
.ck-table-edit thead th:last-child { border-top-right-radius: 16px; }
.ck-table-edit tbody tr { transition: background .14s ease; }
.ck-table-edit tbody tr:nth-child(even) { background: #fafcfe; }
.ck-table-edit tbody tr:hover { background: #f0faf4; }
.ck-table-edit tbody tr:last-child td { border-bottom: none; }
.ck-table-edit td {
  padding: 10px 12px; font-size: 13px; color: #2d3748;
  border-bottom: 1px solid #f0f3f7; vertical-align: top; line-height: 1.55;
}
.ck-table-edit .ck-tb-no { color: #a2adbc; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.ck-table-edit .ck-tb-item { font-weight: 600; color: var(--ck-ink); }
.ck-table-edit .ck-tb-cat { color: var(--tone-main); font-weight: 700; font-size: 12px; white-space: nowrap; }
.ck-table-edit .ck-tb-basis { color: #6b7787; font-size: 12px; }
.ck-table-edit [contenteditable="true"] {
  border-radius: 6px; padding: 2px 4px; margin: -2px -4px;
  transition: background .15s ease, box-shadow .15s ease;
  outline: none; cursor: text;
}
.ck-table-edit [contenteditable="true"]:hover { background: #f1f6f4; }
.ck-table-edit [contenteditable="true"]:focus { background: #fff; box-shadow: 0 0 0 2px rgba(18, 161, 80, .25); }

/* 结果下拉（桌面表格） */
.ck-table-edit .ck-tb-lv select {
  border: 1px solid #e2e8f0; border-radius: 999px; padding: 4px 10px; font-size: 12px;
  font-weight: 600; color: #7a8798; background: #f5f7fa url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='6'%3E%3Cpath d='M1 1l3 3 3-3' stroke='%237a8798' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 9px center;
  appearance: none; cursor: pointer; transition: all .15s ease; padding-right: 26px;
}
.ck-table-edit .ck-tb-lv select:focus { outline: none; border-color: var(--tool-accent); box-shadow: 0 0 0 3px rgba(18, 161, 80, .14); }
.ck-table-edit .ck-tb-lv select[data-cur="符合"] { color: #0d7f3e; background-color: #e6f6ed; border-color: #c3e8d2; }
.ck-table-edit .ck-tb-lv select[data-cur="不符合"] { color: #c0392b; background-color: #fdeaea; border-color: #f5cdc8; }
.ck-tb-reason { color: #c0392b; font-size: 12.5px; }
.ck-tb-reason[contenteditable="true"]:empty::before { content: '填写存在问题…'; color: #c4ceda; }

/* 窄屏：卡片模式 */
@media (max-width: 720px) {
  .ck-blocks { display: grid; }
  .ck-table-wrap { display: none; }
}
/* 宽屏：表格模式 */
@media (min-width: 721px) {
  .ck-blocks { display: none; }
  .ck-table-wrap { display: block; }
}

/* —— 历史记录 —— */
.ck-history .ck-rec {
  display: flex; align-items: center; gap: 12px; background: #fff;
  border: 1px solid var(--ck-line); border-radius: 16px; padding: 13px 14px;
  box-shadow: 0 4px 14px -12px rgba(16, 42, 67, .2);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.ck-history .ck-rec:hover { border-color: #b9e0c9; box-shadow: 0 8px 20px -12px rgba(18, 161, 80, .35); transform: translateY(-1px); }
.ck-history .ck-rec-main { flex: 1; min-width: 0; cursor: pointer; }
.ck-history .ck-rec-cat {
  font-size: 11px; font-weight: 700; padding: 2.5px 10px; border-radius: 999px;
  color: var(--tone-main); background: #e6f6ed; display: inline-block; letter-spacing: .3px;
}
.ck-history .ck-rec-name {
  margin-top: 6px; font-size: 15px; font-weight: 750; color: var(--ck-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ck-history .ck-rec-meta { margin-top: 3px; font-size: 12px; color: var(--ck-mut); }
.ck-history .ck-rec-ops { display: flex; gap: 8px; }
.ck-history .ck-rec-ops button {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; color: #64748b; background: #f8fafc; border: 1px solid var(--ck-line);
  cursor: pointer; transition: all .15s; padding: 0;
}
.ck-history .ck-rec-ops svg { width: 15px; height: 15px; display: block; }
.ck-history .ck-rec-ops button:hover { color: var(--tone-main); border-color: var(--tone-main); background: #eefaf2; }
.ck-history .ck-rec-ops button[data-action="ck-del"]:hover { color: #dc2626; border-color: #fca5a5; background: #fef2f2; }

/* —— A4 打印版 —— */
.ck-report-block .a4-preview-wrap,
.ck-sheet { font-family: inherit; color: #1a202c; }
.ck-sheet {
  background: #fff; padding: 34px 36px; max-width: 720px; margin: 0 auto;
  border-radius: 2px; box-shadow: 0 2px 14px rgba(0, 0, 0, .06);
}
.ck-sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  border-bottom: 2px solid #1a202c; padding-bottom: 12px; margin-bottom: 14px;
}
.ck-brand { display: flex; gap: 10px; align-items: center; }
.ck-logo {
  width: 34px; height: 34px; border-radius: 9px; background: #0b3d2e; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 800;
}
.ck-en { font-size: 11px; letter-spacing: 1px; color: #6b7787; font-weight: 600; }
.ck-en-org { font-size: 15px; letter-spacing: .5px; color: #0b3d2e; font-weight: 800; }
.ck-sub { font-size: 13px; font-weight: 700; color: #1a202c; margin-top: 2px; }
.ck-issue { text-align: right; font-size: 11px; color: #6b7787; line-height: 1.5; }
.ck-issue b { color: #1a202c; font-weight: 600; }
.ck-title { font-size: 20px; font-weight: 800; text-align: center; margin: 6px 0 10px; letter-spacing: 1px; }
.ck-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #4a5568; margin-bottom: 12px; }
.ck-scope { font-size: 12px; color: #4a5568; margin: -2px 0 12px; }
.ck-scope span { color: #1a202c; font-weight: 600; }
.ck-landscape .ck-scope { font-size: 12px; }
.ck-line { display: inline-block; border-bottom: 1px solid #a0aec0; width: 120px; vertical-align: bottom; }
.ck-table { width: 100%; border-collapse: collapse; }
.ck-table th, .ck-table td { border: 1px solid #cbd5e0; padding: 7px 8px; font-size: 12px; text-align: left; vertical-align: top; }
.ck-table thead th { background: #f1f4f8; font-weight: 700; color: #2d3748; }
.ck-table .ck-tb-no { text-align: center; color: #6b7787; }
.ck-table .ck-tb-empty { text-align: center; }
.ck-table .box { display: inline-flex; gap: 6px; }
.ck-table .box i { font-style: normal; color: #cbd5e0; }
.ck-sign { display: flex; justify-content: space-between; margin-top: 26px; font-size: 12px; color: #4a5568; }
.ck-brandfoot {
  display: flex; justify-content: space-between; margin-top: 18px; padding-top: 10px;
  border-top: 1px solid #e2e8f0; font-size: 10px; color: #a0aec0;
}

/* —— A4 横/竖版 —— */
.ck-sheet.ck-portrait { max-width: 780px; }
.ck-sheet.ck-landscape { max-width: 1120px; }
.ck-sheet.ck-landscape .ck-table { font-size: 12px; }
.ck-sheet.ck-landscape .ck-meta .ck-line { width: 180px; }

/* —— 打印 / 存 PDF：printRoot 可见方案（与 nearmiss/hazard 同款）—— */
@media print {
  @page { size: A4 portrait; margin: 0; }
  /* 页面主体全部不可见，仅打印容器可见 */
  body * { visibility: hidden; }
  body > *:not(#print-root) { display: none !important; }
  #print-root, #print-root * { visibility: visible; }
  #print-root {
    position: absolute; left: 0; top: 0; width: 210mm;
    overflow: hidden; margin: 0; padding: 0;
  }
  /* 手机小视口下 fitPrintCardToPage 的缩放 transform 不得残留到打印 */
  #print-root, #print-root * { transform: none !important; }
  /* 各工具 A4 卡统一限宽到 A4 纸宽（LEC 横版 .a4-sheet 由 lec.css 单独控制，不在此列） */
  #print-root .ck-sheet, #print-root .nm-a4, #print-root .hz-a4,
  #print-root .en-a4, #print-root .mx-a4, #print-root .mx-a4-frame {
    width: 210mm !important; max-width: 210mm !important;
    margin: 0 auto !important; box-shadow: none !important;
  }
  /* 页面壳杂项与结果区内嵌卡片一律隐藏，只打 printRoot 里的 sheet */
  .appbar, .tool-hero, .ck-actions, .ck-report-headbar, .ck-reinput,
  .ck-history, .quota-bar, .ck-report .ck-table-wrap { display: none !important; }
}

/* 检查表单生成加载条（单圈） */
.ck-loading {
  display: flex; align-items: center; gap: 8px;
  margin-top: 14px; padding: 12px 14px; border-radius: 12px;
  background: #f0fdf4; border: 1px solid #dcfce7;
  color: #15803d; font-size: 13px; font-weight: 600;
}
.ck-loading::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid #bbf7d0; border-top-color: #16a34a;
  flex: none; animation: ckSpin .8s linear infinite;
}
@keyframes ckSpin { to { transform: rotate(360deg); } }

/* 检查结果：合格/不合格 同行勾选 */
.ck-tb-result, .ck-tb-lv.ck-tb-result { white-space: nowrap; }
.ck-rb {
  display: inline-flex; align-items: center; gap: 2px;
  border: 0; background: none; padding: 2px 3px; cursor: pointer;
  font-size: 12px; color: #475569; border-radius: 4px; line-height: 1;
}
.ck-tb-result .ck-rb + .ck-rb { margin-left: 6px; }
.ck-rb.on { background: #dcfce7; color: #15803d; font-weight: 600; }
.ck-rb::before { content: ''; width: 11px; height: 11px; border-radius: 3px; border: 1.5px solid #94a3b8; flex: none; box-sizing: border-box; }
.ck-rb.on::before { border-color: #16a34a; background: #16a34a; box-shadow: inset 0 0 0 2px #dcfce7; }
.ck-tb-empty .box i { font-style: normal; }
.ck-sheet .ck-tb-empty .box { gap: 6px; white-space: nowrap; }
