/* ==========================================================
   ma-ai-features.css — KI-Modul UI fuer M&A Case
   Tristate-Felder, Confidence-Indikatoren, Upgrade-Hints,
   Discovery-Liste. ALBO-Slate-Farbwelt (vgl. seller.css).
   ========================================================== */

/* ─── Upgrade-Hint (fuer Standard-Tier-User) ─────────────── */

.ma-ai-upgrade-hint {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 12px 0;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
}
.ma-ai-upgrade-compact {
    padding: 8px 12px;
    margin: 8px 0;
    font-size: 12px;
}
.ma-ai-upgrade-icon {
    flex-shrink: 0;
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    background: #0f172a;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    border-radius: 6px;
}
.ma-ai-upgrade-text {
    flex: 1;
    display: flex; flex-direction: column; gap: 2px;
    font-size: 12px;
    color: #475569;
}
.ma-ai-upgrade-text strong {
    color: #0f172a;
    font-weight: 600;
    font-size: 13px;
}
.ma-ai-upgrade-text span { color: #64748b; }
.ma-ai-upgrade-btn {
    flex-shrink: 0;
    padding: 6px 12px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.ma-ai-upgrade-btn:hover { background: #1e293b; }

/* ─── Tristate-Felder ────────────────────────────────────── */

.ma-field-tristate {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ma-field-tristate-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
}
.ma-field-tristate-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #0f172a;
    transition: border-color 0.15s;
}
.ma-field-tristate-input:focus {
    outline: none;
    border-color: #0f172a;
}

/* State: not_in_source — KI hat geprueft, nichts gefunden */
.ma-field-state-not-in-source .ma-field-tristate-input {
    background: #f8fafc;
    color: #94a3b8;
    border-style: dashed;
}
.ma-field-state-not-in-source .ma-field-tristate-input::placeholder {
    color: #cbd5e1;
}
.ma-field-state-not-in-source-hint {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
}

/* State: not_applicable — User hat als irrelevant markiert */
.ma-field-state-not-applicable {
    opacity: 0.4;
}
.ma-field-state-not-applicable .ma-field-tristate-input {
    text-decoration: line-through;
    background: #f1f5f9;
    pointer-events: none;
}

/* ─── Confidence-Indikatoren ─────────────────────────────── */

.ma-field-confidence {
    position: absolute;
    top: 0; right: 0;
    display: flex; align-items: center; gap: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ma-field-confidence-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
}
.ma-field-confidence-high .ma-field-confidence-dot { background: #16a34a; }
.ma-field-confidence-medium .ma-field-confidence-dot { background: #ca8a04; }
.ma-field-confidence-low .ma-field-confidence-dot { background: #dc2626; }

.ma-field-confidence-high .ma-field-tristate-input { border-left: 2px solid #86efac; }
.ma-field-confidence-medium .ma-field-tristate-input { border-left: 2px solid #fcd34d; }
.ma-field-confidence-low .ma-field-tristate-input { border-left: 2px solid #fca5a5; }

/* ─── Source-Quote Tooltip ───────────────────────────────── */

.ma-field-source-link {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px;
    color: #2563eb;
    cursor: pointer;
    text-decoration: none;
    margin-top: 2px;
}
.ma-field-source-link:hover { text-decoration: underline; }
.ma-field-source-quote {
    margin-top: 6px;
    padding: 8px 10px;
    background: #f8fafc;
    border-left: 2px solid #cbd5e1;
    font-size: 11px;
    font-style: italic;
    color: #475569;
    border-radius: 0 4px 4px 0;
    line-height: 1.5;
}
.ma-field-source-page {
    color: #94a3b8;
    font-size: 10px;
    margin-left: 4px;
}

/* ─── Field-Action-Buttons (Confirm / Override / N/A) ────── */

.ma-field-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}
.ma-field-action-btn {
    padding: 3px 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.ma-field-action-btn:hover {
    border-color: #475569;
    color: #0f172a;
    background: #f8fafc;
}
.ma-field-action-confirm:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}
.ma-field-action-override:hover {
    background: #475569;
    border-color: #475569;
    color: #fff;
}
.ma-field-action-na:hover {
    background: #475569;
    border-color: #475569;
    color: #fff;
    opacity: 0.85;
}

/* ─── KI-Suggestion-Badge (bei Konflikt manual vs AI) ────── */

.ma-field-ai-suggestion {
    margin-top: 6px;
    padding: 8px 10px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    font-size: 12px;
}
.ma-field-ai-suggestion-label {
    font-size: 10px;
    font-weight: 700;
    color: #1d4ed8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.ma-field-ai-suggestion-value {
    color: #1e3a8a;
    font-weight: 600;
}

/* ─── Discovery-Liste ────────────────────────────────────── */

.ma-discovery-section {
    margin-top: 24px;
    padding: 16px;
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.ma-discovery-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.ma-discovery-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ma-discovery-badge {
    padding: 2px 8px;
    background: #0f172a;
    color: #fff;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}
.ma-discovery-empty {
    padding: 16px 0;
    text-align: center;
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
}
.ma-discovery-item {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: border-color 0.15s;
}
.ma-discovery-item:hover { border-color: #cbd5e1; }
.ma-discovery-item-status-accepted { border-color: #cbd5e1; background: #f8fafc; }
.ma-discovery-item-status-rejected { opacity: 0.5; }
.ma-discovery-item-status-promoted { border-color: #cbd5e1; background: #f8fafc; }

.ma-discovery-item-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 4px;
}
.ma-discovery-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    flex: 1;
}
.ma-discovery-item-severity {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}
.ma-discovery-item-severity-info { background: #f1f5f9; color: #475569; }
.ma-discovery-item-severity-warning { background: #fef3c7; color: #92400e; }
.ma-discovery-item-severity-critical { background: #fee2e2; color: #991b1b; }

.ma-discovery-item-value {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
    margin-bottom: 6px;
}
.ma-discovery-item-actions {
    display: flex; gap: 6px;
    margin-top: 8px;
}
.ma-discovery-item-actions .ma-field-action-btn { font-size: 10px; }

/* ─── Review-Panel (KI-Extraktion) ───────────────────────── */

.ma-review-panel {
    display: flex; flex-direction: column; gap: 16px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin: 16px 0;
}

.ma-review-summary {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-review-summary-title {
    flex: 1;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.ma-review-summary-stats {
    display: flex; align-items: center; gap: 8px;
    font-size: 11px;
}
.ma-confidence-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    color: #475569;
}
.ma-confidence-pill.ma-field-confidence-high,
.ma-confidence-pill.ma-field-confidence-medium,
.ma-confidence-pill.ma-field-confidence-low {
    color: #475569;
    background: #fff;
    border-color: #e2e8f0;
}
.ma-review-summary-empty {
    padding: 3px 8px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 11px;
    font-weight: 600;
}

.ma-review-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.ma-review-card {
    padding: 14px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-left: 3px solid transparent;
    border-radius: 6px;
    display: flex; flex-direction: column; gap: 8px;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
    cursor: pointer;
}
.ma-review-card:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
}
.ma-review-card.ma-review-card-active {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.ma-review-card.ma-field-confidence-high   { border-left-color: #86efac; }
.ma-review-card.ma-field-confidence-medium { border-left-color: #fcd34d; }
.ma-review-card.ma-field-confidence-low    { border-left-color: #fca5a5; }
.ma-review-card.ma-review-card-active.ma-field-confidence-high   { border-left-color: #16a34a; }
.ma-review-card.ma-review-card-active.ma-field-confidence-medium { border-left-color: #ca8a04; }
.ma-review-card.ma-review-card-active.ma-field-confidence-low    { border-left-color: #dc2626; }
.ma-review-card.ma-field-state-not-in-source {
    background: #f8fafc;
    border-style: dashed;
    border-left-style: dashed;
}
.ma-review-card.ma-field-state-not-applicable {
    opacity: 0.4;
}

.ma-review-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ma-review-card-label {
    font-size: 11px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ma-review-card-value {
    font-size: 14px;
    color: #0f172a;
    font-weight: 600;
    line-height: 1.4;
    word-break: break-word;
}

/* ─── Diff-Review (Re-Upload-Vergleich) ──────────────────── */

.ma-diff-panel {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin: 16px 0;
    overflow: hidden;
}

.ma-diff-summary {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-diff-summary-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.ma-diff-summary-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.ma-diff-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0 8px;
}
.ma-diff-tab {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 14px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.ma-diff-tab:hover { color: #0f172a; }
.ma-diff-tab-active {
    color: #0f172a;
    border-bottom-color: #0f172a;
}
.ma-diff-tab-count {
    padding: 1px 6px;
    background: #e2e8f0;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    color: #475569;
}
.ma-diff-tab-active .ma-diff-tab-count {
    background: #0f172a;
    color: #fff;
}

.ma-diff-entries {
    padding: 16px;
    display: flex; flex-direction: column; gap: 10px;
    max-height: 60vh;
    overflow-y: auto;
}

.ma-diff-entry {
    padding: 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.ma-diff-entry-changed { border-left: 3px solid #d97706; }
.ma-diff-entry-added { border-left: 3px solid #16a34a; }
.ma-diff-entry-removed { border-left: 3px solid #dc2626; }
.ma-diff-entry-decision-accept { background: #f0fdf4; border-color: #86efac; }
.ma-diff-entry-decision-reject { background: #fef2f2; border-color: #fca5a5; }
.ma-diff-entry-decision-keep-both { background: #eff6ff; border-color: #bfdbfe; }

.ma-diff-entry-head {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 10px;
}
.ma-diff-entry-tag {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ma-diff-tag-changed { background: #fffbeb; color: #92400e; }
.ma-diff-tag-added { background: #f0fdf4; color: #166534; }
.ma-diff-tag-removed { background: #fef2f2; color: #991b1b; }
.ma-diff-entry-label {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
}

.ma-diff-entry-values {
    display: flex; align-items: stretch; gap: 8px;
    margin-bottom: 10px;
}
.ma-diff-value {
    flex: 1;
    padding: 8px 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: flex; flex-direction: column; gap: 4px;
    min-width: 0;
}
.ma-diff-value-old { background: #fafafa; }
.ma-diff-value-new { background: #fafafa; }
.ma-diff-value-tag {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}
.ma-diff-value-content {
    font-size: 13px;
    color: #0f172a;
    word-break: break-word;
}
.ma-diff-arrow {
    display: flex; align-items: center; justify-content: center;
    color: #cbd5e1;
    font-size: 18px;
    flex-shrink: 0;
    width: 24px;
}

.ma-diff-quote {
    margin-top: 4px;
    padding: 4px 6px;
    background: #fefce8;
    border-left: 2px solid #eab308;
    font-size: 11px;
    color: #713f12;
    border-radius: 0 4px 4px 0;
}
.ma-diff-quote-label {
    font-weight: 700;
    color: #92400e;
    text-transform: uppercase;
    font-size: 9px;
    letter-spacing: 0.05em;
}
.ma-diff-quote-text { font-style: italic; }

.ma-diff-entry-actions {
    display: flex; gap: 6px;
}
.ma-diff-action-active {
    background: #0f172a !important;
    color: #fff !important;
    border-color: #0f172a !important;
}

.ma-diff-footer {
    display: flex; gap: 8px; align-items: center;
    padding: 12px 16px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
}

/* ─── KI-Status-Indikator (Floating Button + Panel) ──────── */

#ma-ai-status-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ma-ai-status-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    font-size: 12px;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.15s;
}
.ma-ai-status-btn:hover {
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
    border-color: #cbd5e1;
}
.ma-ai-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ma-ai-status-dot-on {
    background: #16a34a;
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.4);
    animation: ma-ai-pulse 2s infinite;
}
.ma-ai-status-dot-off {
    background: #cbd5e1;
}
@keyframes ma-ai-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

.ma-ai-status-panel {
    position: absolute;
    bottom: 56px;
    right: 0;
    width: 420px;
    max-height: 75vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ma-ai-status-panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    background: #0f172a;
    color: #fff;
}
.ma-ai-status-panel-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.ma-ai-status-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 14px;
    cursor: pointer;
    padding: 4px 8px;
    font-family: inherit;
}
.ma-ai-status-close:hover { color: #fff; }

.ma-ai-status-panel-body {
    padding: 0;
    overflow-y: auto;
}

.ma-ai-status-summary {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-ai-status-badge-on {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 700;
}
.ma-ai-status-badge-on::before {
    content: ''; width: 8px; height: 8px;
    background: #16a34a; border-radius: 50%;
}
.ma-ai-status-badge-off {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 6px 14px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
}

.ma-ai-status-section {
    padding: 14px 16px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-ai-status-section:last-child { border-bottom: none; }
.ma-ai-status-section-title {
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.ma-ai-status-row {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 0;
    font-size: 12px;
}
.ma-ai-status-key {
    flex: 0 0 80px;
    color: #64748b;
    font-weight: 600;
}
.ma-ai-status-val {
    flex: 1;
    color: #0f172a;
    font-weight: 500;
}
.ma-ai-status-tag {
    display: inline-block;
    padding: 1px 6px;
    background: #f1f5f9;
    color: #64748b;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ma-ai-status-mod {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 0;
    font-size: 12px;
    border-bottom: 1px solid #f8fafc;
}
.ma-ai-status-mod:last-child { border-bottom: none; }
.ma-ai-status-mod-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ma-ai-status-mod-on .ma-ai-status-mod-dot { background: #16a34a; }
.ma-ai-status-mod-ready .ma-ai-status-mod-dot { background: #d97706; }
.ma-ai-status-mod-off .ma-ai-status-mod-dot { background: #cbd5e1; }
.ma-ai-status-mod-label {
    flex: 1;
    color: #1e293b;
    line-height: 1.4;
}
.ma-ai-status-mod-state {
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ma-ai-status-mod-on .ma-ai-status-mod-state { color: #166534; }
.ma-ai-status-mod-ready .ma-ai-status-mod-state { color: #92400e; }
.ma-ai-status-mod-off .ma-ai-status-mod-state { color: #94a3b8; }

.ma-ai-status-actions {
    display: flex; flex-direction: column; gap: 6px;
}
.ma-ai-status-action {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #475569;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    font-family: inherit;
}
.ma-ai-status-action:hover {
    border-color: #0f172a;
    color: #0f172a;
}
.ma-ai-status-action-on {
    background: #0f172a;
    color: #fff;
    border-color: #0f172a;
}
.ma-ai-status-action-on:hover {
    background: #1e293b;
    color: #fff;
}
.ma-ai-status-action-off {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}
.ma-ai-status-action-off:hover {
    background: #fee2e2;
    color: #991b1b;
}

.ma-ai-status-output {
    margin-top: 8px;
    padding: 8px 10px;
    background: #f8fafc;
    border-left: 2px solid #0f172a;
    border-radius: 4px;
    font-size: 11px;
    color: #475569;
    min-height: 14px;
}
.ma-ai-status-output:empty { display: none; }

.ma-ai-status-footer {
    padding: 10px 16px;
    background: #f8fafc;
    font-size: 10px;
    color: #94a3b8;
    line-height: 1.4;
}
.ma-ai-status-footer code {
    background: #e2e8f0;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
    color: #475569;
}

/* ─── Outlook-Email-Import Banner ────────────────────────── */

.ma-ai-email-banner {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-left: 3px solid #2563eb;
    border-radius: 8px;
    margin: 8px 0 12px 0;
}
.ma-ai-email-banner-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    border-radius: 50%;
}
.ma-ai-email-banner-text {
    flex: 1;
    display: flex; flex-direction: column; gap: 2px;
    font-size: 12px;
    color: #1e40af;
    min-width: 0;
}
.ma-ai-email-banner-text strong {
    color: #1e3a8a;
    font-weight: 700;
    font-size: 13px;
}
.ma-ai-email-banner-text span {
    color: #475569;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ma-ai-email-banner .ma-ai-upgrade-btn {
    flex-shrink: 0;
    background: #2563eb;
}
.ma-ai-email-banner .ma-ai-upgrade-btn:hover { background: #1d4ed8; }

/* ─── Knowledge-Center-Match ─────────────────────────────── */

.ma-kb-panel {
    display: flex; flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin: 16px 0;
    overflow: hidden;
}
.ma-kb-panel-header {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-kb-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
}
.ma-kb-panel-meta {
    margin-top: 4px;
    font-size: 12px;
    color: #64748b;
}

.ma-kb-section {
    padding: 16px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-kb-section:last-child { border-bottom: none; }
.ma-kb-section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}
.ma-kb-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ma-kb-section-meta {
    margin-top: 8px;
    font-size: 11px;
    color: #64748b;
}
.ma-kb-empty {
    padding: 12px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 6px;
    color: #94a3b8;
    font-size: 12px;
    font-style: italic;
    text-align: center;
}

.ma-kb-status-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ma-kb-status-pass    { background: #f0fdf4; color: #166534; border: 1px solid #86efac; }
.ma-kb-status-fail    { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
.ma-kb-status-unknown { background: #f8fafc; color: #64748b; border: 1px dashed #cbd5e1; }

.ma-kb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.ma-kb-table th {
    text-align: left;
    padding: 8px 10px;
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid #e2e8f0;
}
.ma-kb-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f1f5f9;
    color: #0f172a;
}
.ma-kb-table tr:last-child td { border-bottom: none; }
.ma-kb-num { text-align: right; font-variant-numeric: tabular-nums; }
.ma-kb-range { color: #64748b; font-size: 11px; }
.ma-kb-table tr.ma-kb-status-fail td { background: #fef2f2; }

.ma-kb-division-card {
    padding: 14px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
}
.ma-kb-division-name {
    font-size: 16px;
    font-weight: 700;
    color: #14532d;
}
.ma-kb-division-desc {
    margin-top: 4px;
    font-size: 12px;
    color: #166534;
}
.ma-kb-division-reasoning {
    margin-top: 10px;
    padding: 8px 10px;
    background: #fff;
    border-left: 3px solid #16a34a;
    font-size: 12px;
    color: #475569;
    border-radius: 0 4px 4px 0;
}
.ma-kb-division-card .ma-ai-upgrade-btn {
    margin-top: 12px;
    background: #16a34a;
}
.ma-kb-division-card .ma-ai-upgrade-btn:hover { background: #15803d; }

.ma-kb-alternatives {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    margin-top: 12px;
}
.ma-kb-alternatives-label {
    font-size: 11px;
    color: #64748b;
    font-weight: 600;
}

.ma-kb-dealbreaker {
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 8px;
}
.ma-kb-dealbreaker.ma-kb-status-fail { border-left: 3px solid #dc2626; background: #fef2f2; }
.ma-kb-dealbreaker.ma-kb-status-pass { border-left: 3px solid #16a34a; }
.ma-kb-dealbreaker.ma-kb-status-unknown { border-left: 3px dashed #cbd5e1; }
.ma-kb-dealbreaker-head {
    display: flex; align-items: flex-start; gap: 10px;
}
.ma-kb-dealbreaker-text {
    flex: 1;
    font-size: 13px;
    color: #0f172a;
    font-weight: 600;
}
.ma-kb-dealbreaker-evidence {
    margin-top: 6px;
    margin-left: 60px;
    padding: 6px 8px;
    background: #fefce8;
    border-left: 2px solid #eab308;
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: #713f12;
    font-style: italic;
}

.ma-kb-fit-list {
    display: flex; flex-direction: column; gap: 12px;
}
.ma-kb-fit-row {
    display: grid;
    grid-template-columns: 180px 1fr 50px;
    gap: 8px;
    align-items: center;
}
.ma-kb-fit-label {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
}
.ma-kb-fit-weight {
    color: #94a3b8;
    font-weight: 400;
    font-size: 11px;
}
.ma-kb-fit-bar {
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
}
.ma-kb-fit-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}
.ma-kb-bar-high   { background: #16a34a; }
.ma-kb-bar-medium { background: #d97706; }
.ma-kb-bar-low    { background: #dc2626; }
.ma-kb-fit-score {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.ma-kb-fit-reason {
    grid-column: 1 / -1;
    margin-top: -4px;
    margin-left: 188px;
    font-size: 11px;
    color: #64748b;
    font-style: italic;
}

/* ─── Workstep-Bridge ─────────────────────────────────────── */

.ma-ai-active-badge-host {
    display: flex; align-items: center;
    padding: 8px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    margin: 8px 0 12px 0;
}

.ma-ai-review-container {
    margin: 16px 0;
    min-height: 0;
}
.ma-ai-review-container:empty {
    display: none;
}

/* ─── KI-Aktiv-Badge in Phase-Header ─────────────────────── */

.ma-ai-active-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ma-ai-active-badge::before {
    content: '';
    width: 6px; height: 6px;
    background: #16a34a;
    border-radius: 50%;
}

/* ─── Split-Layout (Felder links, PDF rechts) ─────────────── */

.ma-review-split {
    display: flex;
    gap: 16px;
    flex: 1;
    min-height: 480px;
    width: 100%;
    overflow: hidden;
}
.ma-review-pane-fields {
    flex: 0 0 32%;
    max-width: 480px;
    min-width: 320px;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.ma-review-pane-fields .ma-review-summary {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    margin: 0;
    padding: 8px 4px 12px;
    border-bottom: 1px solid #f1f5f9;
}
.ma-review-pane-fields .ma-review-cards {
    grid-template-columns: 1fr;
    gap: 8px;
}
.ma-review-pane-fields .ma-review-card {
    padding: 12px 14px;
}
.ma-review-pane-pdf {
    flex: 1;
    min-width: 0;
    min-height: 0;
    border-left: 1px solid #e2e8f0;
    padding-left: 16px;
    display: flex;
    flex-direction: column;
}

/* PDF-Toolbar */
.ma-pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 12px;
    flex-shrink: 0;
}
.ma-pdf-nav-btn {
    padding: 4px 12px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1;
    color: #475569;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ma-pdf-nav-btn:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
}
.ma-pdf-nav-btn:disabled {
    opacity: 0.4;
    cursor: default;
}
.ma-pdf-pageinfo {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
}
.ma-pdf-hint {
    font-size: 11px;
    color: #94a3b8;
    font-style: italic;
}
.ma-pdf-match-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 8px;
}
.ma-pdf-match-badge.ma-pdf-match-imprecise {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

/* PDF-Canvas-Bereich */
.ma-pdf-canvas-wrap {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 16px;
}
.ma-pdf-page-container {
    position: relative;
    margin: 0 auto;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    background: #fff;
}
.ma-pdf-canvas {
    display: block;
}
.ma-pdf-loading,
.ma-pdf-error {
    padding: 32px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
}
.ma-pdf-error {
    color: #b91c1c;
}

/* PDF-Textlayer (transparenter Overlay zum Highlighten) */
.ma-pdf-textlayer {
    position: absolute;
    inset: 0;
    overflow: hidden;
    line-height: 1;
    opacity: 1;
}
.ma-pdf-textlayer > span,
.ma-pdf-textlayer > br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
}
.ma-pdf-textlayer span.ma-pdf-highlight {
    background: rgba(250, 204, 21, 0.45);
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(202, 138, 4, 0.6);
    color: transparent;
}

/* Koordinaten-basiertes Highlight (Enterprise-Pfad): gelbe Rechtecke pro Zeile */
.ma-pdf-highlight-rect {
    background: rgba(250, 204, 21, 0.35);
    border: 1px solid rgba(202, 138, 4, 0.7);
    border-radius: 3px;
    box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.18);
    pointer-events: none;
    transition: opacity 0.15s;
}
.ma-pdf-highlight-layer {
    z-index: 5;
}

/* Zoom-Anzeige in Toolbar */
.ma-pdf-zoominfo {
    font-size: 12px;
    color: #475569;
    font-weight: 600;
    min-width: 42px;
    text-align: center;
}

/* ─── Übernommen-Status ───────────────────────────────────── */

.ma-review-card.ma-review-card-confirmed {
    background: #f6fdf9;
    border-color: #bbf7d0;
}
.ma-review-card.ma-review-card-confirmed .ma-review-card-value {
    color: #166534;
}
.ma-field-confirmed-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    background: #16a34a;
    color: #fff;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.ma-field-confirmed-badge svg {
    flex-shrink: 0;
}
.ma-field-action-undo {
    margin-left: auto;
    color: #64748b;
}
.ma-field-action-undo:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #0f172a;
}

/* Empty-Field-Hinweis (KI hat nichts gefunden) */
.ma-field-empty-hint {
    margin-top: 4px;
    padding: 6px 8px;
    background: #fffbeb;
    border-left: 2px solid #fcd34d;
    border-radius: 0 4px 4px 0;
    font-size: 11px;
    color: #92400e;
    font-style: italic;
}
.ma-field-action-fill {
    background: #fff;
    border-color: #2563eb;
    color: #1e40af;
}
.ma-field-action-fill:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

/* ─── Seiten-Übersicht (Coverage-Indicator) ─────────────── */

.ma-page-overview-section {
    margin-top: 16px;
    padding: 12px 16px;
    background: #fafafa;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}
.ma-page-overview-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: 4px 0;
}
.ma-page-overview-summary::-webkit-details-marker { display: none; }
.ma-page-overview-summary::before {
    content: '▶';
    font-size: 9px;
    color: #94a3b8;
    margin-right: 6px;
    transition: transform 0.15s;
}
.ma-page-overview-section[open] .ma-page-overview-summary::before {
    transform: rotate(90deg);
}
.ma-page-overview-title {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    flex: 1;
}
.ma-page-overview-stats {
    font-size: 11.5px;
    color: #64748b;
    font-weight: 500;
}
.ma-page-overview-body {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}
.ma-page-overview-group-title {
    font-size: 10.5px;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 12px 0 6px 0;
}
.ma-page-overview-group-title:first-child { margin-top: 0; }
.ma-page-overview-group-hint {
    font-size: 10.5px;
    font-weight: 500;
    color: #94a3b8;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
}
.ma-page-overview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 4px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ma-page-overview-item:hover {
    background: #eff6ff;
    border-color: #3b82f6;
}
.ma-page-overview-page {
    flex: 0 0 auto;
    font-weight: 600;
    color: #1e40af;
    min-width: 72px;
}
.ma-page-overview-meta {
    flex: 1;
    color: #475569;
}
.ma-page-overview-arrow {
    flex: 0 0 auto;
    color: #94a3b8;
    font-size: 13px;
}
.ma-page-overview-item.ma-page-overview-warn {
    background: #fffbeb;
    border-color: #fde68a;
}
.ma-page-overview-item.ma-page-overview-warn:hover {
    background: #fef3c7;
    border-color: #f59e0b;
}
.ma-page-overview-item.ma-page-overview-warn .ma-page-overview-page {
    color: #92400e;
}
.ma-page-overview-ranges {
    font-size: 12px;
    color: #94a3b8;
    padding: 6px 12px;
    line-height: 1.5;
}
.ma-page-overview-more {
    font-size: 11.5px;
    color: #94a3b8;
    padding: 6px 0 0 12px;
    font-style: italic;
}

/* ─── Confidence-Begründung (warum medium/low) ─────────── */

.ma-field-confidence-reason {
    margin: 6px 0 4px 0;
    padding: 6px 10px;
    background: #fefce8;
    border-left: 3px solid #facc15;
    border-radius: 0 4px 4px 0;
    font-size: 11.5px;
    color: #713f12;
    line-height: 1.4;
}
.ma-field-confidence-reason svg {
    color: #ca8a04;
    flex-shrink: 0;
}
