.france-communes-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.25rem 0.85rem 2rem;
}

.preview-hero {
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.32) 0%, rgba(255, 255, 255, 0.14) 45%, rgba(255, 255, 255, 0.26) 100%),
        linear-gradient(90deg, #002395 0%, #1f4fb8 33%, #f8fbff 33%, #ffffff 66%, #ef4444 66%, #d92035 100%);
    border-radius: 18px;
    color: #0f172a;
    min-height: 88px;
    padding: 1.1rem 1.15rem;
    box-shadow: 0 22px 42px rgba(15, 23, 42, 0.28);
}

.preview-hero__title {
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    font-weight: 800;
    letter-spacing: 0.01em;
    margin: 0;
    text-shadow: none;
}

.preview-hero__sub {
    margin: 0.35rem 0 0;
    opacity: 0.96;
    font-size: 0.88rem;
    max-width: 72ch;
    text-shadow: none;
}

.preview-info-banner {
    margin-top: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid rgba(37, 99, 235, 0.24);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%),
        linear-gradient(135deg, #dbeafe 0%, #bfdbfe 42%, #93c5fd 100%);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.12);
}

.preview-info-banner__icon {
    width: 2rem;
    height: 2rem;
    flex: 0 0 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(239, 246, 255, 0.98));
    color: #1d4ed8;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.preview-info-banner__content {
    display: grid;
    gap: 0.22rem;
    color: #1e3a8a;
    line-height: 1.5;
    font-size: 0.85rem;
}

.preview-info-banner__title {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.preview-info-banner__title i {
    color: #1d4ed8;
    font-size: 0.86rem;
    line-height: 1;
}

.preview-info-banner__content strong {
    color: #0f172a;
    font-size: 0.9rem;
}

.preview-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 0.95rem;
    margin-top: 0.95rem;
}

.preview-panel {
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: 16px;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.preview-layout > .preview-panel:first-child {
    background:
        linear-gradient(180deg, rgba(248, 250, 252, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%),
        linear-gradient(135deg, rgba(0, 35, 149, 0.08) 0%, rgba(255, 255, 255, 0.12) 52%, rgba(237, 41, 57, 0.08) 100%);
    border-color: rgba(148, 163, 184, 0.22);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
}

.preview-panel__head {
    padding: 0.75rem 0.85rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
}

.preview-panel__title {
    font-size: 0.96rem;
    font-weight: 700;
    color: #0f172a;
}

.preview-panel__body {
    padding: 0.85rem;
}

.preview-controls {
    display: grid;
    gap: 0.7rem;
}

.preview-mode-card {
    padding: 0.8rem 0.85rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.16) 100%),
        linear-gradient(90deg, rgba(0, 35, 149, 0.16) 0%, rgba(0, 35, 149, 0.16) 33.33%, rgba(255, 255, 255, 0.82) 33.33%, rgba(255, 255, 255, 0.88) 66.66%, rgba(237, 41, 57, 0.16) 66.66%, rgba(237, 41, 57, 0.16) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 8px 18px rgba(15, 23, 42, 0.05);
}

.preview-mode-card__hint {
    margin-top: 0.45rem;
    font-size: 0.76rem;
    line-height: 1.45;
    color: #64748b;
}

.preview-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin-top: 0.1rem;
}

.preview-select-wrap__caret {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    pointer-events: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.preview-select-wrap__caret i {
    display: block;
    line-height: 1;
}

.preview-select-wrap__caret {
    right: 0.82rem;
    color: #64748b;
    font-size: 0.76rem;
}

.preview-select {
    appearance: none;
    -webkit-appearance: none;
    display: block;
    width: 100%;
    height: 3rem;
    padding: 0 2.35rem 0 0.95rem;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.97) 100%),
        linear-gradient(90deg, rgba(0, 35, 149, 0.05), rgba(255, 255, 255, 0.04), rgba(237, 41, 57, 0.05));
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    color: #0f172a;
    font-size: 0.93rem;
    font-weight: 700;
    line-height: 3rem;
    background-image: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.preview-select:hover {
    border-color: rgba(59, 130, 246, 0.42);
}

