/* ============================================================
   AI 实体识别 — ai_entity_recognition.css
   ============================================================ */

/* ---------- 输入区域 ---------- */
.er-input-area {
    padding: 0;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.08);
    margin-bottom: 24px;
    overflow: hidden;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
    align-items: flex-start;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 7px;
    min-width: 0;
}

.form-group.full-width {
    flex: 1 1 100%;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.required-mark {
    color: #ef4444;
    margin-left: 2px;
}

.char-count {
    font-size: 12px;
    color: #9ca3af;
    text-align: right;
    margin-top: -2px;
    transition: color 0.2s;
}

.char-count.danger {
    color: #ef4444;
    font-weight: 600;
}

/* ---------- 渐变工具栏 / 标题条（参考 SVG 编辑器 .svg-toolbar 设计） ---------- */
.er-section-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 55%, #8b5cf6 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.28);
}

.er-banner-left {
    display: flex;
    align-items: center;
    gap: 11px;
}

.er-banner-icon {
    font-size: 22px;
    line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.18));
}

.er-banner-title {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    letter-spacing: 0.02em;
}

.er-banner-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.76);
    margin-top: 2px;
    font-weight: 400;
}

.er-banner-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    padding: 3px 9px;
    flex-shrink: 0;
}

/* 表单内容区域 */
.er-form-body {
    padding: 20px 20px 8px;
}

