/* =====================================================================
 * 工具 13 · 反式脂肪自查 —— 独立视觉「配料表扫描台」
 * 母题：深色扫描舱 + 撕齿小票纸 + 风险分级仪表。
 * 与其它工具完全不同：整块深色首屏、小票锯齿边、命中词高亮卡。
 * ===================================================================== */
.fl9.tf {
    --tf-panel: #17223a;
    --tf-panel2: #1f2d49;
    --tf-panel-line: #37456a;
    --tf-paper: #fffdf6;
    --tf-paper2: #f5f1e6;
    --tf-paper-ink: #2b2a26;
    --tf-amber: #d9772b;
    --tf-amber2: #a45613;
    --tf-ambersoft: #fff1dd;
    --tf-red: #c03a4d;
    --tf-redsoft: #ffe9ec;
}
:root[data-theme="dark"] .fl9.tf {
    --tf-panel: #0e1626;
    --tf-panel2: #172238;
    --tf-panel-line: #2b3c5c;
    --tf-paper: #151f31;
    --tf-paper2: #1b283e;
    --tf-paper-ink: #e4e9f5;
    --tf-amber: #f0ad63;
    --tf-amber2: #f5c58c;
    --tf-ambersoft: #3a2c1c;
    --tf-red: #ff8b9c;
    --tf-redsoft: #3b2029;
}

