.multiplication-fiches .card-header h2,
.multiplication-fiches .card-header .h5 { font-weight: 700; }

.multiplication-fiches-preview {
    min-height: 420px;
}

.mf-page {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: .75rem;
    padding: 1rem;
}

.mf-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    border: 1px solid #ced4da;
    border-radius: .5rem;
    padding: .5rem .75rem;
    margin-bottom: 1rem;
    font-size: .95rem;
}

.mf-page-meta { font-weight: 600; }

.mf-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .8rem;
    align-items: stretch;
}

.mf-grid.correction.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.mf-grid.correction.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mf-card {
    border: 1px solid #d9d9d9;
    border-radius: .8rem;
    padding: .6rem .7rem;
    background: #fff;
    height: 100%;
    box-sizing: border-box;
}

/* Aperçu calé sur la logique d'occupation verticale du PDF A4. */
.mf-grid.student.count-8 .mf-card { min-height: 235px; }
.mf-grid.student.count-10 .mf-card,
.mf-grid.student.count-12 .mf-card { min-height: 175px; }
.mf-grid.student.count-15 .mf-card { min-height: 140px; }

.mf-grid.correction.count-8 .mf-card { min-height: 200px; }
.mf-grid.correction.count-10 .mf-card { min-height: 160px; }
.mf-grid.correction.count-12 .mf-card { min-height: 135px; }
.mf-grid.correction.count-15 .mf-card { min-height: 150px; }

.mf-card-title {
    font-size: .92rem;
    font-weight: 700;
    color: #6c757d;
    margin-bottom: .35rem;
}

.mf-inline-expression {
    text-align: center;
    font-size: 1.45rem;
    font-weight: 700;
    margin: .45rem 0 .6rem;
}

.mf-to-pose-grid {
    border: 1px solid #d9d9d9;
    background-image:
        linear-gradient(#e9ecef 1px, transparent 1px),
        linear-gradient(90deg, #e9ecef 1px, transparent 1px);
    background-size: 22px 22px;
    height: 130px;
    border-radius: .2rem;
}
.mf-grid.student.count-8 .mf-to-pose-grid { height: 185px; }
.mf-grid.student.count-10 .mf-to-pose-grid,
.mf-grid.student.count-12 .mf-to-pose-grid { height: 130px; }
.mf-grid.student.count-15 .mf-to-pose-grid { height: 96px; }

.mf-vertical {
    --cell-w: 16px;
    font-family: 'Courier New', monospace;
    display: block;
    width: 100%;
    text-align: center;
}

.mf-vertical-table {
    border-collapse: collapse;
    margin-left: auto;
    margin-right: auto;
}

.mf-vertical-table td {
    width: var(--cell-w);
    min-width: var(--cell-w);
    height: 18px;
    text-align: center;
    vertical-align: bottom;
    padding: 0;
    font-size: 1.05rem;
    line-height: 1;
    font-weight: 700;
    color: #212529;
    position: relative;
}

.mf-vertical-table tr.mf-carry-row td,
.mf-vertical-table tr.mf-add-carry-row td {
    height: 12px;
    font-size: .7rem;
    font-weight: 700;
}

.mf-vertical-table tr.mf-carry-row td.stage-0 { color: #1f6feb; }
.mf-vertical-table tr.mf-carry-row td.stage-1 { color: #8a2be2; }
.mf-vertical-table tr.mf-carry-row td.stage-2 { color: #198754; }
.mf-vertical-table tr.mf-carry-row td.stage-3 { color: #fd7e14; }
.mf-vertical-table tr.mf-add-carry-row td { color: #d63384; }

.mf-op-sign { width: 18px !important; min-width: 18px !important; }
.mf-line td { border-bottom: 2px solid #212529; height: 2px !important; }
.mf-digit.grey { color: #adb5bd; }
.mf-digit.result { color: #5b2ea6; }
.mf-has-comma {
    position: relative;
}

.mf-comma {
    position: absolute;
    right: -0.22em;
    bottom: 0.02em;
    color: #dc3545;
    font-size: 1.05em;
    line-height: 1;
    font-weight: 700;
    pointer-events: none;
}
.mf-partial.stage-0 .mf-digit { color: #198754; }
.mf-partial.stage-1 .mf-digit { color: #0d6efd; }
.mf-partial.stage-2 .mf-digit { color: #fd7e14; }
.mf-partial.stage-3 .mf-digit { color: #20c997; }
.mf-bottom .mf-digit { color: #6f42c1; }

.mf-empty-cell::after { content: '\00a0'; }

@media (max-width: 992px) {
    .mf-grid,
    .mf-grid.correction.cols-2,
    .mf-grid.correction.cols-3 {
        grid-template-columns: 1fr;
    }
}