/* ---------- 识别模式按鈕 ---------- */
.mode-selector {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.mode-btn {
    padding: 8px 20px;
    border: 2px solid #e5e7eb;
    border-radius: 20px;
    background: #fff;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mode-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.mode-btn.active {
    border-color: #3b82f6;
    color: #fff;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.32);
}

.mode-tip-group {
    justify-content: flex-end;
}

.mode-tip {
    font-size: 12px;
    color: #9ca3af;
    padding: 9px 0;
    line-height: 1.5;
    font-style: italic;
}

/* ---------- 操作按钮行 ---------- */
.actions-group {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.shortcut-hint {
    font-size: 11px;
    opacity: 0.72;
    margin-left: 6px;
}

/* ---------- 实体类型图例 ---------- */
.er-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 12px 16px;
    background: linear-gradient(90deg, #f9fafb 0%, #f5f3ff 100%);
    border: 1px solid #e5e7eb;
    border-left: 3px solid #6366f1;
    border-radius: 10px;
    margin-bottom: 20px;
    animation: er-legend-in 0.35s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes er-legend-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.legend-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    flex-shrink: 0;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #374151;
    font-weight: 500;
    cursor: default;
    white-space: nowrap;
    user-select: none;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ---------- 加载动画 ---------- */
.er-loading {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 28px 24px;
    background: linear-gradient(135deg, #eff6ff 0%, #f5f3ff 100%);
    border: 1.5px solid #dbeafe;
    border-radius: 12px;
    color: #3b82f6;
    font-size: 15px;
    font-weight: 500;
    margin: 8px 0;
}

.loading-spinner {
    width: 26px;
    height: 26px;
    border: 3px solid #dbeafe;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: er-spin 0.75s linear infinite;
    flex-shrink: 0;
}

@keyframes er-spin {
    to { transform: rotate(360deg); }
}

/* 主按钮流光动画 */
@keyframes er-shimmer {
    0%   { background-position: -200% center; }
    100% { background-position: 200% center; }
}

.button.btnShimmer {
    background: linear-gradient(90deg, #3b82f6, #6366f1, #8b5cf6, #3b82f6) !important;
    background-size: 200% auto !important;
    animation: er-shimmer 1.2s linear infinite !important;
    color: #fff !important;
    cursor: not-allowed !important;
    border-color: transparent !important;
}

/* ---------- 结果区域 ---------- */
.er-results {
    margin-top: 6px;
}

/* ---- 识别摘要 ---- */
.er-summary {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    background: linear-gradient(90deg, #fffbeb, #fff7ed);
    border: 1.5px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
    margin-bottom: 16px;
}

.summary-icon {
    font-size: 18px;
    flex-shrink: 0;
    line-height: 1.5;
}

.summary-text {
    font-size: 14px;
    color: #92400e;
    line-height: 1.7;
    font-weight: 500;
}

/* ---- 统计条 ---- */
.er-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1.5px solid;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.stat-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10);
}

.stat-card.active-filter {
    box-shadow: 0 0 0 2.5px currentColor, 0 4px 14px rgba(0, 0, 0, 0.10);
    transform: translateY(-1px);
}

.stat-icon {
    font-size: 15px;
    line-height: 1;
}

.stat-type {
    font-weight: 600;
}

.stat-count {
    font-size: 16px;
    font-weight: 800;
    margin-left: 2px;
}

/* ---- 类型筛选 ---- */
.er-type-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
}

.filter-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    flex-shrink: 0;
}

.filter-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.filter-tag {
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    white-space: nowrap;
}

.filter-tag.active {
    color: #fff !important;
}

.filter-all-btn {
    padding: 4px 14px;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
    border: 1.5px solid #d1d5db;
    background: #fff;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}

.filter-all-btn.active,
.filter-all-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* ---- 高亮文本区域 ---- */
.er-highlight-section {
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 8px 14px;
    background: linear-gradient(90deg, #f5f3ff 0%, #faf5ff 60%, #fff 100%);
    border-radius: 8px;
    border-left: 3px solid #a855f7;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.section-icon {
    font-size: 16px;
}

.section-hint {
    font-size: 12px;
    color: #9ca3af;
    font-style: italic;
}

.er-highlight-text {
    padding: 18px 20px;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    line-height: 2;
    color: #1f2937;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: pre-wrap;
    min-height: 60px;
    max-height: 420px;
    overflow-y: auto;
}

/* 高亮文本区域自定义滚动条 */
.er-highlight-text::-webkit-scrollbar { width: 5px; }
.er-highlight-text::-webkit-scrollbar-track { background: transparent; }
.er-highlight-text::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.er-highlight-text::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* 实体高亮 span */
.entity-mark {
    display: inline;
    border-radius: 4px;
    padding: 1px 3px;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 2px solid;
    position: relative;
    transition: opacity 0.18s ease;
}

.entity-mark:hover {
    opacity: 0.82;
}

.entity-mark[data-filtered="hidden"] {
    background: transparent !important;
    border-bottom-color: transparent !important;
    color: inherit !important;
    font-weight: inherit !important;
    cursor: default;
    pointer-events: none;
}

/* 隐藏状态下不展示 tooltip */
.entity-mark[data-filtered="hidden"]::after {
    display: none !important;
}

/* 实体类型 tooltip */
.entity-mark::after {
    content: attr(data-label);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s;
    z-index: 10;
    margin-bottom: 4px;
}

.entity-mark:hover::after {
    opacity: 1;
}

/* ---- 实体分组列表 ---- */
.er-entity-groups {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

/* 分区标题 */
.er-groups-section-header {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    background: linear-gradient(90deg, #f5f3ff 0%, #faf5ff 60%, #fff 100%);
    border-radius: 8px;
    border-left: 3px solid #a855f7;
}

.entity-group {
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.entity-group:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.07);
}

.entity-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    border-bottom: 1.5px solid #e5e7eb;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.entity-group-header:hover {
    background: rgba(0, 0, 0, 0.02);
}

.group-type-icon {
    font-size: 16px;
    line-height: 1;
}

.group-type-name {
    flex: 1;
}

.group-count-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    color: #fff;
}

.entity-group-body {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
}

.entity-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 18px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid;
    cursor: pointer;
    transition: all 0.18s ease;
    user-select: none;
    white-space: nowrap;
}

.entity-chip:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.chip-text {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- 结果操作栏 ---- */
.er-result-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 16px;
    border-top: 1.5px solid #f3f4f6;
}

.action-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.action-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

/* ---------- 实体类型颜色系统 ---------- */

/* PERSON — 蓝色 */
.dot-person { background-color: #3b82f6; }
.entity-mark[data-type="PERSON"] { background: #dbeafe; color: #1d4ed8; border-bottom-color: #3b82f6; }
.filter-tag[data-type="PERSON"] { background: #eff6ff; color: #1d4ed8; border-color: #93c5fd; }
.filter-tag[data-type="PERSON"].active { background: #3b82f6; border-color: #3b82f6; }
.entity-group[data-type="PERSON"] .entity-group-header { background: linear-gradient(90deg, #eff6ff, #fff); color: #1d4ed8; border-bottom-color: #bfdbfe; }
.entity-group[data-type="PERSON"] .group-count-badge { background: #3b82f6; }
.entity-chip[data-type="PERSON"] { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.stat-card[data-type="PERSON"] { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ORG — 橙色 */
.dot-org { background-color: #f97316; }
.entity-mark[data-type="ORG"] { background: #ffedd5; color: #c2410c; border-bottom-color: #f97316; }
.filter-tag[data-type="ORG"] { background: #fff7ed; color: #c2410c; border-color: #fdba74; }
.filter-tag[data-type="ORG"].active { background: #f97316; border-color: #f97316; }
.entity-group[data-type="ORG"] .entity-group-header { background: linear-gradient(90deg, #fff7ed, #fff); color: #c2410c; border-bottom-color: #fed7aa; }
.entity-group[data-type="ORG"] .group-count-badge { background: #f97316; }
.entity-chip[data-type="ORG"] { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.stat-card[data-type="ORG"] { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }

/* LOC — 绿色 */
.dot-loc { background-color: #22c55e; }
.entity-mark[data-type="LOC"] { background: #dcfce7; color: #15803d; border-bottom-color: #22c55e; }
.filter-tag[data-type="LOC"] { background: #f0fdf4; color: #15803d; border-color: #86efac; }
.filter-tag[data-type="LOC"].active { background: #22c55e; border-color: #22c55e; }
.entity-group[data-type="LOC"] .entity-group-header { background: linear-gradient(90deg, #f0fdf4, #fff); color: #15803d; border-bottom-color: #bbf7d0; }
.entity-group[data-type="LOC"] .group-count-badge { background: #22c55e; }
.entity-chip[data-type="LOC"] { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.stat-card[data-type="LOC"] { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

/* DATE — 紫色 */
.dot-date { background-color: #a855f7; }
.entity-mark[data-type="DATE"] { background: #f3e8ff; color: #7e22ce; border-bottom-color: #a855f7; }
.filter-tag[data-type="DATE"] { background: #faf5ff; color: #7e22ce; border-color: #d8b4fe; }
.filter-tag[data-type="DATE"].active { background: #a855f7; border-color: #a855f7; }
.entity-group[data-type="DATE"] .entity-group-header { background: linear-gradient(90deg, #faf5ff, #fff); color: #7e22ce; border-bottom-color: #e9d5ff; }
.entity-group[data-type="DATE"] .group-count-badge { background: #a855f7; }
.entity-chip[data-type="DATE"] { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }
.stat-card[data-type="DATE"] { background: #faf5ff; color: #7e22ce; border-color: #e9d5ff; }

/* PRODUCT — 红色 */
.dot-product { background-color: #ef4444; }
.entity-mark[data-type="PRODUCT"] { background: #fee2e2; color: #b91c1c; border-bottom-color: #ef4444; }
.filter-tag[data-type="PRODUCT"] { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.filter-tag[data-type="PRODUCT"].active { background: #ef4444; border-color: #ef4444; }
.entity-group[data-type="PRODUCT"] .entity-group-header { background: linear-gradient(90deg, #fef2f2, #fff); color: #b91c1c; border-bottom-color: #fecaca; }
.entity-group[data-type="PRODUCT"] .group-count-badge { background: #ef4444; }
.entity-chip[data-type="PRODUCT"] { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.stat-card[data-type="PRODUCT"] { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }

/* EVENT — 黄色/琥珀 */
.dot-event { background-color: #f59e0b; }
.entity-mark[data-type="EVENT"] { background: #fef3c7; color: #92400e; border-bottom-color: #f59e0b; }
.filter-tag[data-type="EVENT"] { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.filter-tag[data-type="EVENT"].active { background: #f59e0b; border-color: #f59e0b; }
.entity-group[data-type="EVENT"] .entity-group-header { background: linear-gradient(90deg, #fffbeb, #fff); color: #92400e; border-bottom-color: #fde68a; }
.entity-group[data-type="EVENT"] .group-count-badge { background: #f59e0b; }
.entity-chip[data-type="EVENT"] { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.stat-card[data-type="EVENT"] { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* QUANTITY — 石板蓝 */
.dot-quantity { background-color: #64748b; }
.entity-mark[data-type="QUANTITY"] { background: #f1f5f9; color: #334155; border-bottom-color: #64748b; }
.filter-tag[data-type="QUANTITY"] { background: #f8fafc; color: #334155; border-color: #94a3b8; }
.filter-tag[data-type="QUANTITY"].active { background: #64748b; border-color: #64748b; }
.entity-group[data-type="QUANTITY"] .entity-group-header { background: linear-gradient(90deg, #f8fafc, #fff); color: #334155; border-bottom-color: #e2e8f0; }
.entity-group[data-type="QUANTITY"] .group-count-badge { background: #64748b; }
.entity-chip[data-type="QUANTITY"] { background: #f8fafc; color: #334155; border-color: #e2e8f0; }
.stat-card[data-type="QUANTITY"] { background: #f8fafc; color: #334155; border-color: #e2e8f0; }

/* MONEY — 青绿 */
.dot-money { background-color: #10b981; }
.entity-mark[data-type="MONEY"] { background: #d1fae5; color: #065f46; border-bottom-color: #10b981; }
.filter-tag[data-type="MONEY"] { background: #ecfdf5; color: #065f46; border-color: #6ee7b7; }
.filter-tag[data-type="MONEY"].active { background: #10b981; border-color: #10b981; }
.entity-group[data-type="MONEY"] .entity-group-header { background: linear-gradient(90deg, #ecfdf5, #fff); color: #065f46; border-bottom-color: #a7f3d0; }
.entity-group[data-type="MONEY"] .group-count-badge { background: #10b981; }
.entity-chip[data-type="MONEY"] { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.stat-card[data-type="MONEY"] { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }

/* OTHER — 灰色 */
.dot-other { background-color: #9ca3af; }
.entity-mark[data-type="OTHER"] { background: #f3f4f6; color: #4b5563; border-bottom-color: #9ca3af; }
.filter-tag[data-type="OTHER"] { background: #f9fafb; color: #4b5563; border-color: #d1d5db; }
.filter-tag[data-type="OTHER"].active { background: #9ca3af; border-color: #9ca3af; }
.entity-group[data-type="OTHER"] .entity-group-header { background: linear-gradient(90deg, #f9fafb, #fff); color: #4b5563; border-bottom-color: #e5e7eb; }
.entity-group[data-type="OTHER"] .group-count-badge { background: #9ca3af; }
.entity-chip[data-type="OTHER"] { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }
.stat-card[data-type="OTHER"] { background: #f9fafb; color: #4b5563; border-color: #e5e7eb; }

/* ---- 空状态提示 ---- */
.er-empty-hint {
    font-size: 13px;
    color: #9ca3af;
    font-style: italic;
    padding: 4px 0;
}

/* ---- chip 出现次数徽章 ---- */
.chip-count {
    font-size: 11px;
    opacity: 0.65;
    font-weight: 400;
    flex-shrink: 0;
}

/* ---- 总计徽章 ---- */
.stat-total {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    border-radius: 10px;
    background: linear-gradient(90deg, #f5f3ff, #faf5ff);
    border: 1.5px solid #e9d5ff;
    border-left: 3px solid #6366f1;
    white-space: nowrap;
    flex-shrink: 0;
}

.stat-total-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

.stat-total-count {
    font-size: 18px;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
    margin: 0 1px;
}

/* ---- 折叠箭头 ---- */
.group-collapse-icon {
    font-size: 13px;
    flex-shrink: 0;
    transition: transform 0.22s ease;
    opacity: 0.6;
    margin-left: 4px;
}

.entity-group.collapsed .group-collapse-icon {
    transform: rotate(-90deg);
}

/* ---- 图例可交互（有结果时） ---- */
.er-legend.has-result .legend-item {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 5px;
    transition: background 0.15s ease;
}

.er-legend.has-result .legend-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

body.dark-mode .er-legend.has-result .legend-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

/* ---- 入场动画 ---- */
.er-anim-in {
    animation: er-card-in 0.38s cubic-bezier(0.4, 0, 0.2, 1) both;
}

@keyframes er-card-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Toast 轻提示 ---- */
.er-toast {
    position: fixed;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #fff;
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.22);
    white-space: nowrap;
    pointer-events: none;
}

/* ---------- 暗黑模式 ---------- */
body.dark-mode .form-group label { color: #e2e8f0; }

body.dark-mode .er-input-area {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

body.dark-mode .er-section-banner {
    background: linear-gradient(135deg, #1d4ed8 0%, #4338ca 55%, #6d28d9 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

body.dark-mode .er-banner-badge {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
}

body.dark-mode .er-loading {
    background: linear-gradient(135deg, #172033 0%, #1d1133 100%);
    border-color: #1e3a5f;
    color: #60a5fa;
}

body.dark-mode .mode-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .mode-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: #172033;
}

body.dark-mode .mode-btn.active {
    color: #fff;
    border-color: #3b82f6;
    background: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 100%);
}

body.dark-mode .mode-tip { color: #475569; }

body.dark-mode .er-legend {
    background: linear-gradient(90deg, #1e293b 0%, #1d1133 100%);
    border-color: #334155;
    border-left-color: #6366f1;
}

body.dark-mode .legend-label { color: #94a3b8; }
body.dark-mode .legend-item { color: #cbd5e1; }

body.dark-mode .loading-spinner {
    border-color: #1e3a5f;
    border-top-color: #60a5fa;
}

body.dark-mode .er-summary {
    background: linear-gradient(90deg, #1c1a08, #1a1706);
    border-color: #854d0e;
    border-left-color: #d97706;
}

body.dark-mode .summary-text { color: #fbbf24; }

body.dark-mode .er-highlight-text {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .er-highlight-text::-webkit-scrollbar-thumb { background: #334155; }
body.dark-mode .er-highlight-text::-webkit-scrollbar-thumb:hover { background: #475569; }

body.dark-mode .section-header {
    background: linear-gradient(90deg, #1d1133 0%, #1e1a2e 60%, #1e293b 100%);
    border-left-color: #7c3aed;
}

body.dark-mode .section-title { color: #f1f5f9; }
body.dark-mode .section-hint { color: #475569; }

body.dark-mode .entity-mark[data-type="PERSON"] { background: #1e3a5f; color: #93c5fd; border-bottom-color: #3b82f6; }
body.dark-mode .entity-mark[data-type="ORG"]    { background: #431407; color: #fdba74; border-bottom-color: #f97316; }
body.dark-mode .entity-mark[data-type="LOC"]    { background: #052e16; color: #86efac; border-bottom-color: #22c55e; }
body.dark-mode .entity-mark[data-type="DATE"]   { background: #2e1065; color: #d8b4fe; border-bottom-color: #a855f7; }
body.dark-mode .entity-mark[data-type="PRODUCT"]{ background: #450a0a; color: #fca5a5; border-bottom-color: #ef4444; }
body.dark-mode .entity-mark[data-type="EVENT"]  { background: #1c1a08; color: #fde68a; border-bottom-color: #f59e0b; }
body.dark-mode .entity-mark[data-type="QUANTITY"]{ background: #1e293b; color: #94a3b8; border-bottom-color: #64748b; }
body.dark-mode .entity-mark[data-type="MONEY"]  { background: #022c22; color: #6ee7b7; border-bottom-color: #10b981; }
body.dark-mode .entity-mark[data-type="OTHER"]  { background: #1f2937; color: #9ca3af; border-bottom-color: #6b7280; }

body.dark-mode .entity-group {
    border-color: #334155;
    background: #1e293b;
}

body.dark-mode .entity-group-header { border-bottom-color: #334155 !important; }

body.dark-mode .entity-group[data-type="PERSON"] .entity-group-header { background: linear-gradient(90deg, #172033, #1e293b) !important; color: #93c5fd !important; }
body.dark-mode .entity-group[data-type="ORG"]    .entity-group-header { background: linear-gradient(90deg, #1c0f07, #1e293b) !important; color: #fdba74 !important; }
body.dark-mode .entity-group[data-type="LOC"]    .entity-group-header { background: linear-gradient(90deg, #052e16, #1e293b) !important; color: #86efac !important; }
body.dark-mode .entity-group[data-type="DATE"]   .entity-group-header { background: linear-gradient(90deg, #1d1133, #1e293b) !important; color: #d8b4fe !important; }
body.dark-mode .entity-group[data-type="PRODUCT"].entity-group-header { background: linear-gradient(90deg, #200a0a, #1e293b) !important; color: #fca5a5 !important; }
body.dark-mode .entity-group[data-type="EVENT"]  .entity-group-header { background: linear-gradient(90deg, #1c1405, #1e293b) !important; color: #fde68a !important; }
body.dark-mode .entity-group[data-type="QUANTITY"].entity-group-header { background: linear-gradient(90deg, #0f172a, #1e293b) !important; color: #94a3b8 !important; }
body.dark-mode .entity-group[data-type="MONEY"]  .entity-group-header { background: linear-gradient(90deg, #01160f, #1e293b) !important; color: #6ee7b7 !important; }
body.dark-mode .entity-group[data-type="OTHER"]  .entity-group-header { background: linear-gradient(90deg, #111827, #1e293b) !important; color: #9ca3af !important; }

body.dark-mode .entity-chip[data-type="PERSON"] { background: #172033; color: #93c5fd; border-color: #1d4ed8; }
body.dark-mode .entity-chip[data-type="ORG"]    { background: #1c0f07; color: #fdba74; border-color: #9a3412; }
body.dark-mode .entity-chip[data-type="LOC"]    { background: #052e16; color: #86efac; border-color: #166534; }
body.dark-mode .entity-chip[data-type="DATE"]   { background: #1d1133; color: #d8b4fe; border-color: #6b21a8; }
body.dark-mode .entity-chip[data-type="PRODUCT"]{ background: #200a0a; color: #fca5a5; border-color: #991b1b; }
body.dark-mode .entity-chip[data-type="EVENT"]  { background: #1c1405; color: #fde68a; border-color: #92400e; }
body.dark-mode .entity-chip[data-type="QUANTITY"]{ background: #0f172a; color: #94a3b8; border-color: #475569; }
body.dark-mode .entity-chip[data-type="MONEY"]  { background: #01160f; color: #6ee7b7; border-color: #065f46; }
body.dark-mode .entity-chip[data-type="OTHER"]  { background: #111827; color: #9ca3af; border-color: #374151; }

body.dark-mode .er-type-filter {
    background: #1e293b;
    border-color: #334155;
}

body.dark-mode .filter-label { color: #94a3b8; }

body.dark-mode .filter-all-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .filter-all-btn.active,
body.dark-mode .filter-all-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: #172033;
}

body.dark-mode .action-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .action-btn:hover {
    border-color: #60a5fa;
    color: #60a5fa;
    background: #172033;
}

body.dark-mode .er-result-actions { border-top-color: #334155; }

body.dark-mode .er-empty-hint { color: #475569; }

body.dark-mode .chip-count { opacity: 0.5; }

body.dark-mode .stat-total {
    background: linear-gradient(90deg, #1d1133, #1e293b);
    border-color: #4c1d95;
    border-left-color: #6366f1;
}

body.dark-mode .stat-total-label { color: #64748b; }
body.dark-mode .stat-total-count { color: #f1f5f9; }

body.dark-mode .er-groups-section-header {
    background: linear-gradient(90deg, #1d1133 0%, #1e1a2e 60%, #1e293b 100%);
    border-left-color: #7c3aed;
}

body.dark-mode .stat-card[data-type="PERSON"] { background: #172033; color: #93c5fd; border-color: #1d4ed8; }
body.dark-mode .stat-card[data-type="ORG"]    { background: #1c0f07; color: #fdba74; border-color: #9a3412; }
body.dark-mode .stat-card[data-type="LOC"]    { background: #052e16; color: #86efac; border-color: #166534; }
body.dark-mode .stat-card[data-type="DATE"]   { background: #1d1133; color: #d8b4fe; border-color: #6b21a8; }
body.dark-mode .stat-card[data-type="PRODUCT"]{ background: #200a0a; color: #fca5a5; border-color: #991b1b; }
body.dark-mode .stat-card[data-type="EVENT"]  { background: #1c1405; color: #fde68a; border-color: #92400e; }
body.dark-mode .stat-card[data-type="QUANTITY"]{ background: #0f172a; color: #94a3b8; border-color: #475569; }
body.dark-mode .stat-card[data-type="MONEY"]  { background: #01160f; color: #6ee7b7; border-color: #065f46; }
body.dark-mode .stat-card[data-type="OTHER"]  { background: #111827; color: #9ca3af; border-color: #374151; }

body.dark-mode .entity-mark::after { background: #0f172a; }

body.dark-mode .required-mark { color: #f87171; }
body.dark-mode .char-count { color: #64748b; }
body.dark-mode .char-count.danger { color: #f87171; }

body.dark-mode .er-toast {
    background: #0f172a;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55);
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .form-row { flex-direction: column; }
    .mode-tip-group { display: none; }
    .actions-group { flex-wrap: wrap; }
    .er-legend { gap: 6px 10px; }
    .er-stats-bar { gap: 8px; }
    .stat-card { padding: 7px 10px; font-size: 12px; }
    .stat-count { font-size: 14px; }
    .entity-group-body { padding: 10px 12px; }
    .section-hint { display: none; }
}