/* ---------- 首屏：深色扫描舱 ---------- */
.tf-scan {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .95fr);
    gap: 0;
    border-radius: 20px;
    overflow: hidden;
    background:
        radial-gradient(600px 300px at 0% 0%, rgba(217, 119, 43, .16), transparent 65%),
        var(--tf-panel);
    border: 1px solid var(--tf-panel-line);
    box-shadow: var(--fl-sh2);
    color: #eef3ff;
    margin-top: 6px;
}
.tf-scan-copy { padding: 32px 30px 30px; position: relative; }
.tf-scan-copy::after {
    content: ""; position: absolute; left: 30px; right: 30px; top: 0; height: 1px;
    background: linear-gradient(90deg, transparent, var(--tf-amber), transparent);
    opacity: .7;
}
.tf-scan-copy .fl9-kicker { color: #ffc38a; }
.tf-scan-copy h1 { margin: 14px 0 16px; color: #fff; font-size: clamp(31px, 4vw, 44px); }
.tf-scan-copy .fl9-lede { color: #cbd6ec; }
.tf-scan-copy .fl9-lede b, .tf-scan-copy b { color: #ffc38a; }
.tf-scan-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 26px; }
.tf-scan-tags .fl9-tag { background: rgba(255, 255, 255, .06); border-color: var(--tf-panel-line); color: #dbe4f7; }
.tf-scan-tags .fl9-tag-warn { background: rgba(217, 119, 43, .18); border-color: var(--tf-amber); color: #ffc38a; }
.tf-scan-tags .fl9-tag-info { background: rgba(120, 170, 255, .12); border-color: #6f94d6; color: #bcd2ff; }
.tf-scan-foot {
    border-left: 3px solid var(--tf-amber);
    padding: 10px 14px;
    background: rgba(255, 255, 255, .045);
    border-radius: 0 8px 8px 0;
    font-size: 12.5px;
    line-height: 1.85;
    color: #cbd6ec;
}

/* ---------- 小票纸 ---------- */
.tf-receipt {
    margin: 22px 22px 0 0;
    background: var(--tf-paper);
    color: var(--tf-paper-ink);
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -2px 24px rgba(0, 0, 0, .18);
    position: relative;
    align-self: stretch;
}
.tf-receipt::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: repeating-linear-gradient(90deg, transparent 0 8px, rgba(217, 119, 43, .25) 8px 16px);
}
.tf-receipt-hd {
    display: flex; justify-content: space-between; gap: 10px;
    padding: 15px 20px 11px; border-bottom: 1px dashed rgba(140, 130, 110, .5);
    font-family: var(--fl-mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--tf-amber2);
}
.tf-receipt-body { padding: 16px 20px 20px; }
.tf-receipt .fl9-field > span { color: #6b675e; }
:root[data-theme="dark"] .tf-receipt .fl9-field > span { color: var(--fl-muted); }
.tf-receipt textarea { background: var(--tf-paper2) !important; border-color: rgba(140, 130, 110, .45) !important; color: var(--tf-paper-ink) !important; font-family: var(--fl-mono); }
.tf-receipt input { background: var(--tf-paper2) !important; border-color: rgba(140, 130, 110, .45) !important; color: var(--tf-paper-ink) !important; }
.tf-receipt .fl9-btn { border-color: rgba(140, 130, 110, .5); background: transparent; color: var(--tf-paper-ink); }
.tf-receipt .fl9-btn:hover { border-color: var(--tf-amber2); color: var(--tf-amber2); }
.tf-receipt .fl9-btn-hot { background: var(--tf-amber); border-color: var(--tf-amber); color: #fff; }
:root[data-theme="dark"] .tf-receipt .fl9-btn-hot { color: #231206; }
.tf-label-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.tf-label-grid input { font-family: var(--fl-mono); font-size: 13px; }
.tf-receipt-zig {
    height: 12px;
    background: var(--tf-paper);
    -webkit-mask-image: linear-gradient(45deg, transparent 50%, #000 50%), linear-gradient(-45deg, transparent 50%, #000 50%);
    mask-image: linear-gradient(45deg, transparent 50%, #000 50%), linear-gradient(-45deg, transparent 50%, #000 50%);
    -webkit-mask-size: 14px 14px; mask-size: 14px 14px;
    -webkit-mask-position: 0 0; mask-position: 0 0;
    -webkit-mask-repeat: repeat-x; mask-repeat: repeat-x;
    position: absolute; left: 0; right: 0; bottom: -11px;
}

/* ---------- 结果：仪表 ---------- */
.fl9.tf #tfResult { margin-top: 40px; }
.tf-top { display: grid; grid-template-columns: minmax(280px, .78fr) minmax(0, 1.22fr); gap: 14px; align-items: stretch; }
.tf-gauge-card { display: flex; align-items: center; gap: 16px; padding: 16px 18px; background: var(--fl-card); border: 1px solid var(--fl-line); border-radius: var(--fl-r); box-shadow: var(--fl-sh); }
.tf-gauge {
    flex: 0 0 104px; width: 104px; height: 104px; border-radius: 50%;
    display: grid; place-content: center; text-align: center;
    background: conic-gradient(var(--tf-amber) 0deg 0deg, var(--fl-card2) 0deg 360deg);
    position: relative;
}
.tf-gauge::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: var(--fl-card); }
.tf-gauge > * { position: relative; z-index: 1; }
.tf-gauge span { display: block; font-family: var(--fl-mono); font-size: 20px; font-weight: 700; color: var(--tf-amber2); }
.tf-gauge small { display: block; font-size: 10.5px; color: var(--fl-muted); }
.tf-gauge-side h3 { color: var(--fl-ink); margin-bottom: 6px; }
.tf-gauge-side p { font-size: 12.5px; line-height: 1.8; color: var(--fl-ink2); margin: 0; }
.fl9.tf .fl9-kpis { align-content: center; }
.fl9.tf .fl9-kpi { border-left: 3px solid var(--tf-amber2); }
.fl9.tf .fl9-kpi .v { color: var(--tf-amber2); }
.fl9.tf .fl9-kpi.is-red { border-left-color: var(--tf-red); }
.fl9.tf .fl9-kpi.is-red .v { color: var(--tf-red); }

.tf-cols { margin-top: 14px; }
.tf-highlight { font-family: var(--fl-mono); font-size: 13px; line-height: 2.1; color: var(--fl-ink2); word-break: break-all; background: var(--fl-card2); border: 1px solid var(--fl-line); border-radius: 9px; padding: 12px 14px; max-height: 210px; overflow: auto; }
.tf-highlight mark { padding: 1px 4px; border-radius: 3px; font-weight: 700; }
.tf-highlight mark.lv-high { background: var(--tf-redsoft); color: var(--tf-red); border-bottom: 2px solid var(--tf-red); }
.tf-highlight mark.lv-mid { background: var(--tf-ambersoft); color: var(--tf-amber2); border-bottom: 2px solid var(--tf-amber); }
.tf-highlight mark.lv-label { background: var(--fl-infobg); color: var(--fl-info); border-bottom: 2px solid var(--fl-info); }
.tf-check-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--fl-line); font-size: 13px; }
.tf-check-row:last-child { border-bottom: 0; }
.tf-check-row span:last-child { font-family: var(--fl-mono); font-weight: 700; color: var(--tf-amber2); }

.tf-hits-panel { margin-top: 14px; }
.tf-hit { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--fl-line); }
.tf-hit:last-child { border-bottom: 0; }
.tf-hit-name { font-weight: 750; color: var(--fl-ink); }
.tf-hit-name small { display: block; font-weight: 500; font-size: 11px; color: var(--fl-muted); }
.tf-hit-body { font-size: 13px; line-height: 1.8; color: var(--fl-ink2); }
.tf-hit-body b { color: var(--tf-amber2); }
.tf-empty { padding: 12px; border: 1px dashed var(--fl-line2); border-radius: 9px; color: var(--fl-muted); font-size: 13px; }

/* ---------- 词库 / 批量 ---------- */
.tf-lex-filter, .tf-clean { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; padding: 11px 13px; border: 1px dashed var(--fl-line2); border-radius: 10px; background: var(--fl-card2); font-size: 12.5px; }
.tf-clean { margin: 14px 0 0; }
.tf-clean > b { color: var(--tf-amber2); }
.tf-clean code { margin-left: auto; max-width: 100%; overflow-wrap: anywhere; }
.fl9.tf .fl9-scroll th { color: var(--tf-amber2); }
.fl9.tf #tfBatchWrap { margin-top: 14px; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
    .tf-scan { grid-template-columns: 1fr; }
    .tf-receipt { margin: 0 22px 22px; }
    .tf-receipt-zig { display: none; }
    .tf-top { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .tf-scan-copy { padding: 24px 18px; }
    .tf-receipt { margin: 0 12px 16px; }
    .tf-receipt-body { padding: 14px; }
    .tf-label-grid { grid-template-columns: 1fr; }
    .tf-hit { grid-template-columns: 1fr; gap: 4px; }
    .tf-clean code { margin-left: 0; width: 100%; }
}