.preview-select:focus {
    border-color: rgba(29, 78, 216, 0.48);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.14), 0 12px 26px rgba(15, 23, 42, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.88);
    outline: none;
}

.preview-controls label {
    font-size: 0.73rem;
    font-weight: 700;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.preview-actions {
    display: block;
    margin-top: 0.25rem;
}

.preview-start-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.85rem 0.95rem;
    border: 0;
    border-radius: 16px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.06) 100%),
        linear-gradient(90deg, #002395 0%, #315dc8 46%, #ed2939 100%);
    color: #ffffff;
    text-align: left;
    box-shadow: 0 18px 28px rgba(37, 99, 235, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.preview-start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 22px 32px rgba(37, 99, 235, 0.28);
    filter: saturate(1.05);
}

.preview-start-btn:active {
    transform: translateY(0);
}

.preview-start-btn__icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.preview-start-btn strong {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
}

.preview-start-btn small {
    display: block;
    margin-top: 0.15rem;
    font-size: 0.75rem;
    opacity: 0.92;
}

.preview-kpis {
    margin-top: 0.8rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.preview-kpi {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.95) 100%);
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 14px;
    padding: 0.7rem 0.72rem;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
}

.preview-kpi__value {
    font-size: 1.02rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

.preview-kpi__label {
    margin-top: 0.2rem;
    font-size: 0.72rem;
    color: #475569;
}

.preview-progress {
    width: 100%;
    height: 9px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0.92), rgba(241, 245, 249, 0.98));
    overflow: hidden;
    margin-top: 0.75rem;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.preview-progress__bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #002395 0%, #ffffff 52%, #ed2939 100%);
    transition: width 0.22s ease;
}

.preview-log {
    margin-top: 0.65rem;
    font-size: 0.8rem;
    color: #334155;
    min-height: 1.2rem;
}

.preview-stage {
    position: relative;
    min-height: 620px;
    background: radial-gradient(circle at 35% 20%, #f8fbff 0%, #eef6ff 56%, #e3f0ff 100%);
    border-radius: 14px;
    overflow: hidden;
}

.preview-stage canvas,
.preview-stage svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.preview-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.86rem;
    color: #64748b;
    pointer-events: none;
}

.preview-loading {
    position: absolute;
    inset: 0;
    z-index: 9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.55rem;
    background: rgba(248, 250, 252, 0.72);
    backdrop-filter: blur(2px);
    pointer-events: none;
}

.preview-loading__spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(14, 165, 233, 0.26);
    border-top-color: #0ea5e9;
    animation: previewSpin 0.75s linear infinite;
}

.preview-loading__text {
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

@keyframes previewSpin {
    to {
        transform: rotate(360deg);
    }
}

.preview-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin-top: 0.95rem;
}

.preview-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border-radius: 999px;
    padding: 0.28rem 0.7rem 0.28rem 0.32rem;
    border: 1px solid color-mix(in srgb, var(--preview-chip-color, #94a3b8) 72%, #ffffff);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--preview-chip-text, #ffffff);
    background: linear-gradient(135deg, color-mix(in srgb, var(--preview-chip-color, #94a3b8) 94%, #ffffff) 0%, var(--preview-chip-color, #94a3b8) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 8px 18px rgba(15, 23, 42, 0.1);
}

.preview-chip__dot {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 1px 3px rgba(15, 23, 42, 0.18);
}

.preview-chip__text {
    display: inline-block;
    line-height: 1;
    color: inherit;
    text-shadow: 0 1px 0 rgba(15, 23, 42, 0.12);
}

.zoom-controls {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.zoom-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid #cbd5e1;
    background: rgba(255, 255, 255, 0.88);
    color: #1e293b;
    font-size: 0.8rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: background 0.15s, border-color 0.15s;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
    padding: 0;
}

.zoom-btn:hover {
    background: #fff;
    border-color: #94a3b8;
}

@media (max-width: 980px) {
    .preview-layout {
        grid-template-columns: 1fr;
    }

    .preview-info-banner {
        padding: 0.85rem 0.9rem;
    }

    .preview-stage {
        min-height: 520px;
    }

    .preview-start-btn {
        padding: 0.8rem 0.85rem;
    }
}
