/* Fiche affaire commerciale — hub Jupiter (Mission / Externe / Portage / Maroc) */

.jp-affaire-detail {
    --jp-aff-accent: #0e7490;
    --jp-aff-accent-soft: #ecfeff;
}

.jp-affaire-detail .jp-hero {
    background:
        radial-gradient(420px 220px at 30% -30%, rgba(34, 211, 238, .22), transparent 70%),
        linear-gradient(135deg, #164e63 0%, #0e7490 55%, #0891b2 100%);
}

.jp-aff-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

.jp-aff-aside {
    position: sticky;
    top: var(--jp-sticky-top, 57px);
}

.jp-aff-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.jp-aff-kpi {
    padding: 12px 14px;
    background: var(--jp-surface);
    border: 1px solid var(--jp-border);
    border-radius: var(--jp-radius-lg);
    box-shadow: var(--jp-shadow);
}

.jp-aff-kpi.is-period,
.jp-aff-kpi.is-since { grid-column: span 2; }
.jp-aff-kpi.is-marge { background: linear-gradient(180deg, #ecfdf5, #fff); border-color: #a7f3d0; }
.jp-aff-kpi.is-marge .jp-aff-kpi-value { color: #047857; }
.jp-aff-kpi.is-since { background: linear-gradient(180deg, var(--jp-aff-accent-soft), #fff); border-color: #a5f3fc; }

.jp-aff-kpi-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--jp-text-3);
}
.jp-aff-kpi-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--jp-text);
    font-variant-numeric: tabular-nums;
    line-height: 1.25;
}
.jp-aff-kpi-sub { font-size: 12px; color: var(--jp-text-2); margin-top: 3px; }
.jp-aff-kpi-sub.tone-warn { color: #b45309; font-weight: 700; }
.jp-aff-kpi-sub.tone-info { color: #0369a1; font-weight: 700; }
.jp-aff-kpi-sub.tone-ok { color: #15803d; font-weight: 600; }
.jp-aff-kpi-sub.tone-neutral { color: var(--jp-text-3); }

.jp-aff-progress {
    height: 6px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
    margin-top: 6px;
}
.jp-aff-progress span { display: block; height: 100%; border-radius: 999px; background: #16a34a; }
.jp-aff-progress.tone-warn span { background: #f59e0b; }
.jp-aff-progress.tone-info span { background: #0ea5e9; }
.jp-aff-progress.tone-neutral span { background: #94a3b8; }

.jp-aff-prev { margin-top: 2px; font-size: 12px; color: var(--jp-text); }
.jp-aff-prev b { font-weight: 700; }

.jp-aff-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--jp-border);
}
.jp-aff-tab {
    border: 0;
    background: transparent;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--jp-text-2);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 8px 8px 0 0;
}
.jp-aff-tab:hover { color: var(--jp-text); background: var(--jp-surface-2); }
.jp-aff-tab.is-on {
    color: var(--jp-aff-accent);
    border-bottom-color: var(--jp-aff-accent);
    background: var(--jp-aff-accent-soft);
}
.jp-aff-tab .fas { margin-right: 6px; }

.jp-aff-card {
    padding: 16px 18px;
    background: var(--jp-surface);
    border: 1px solid var(--jp-border);
    border-radius: var(--jp-radius-lg);
    box-shadow: var(--jp-shadow);
}
.jp-aff-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--jp-text);
}
.jp-aff-card-head .fas { color: var(--jp-aff-accent); }

.jp-aff-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--jp-border);
}
.jp-aff-row:last-child { border-bottom: 0; }
.jp-aff-row-label { font-size: 12px; font-weight: 600; color: var(--jp-text-3); }
.jp-aff-row-value { font-size: 13.5px; color: var(--jp-text); font-weight: 600; }

.jp-aff-empty { color: var(--jp-text-3); padding: 12px 0; }
.jp-aff-hint { margin: 12px 0 0; font-size: 12px; color: var(--jp-text-3); }
.jp-aff-prose { white-space: pre-wrap; font-size: 13.5px; color: var(--jp-text); line-height: 1.55; }

.jp-aff-chart { width: 100%; height: auto; display: block; }
.jp-aff-grid { stroke: #eef2f7; stroke-width: 1; }
.jp-aff-axis { font-size: 10.5px; fill: #94a3b8; }
.jp-aff-change { stroke: #cbd5e1; stroke-dasharray: 3 3; stroke-width: 1; }
.jp-aff-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.jp-aff-line.is-v { stroke: #0e7490; }
.jp-aff-line.is-a { stroke: #f59e0b; }
.jp-aff-dot { stroke: #fff; stroke-width: 2; }
.jp-aff-dot.is-v { fill: #0e7490; }
.jp-aff-dot.is-a { fill: #f59e0b; }

.jp-aff-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--jp-text-2); margin-top: 4px; }
.jp-aff-key { display: inline-block; width: 18px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.jp-aff-key.is-v { background: #0e7490; }
.jp-aff-key.is-a { background: #f59e0b; }
.jp-aff-legend-note { margin-left: auto; color: var(--jp-text-3); }

.jp-aff-changes { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.jp-aff-changes li {
    display: grid;
    grid-template-columns: 82px 1fr auto;
    gap: 10px;
    align-items: baseline;
    padding: 7px 10px;
    border-radius: 8px;
    background: var(--jp-surface-2);
    font-size: 12.5px;
    color: var(--jp-text);
}
.jp-aff-ch-date { font-weight: 700; }
.jp-aff-ch-who { color: var(--jp-text-3); font-size: 11.5px; }

.jp-aff-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.jp-aff-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    background: var(--jp-surface-2);
    border: 1px solid var(--jp-border);
}
.jp-aff-chip .fas { color: var(--jp-aff-accent); }
.jp-aff-chip-n {
    min-width: 22px;
    text-align: center;
    padding: 0 7px;
    border-radius: 999px;
    font-size: 11.5px;
    line-height: 20px;
    color: #fff;
    background: var(--jp-aff-accent);
}
.jp-aff-chip.is-empty { opacity: .55; }
.jp-aff-chip.is-empty .jp-aff-chip-n { background: #94a3b8; }

.jp-aff-side-card {
    padding: 16px;
    background: var(--jp-surface);
    border: 1px solid var(--jp-border);
    border-radius: var(--jp-radius-lg);
    box-shadow: var(--jp-shadow);
}
.jp-aff-side-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.jp-aff-side-title .fas { color: var(--jp-aff-accent); }

.jp-aff-person { margin-bottom: 12px; }
.jp-aff-person-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--jp-text-3);
}
.jp-aff-person-value { font-size: 14px; font-weight: 600; color: var(--jp-text); }
a.jp-aff-person-value { color: var(--jp-aff-accent); }
a.jp-aff-person-value:hover { text-decoration: underline; }

.jp-aff-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    background: #e2e8f0;
    color: #475569;
}
.jp-aff-status.tone-ok { background: #dcfce7; color: #166534; }
.jp-aff-status.tone-info { background: #e0f2fe; color: #075985; }
.jp-aff-status.tone-warn { background: #fef3c7; color: #92400e; }
.jp-aff-status.tone-danger { background: #fee2e2; color: #991b1b; }

.jp-aff-classe {
    display: inline-block;
    min-width: 28px;
    text-align: center;
    padding: 2px 8px;
    border-radius: 8px;
    font-weight: 800;
    background: #e2e8f0;
}

.jp-aff-hero .jp-hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

@media (max-width: 1000px) {
    .jp-aff-layout { grid-template-columns: 1fr; }
    .jp-aff-aside { position: static; }
    .jp-aff-kpi.is-period,
    .jp-aff-kpi.is-since { grid-column: span 1; }
}
