/* ==============================================================================
 * Mentifyll: Töltsd fel az elméd! — Részletes haladás-riport stílusok (R1–R10)
 * A public/assets/js/reports.js felületéhez. Csak a téma-változókat használja
 * (sötét / világos), az elrendezés a #report-root konténer szélességéhez igazodik
 * (container query), a nyomtatási nézet a body.printing-report osztályra épül.
 * Készítők: Kormos Attila, Google Gemini és Claude Opus
 * ============================================================================== */

/* ---------- 0. Alapok ---------- */
#report-root {
    container-type: inline-size;
    container-name: rp;
    min-width: 0;
    --rp-muted: var(--color-text-muted, #94a3b8);
    --rp-text: var(--color-card-text, #e2e8f0);
    color: var(--rp-text);
}

body.theme-light #report-root {
    --rp-muted: #475569;
}

#report-root *,
#report-root *::before,
#report-root *::after {
    box-sizing: border-box;
}

#report-root :focus-visible {
    outline: 3px solid var(--btn-primary-bg, var(--color-primary, #2dd4bf));
    outline-offset: 2px;
}

.rp-sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Szemantikus színtónusok (a környező szöveg is mindig kiírja a jelentést, nem csak a szín jelez) */
.rp-tone-success { --tone-fg: var(--success-fg, #15803d); --tone-bg: var(--success-bg, #dcfce7); --tone-bd: var(--success-border, #86efac); }
.rp-tone-info { --tone-fg: var(--info-fg, #0369a1); --tone-bg: var(--info-bg, #e0f2fe); --tone-bd: var(--info-border, #7dd3fc); }
.rp-tone-warning { --tone-fg: var(--warning-fg, #92400e); --tone-bg: var(--warning-bg, #fef3c7); --tone-bd: var(--warning-border, #fcd34d); }
.rp-tone-danger { --tone-fg: var(--danger-fg, #b91c1c); --tone-bg: var(--danger-bg, #fee2e2); --tone-bd: var(--danger-border, #fca5a5); }
.rp-tone-neutral { --tone-fg: var(--rp-muted, #475569); --tone-bg: var(--color-surface-variant, #f0f4f9); --tone-bd: var(--color-border, #e2e8f0); }

/* ---------- 1. Nézetváltó az Elemzés fejlécében + riport-mód ---------- */
.rp-analytics-head > .rp-viewswitch {
    flex: 1 0 100%;
    order: 3;
    display: flex;
    gap: 0;
    margin-top: 4px;
}

.rp-vs-btn {
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-main);
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}

.rp-vs-btn:first-child {
    border-radius: var(--radius-full) 0 0 var(--radius-full);
}

.rp-vs-btn:last-child {
    border-radius: 0 var(--radius-full) var(--radius-full) 0;
    margin-left: -1px;
}

.rp-vs-btn:hover {
    background: var(--color-surface-hover, var(--color-surface-variant));
}

.rp-vs-btn[aria-pressed="true"] {
    background: var(--btn-primary-bg, var(--color-primary));
    border-color: var(--btn-primary-bg, var(--color-primary));
    color: var(--on-primary, #042f2b);
    position: relative;
    z-index: 1;
}

.rp-vs-btn:focus-visible {
    outline: 3px solid var(--btn-primary-bg, var(--color-primary));
    outline-offset: 2px;
    position: relative;
    z-index: 2;
}

@media (max-width: 520px) {
    .rp-analytics-head > .rp-viewswitch .rp-vs-btn {
        flex: 1 1 0;
        padding: 0 8px;
        font-size: 0.86rem;
    }
}

/* Riport-módban az Elemzés fül többi tartalma rejtve (a fejléc és a riport marad); az oszlopos elrendezés is kikapcsol */
#tab-analytics.rp-mode-report {
    column-count: auto;
    column-width: auto;
}

#tab-analytics.rp-mode-report > :not(.rp-analytics-head):not(#report-root) {
    display: none !important;
}

#tab-analytics.rp-mode-report > .rp-analytics-head .rp-ov-actions {
    display: none !important;
}

/* ---------- 2. Eszköztár ---------- */
#report-root .rp-toolbar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0 0 var(--space-md, 16px);
    padding: 16px;
}

.rp-tb-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px 20px;
}

.rp-student-holder {
    min-width: 0;
}

.rp-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.rp-field-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--rp-muted);
}

#report-root .rp-select,
#report-root .rp-field--date .form-input {
    min-height: 44px;
    max-width: 100%;
}

#report-root .rp-select {
    min-width: 190px;
}

.rp-student-fixed {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
    color: var(--color-heading);
}

.rp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.rp-chip {
    min-height: 44px;
    padding: 0 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
    color: var(--color-text-main);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.rp-chip:hover {
    border-color: var(--btn-primary-bg, var(--color-primary));
}

.rp-chip[aria-pressed="true"] {
    background: var(--btn-primary-bg, var(--color-primary));
    border-color: var(--btn-primary-bg, var(--color-primary));
    color: var(--on-primary, #042f2b);
}

.rp-tb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-left: auto;
}

#report-root .rp-btn {
    width: auto;
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.9rem;
}

#report-root .rp-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.rp-custom {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding: 12px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
}

.rp-custom[hidden] {
    display: none;
}

.rp-form-error {
    flex: 1 0 100%;
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--danger-fg, #b91c1c);
}

.rp-form-error:empty {
    display: none;
}

.rp-period {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 18px;
    margin: 0;
    font-size: 0.88rem;
    color: var(--rp-text);
}

.rp-period:empty {
    display: none;
}

.rp-period-prev {
    color: var(--rp-muted);
}

/* ---------- 3. Rács és kártyák ---------- */
.rp-content {
    min-width: 0;
}

.rp-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-md, 16px);
}

#report-root .rp-card {
    position: relative;
    min-width: 0;
    margin: 0;
    scroll-margin-top: 84px;
}

#report-root .rp-card:focus {
    outline: none;
}

#report-root .rp-card:focus-visible {
    outline: 3px solid var(--btn-primary-bg, var(--color-primary));
    outline-offset: 2px;
}

@container rp (min-width: 860px) {
    .rp-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
    }

    .rp-card--wide {
        grid-column: 1 / -1;
    }
}

.rp-card-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
}

.rp-ico {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    font-size: 1.3rem;
    line-height: 1;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-head-text {
    flex: 1;
    min-width: 0;
}

#report-root .rp-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
    margin: 0 0 4px;
    font-size: 1.1rem;
}

.rp-no {
    padding: 2px 8px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
    color: var(--rp-text);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.rp-explain {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--rp-muted);
}

.rp-explain strong {
    color: var(--rp-text);
}

.rp-card-body {
    min-width: 0;
}

.rp-sub {
    margin: 18px 0 8px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--color-heading);
    break-after: avoid;
    page-break-after: avoid;
}

.rp-sub:first-child {
    margin-top: 0;
}

.rp-split {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 4px 24px;
}

.rp-col {
    min-width: 0;
}

@container rp (min-width: 860px) {
    .rp-card--wide .rp-split {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.rp-chartbox {
    min-width: 0;
    max-width: 100%;
}

/* A halmozott sáv és jelmagyarázata balra igazítva, olvasható szélességben */
#report-root .mc-stack .mc-svg {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

#report-root .mc-stack,
#report-root .mc-donut .mc-legend {
    max-width: 520px;
}

/* Aktivitás-naptár: rövid időszaknál a számok a naptár mellett */
.rp-calwrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px 24px;
    align-items: center;
}

.rp-calwrap .rp-facts {
    margin-top: 0;
}

@container rp (min-width: 860px) {
    .rp-calwrap {
        grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    }

    .rp-calwrap .rp-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.rp-note {
    margin: 8px 0 0;
    font-size: 0.8rem;
    line-height: 1.45;
    color: var(--rp-muted);
}

.rp-note-inline {
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--rp-muted);
}

.rp-muted {
    font-size: 0.82rem;
    color: var(--rp-muted);
}

.rp-foot {
    margin: 16px 0 0;
    text-align: center;
    font-size: 0.78rem;
    color: var(--rp-muted);
}

.rp-na {
    display: inline-block;
    padding: 1px 8px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
    color: var(--rp-muted);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.rp-tier,
.rp-prio {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    border: 1px solid var(--tone-bd);
    border-radius: var(--radius-full);
    background: var(--tone-bg);
    color: var(--tone-fg);
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1.5;
    white-space: nowrap;
}

.rp-callout {
    margin: 10px 0 0;
    padding: 10px 12px;
    border: 1px solid var(--tone-bd);
    border-radius: var(--radius-md);
    background: var(--tone-bg);
    color: var(--tone-fg);
    font-size: 0.9rem;
    line-height: 1.45;
}

/* ---------- 4. Állapotok: üres, hiba, váz, szalag ---------- */
.rp-empty {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-md);
    color: var(--rp-text);
}

.rp-empty-ico {
    font-size: 1.6rem;
    line-height: 1.2;
}

.rp-empty-text {
    margin: 0 0 6px;
    font-size: 0.92rem;
    line-height: 1.5;
}

.rp-empty .rp-note {
    margin-top: 0;
    margin-bottom: 8px;
}

#report-root .rp-error {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-color: var(--danger-border);
}

.rp-error-text {
    margin: 4px 0 12px;
    line-height: 1.5;
}

.rp-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 16px;
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--info-border);
    border-radius: var(--radius-md);
    background: var(--info-bg);
    color: var(--info-fg);
    line-height: 1.45;
}

.rp-banner-ico {
    font-size: 1.6rem;
}

.rp-banner-text {
    flex: 1 1 260px;
    min-width: 0;
}

.rp-banner-act {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rp-skel {
    border-radius: 8px;
    background: linear-gradient(90deg, var(--color-surface-variant) 25%, var(--color-border) 37%, var(--color-surface-variant) 63%);
    background-size: 400% 100%;
    animation: rp-shimmer 1.4s ease infinite;
}

.rp-skel--title { width: 45%; height: 22px; margin-bottom: 12px; }
.rp-skel--line { width: 80%; height: 14px; margin-bottom: 14px; }
.rp-skel--block { height: 120px; }

@keyframes rp-shimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .rp-skel {
        animation: none;
    }
}

/* ---------- 5. R1: mutatók ---------- */
.rp-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.rp-tiles--sm {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.rp-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-tile--tone {
    border-color: var(--tone-bd);
    background: var(--tone-bg);
}

.rp-tile--tone .rp-tile-value {
    color: var(--tone-fg);
}

.rp-tile-label {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--rp-text);
}

.rp-tile-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

.rp-tile-value small {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rp-muted);
}

.rp-tile--tone .rp-tile-value small {
    color: inherit;
}

.rp-tile-delta {
    min-height: 22px;
}

.rp-tile-prev {
    font-size: 0.75rem;
    line-height: 1.35;
    color: var(--rp-muted);
}

.rp-tile--tone .rp-tile-prev {
    color: var(--rp-text);
}

.rp-kpi-extra {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    align-items: start;
    gap: 14px 20px;
}

@container rp (max-width: 719px) {
    .rp-kpi-extra {
        grid-template-columns: minmax(0, 1fr);
    }
}

.rp-level-top {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 12px;
    margin-bottom: 6px;
    color: var(--color-heading);
}

.rp-bar {
    height: 12px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
}

.rp-bar > span {
    display: block;
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--btn-primary-bg, var(--color-primary));
}

.rp-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.rp-kpi-extra .rp-facts {
    margin-top: 0;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.rp-fact {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-fact-ico {
    font-size: 1.2rem;
    line-height: 1.3;
}

.rp-fact-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.rp-fact-v {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--color-heading);
}

.rp-fact-l,
.rp-fact-x {
    font-size: 0.78rem;
    line-height: 1.35;
    color: var(--rp-muted);
}

/* ---------- 6. R3: tantárgyi táblázat ---------- */
.rp-tablewrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    -webkit-overflow-scrolling: touch;
}

.rp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.rp-table th,
.rp-table td {
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border);
}

.rp-table tbody tr:last-child > * {
    border-bottom: 0;
}

.rp-table thead th {
    background: var(--color-surface-variant);
    color: var(--rp-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.rp-table .rp-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.rp-td-name {
    min-width: 175px;
    font-weight: 700;
    color: var(--color-heading);
}

.rp-namecell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rp-subj-name {
    overflow-wrap: break-word;
}

.rp-dot {
    display: inline-block;
    flex: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 0 1px var(--color-border);
}

.rp-mast {
    display: grid;
    grid-template-columns: minmax(70px, 140px) minmax(0, 1fr);
    align-items: center;
    gap: 4px 10px;
}

.rp-table .rp-mast {
    grid-template-columns: minmax(50px, 1fr) auto;
    min-width: 170px;
}

.rp-mast-text {
    font-size: 0.82rem;
    line-height: 1.4;
}

.rp-meter {
    display: block;
    height: 10px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    background: var(--color-surface-variant);
}

.rp-meter-fill {
    display: block;
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--tone-fg);
}

.rp-cell-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.rp-chg-sub {
    font-size: 0.74rem;
    color: var(--rp-muted);
}

.rp-td-trend svg {
    max-width: 104px;
}

/* Keskeny konténer (mobil / tablet): a táblázat soronkénti kártyákká alakul */
@media screen {
    @container rp (max-width: 899px) {
        .rp-tablewrap {
            overflow: visible;
            border: 0;
        }

        .rp-table,
        .rp-table tbody,
        .rp-table tr,
        .rp-table th,
        .rp-table td {
            display: block;
        }

        .rp-table thead {
            position: absolute;
            width: 1px;
            height: 1px;
            overflow: hidden;
            clip: rect(0, 0, 0, 0);
        }

        .rp-table tr {
            margin-bottom: 10px;
            padding: 10px 12px;
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            background: var(--color-surface-variant);
        }

        .rp-table tr:last-child {
            margin-bottom: 0;
        }

        .rp-table th.rp-td-name {
            min-width: 0;
            padding: 0 0 8px;
            border: 0;
            font-size: 1rem;
        }

        .rp-table td {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 12px;
            padding: 6px 0;
            border: 0;
            text-align: right;
        }

        .rp-table td::before {
            content: attr(data-label);
            flex: 0 0 34%;
            text-align: left;
            font-size: 0.74rem;
            font-weight: 700;
            letter-spacing: 0.03em;
            text-transform: uppercase;
            color: var(--rp-muted);
        }

        .rp-table .rp-mast {
            min-width: 0;
            flex: 1 1 auto;
            grid-template-columns: minmax(50px, 1fr) auto;
        }

        .rp-table .rp-cell-stack {
            align-items: flex-end;
        }

        .rp-table .rp-td-trend {
            justify-content: space-between;
        }
    }
}

/* ---------- 7. Listák (R4, R8) ---------- */
.rp-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-item-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.rp-item-title {
    font-weight: 700;
    line-height: 1.35;
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

.rp-item-sub,
.rp-item-meta {
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--rp-muted);
}

.rp-item-act {
    flex: none;
}

.rp-clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

.rp-minibar {
    max-width: 360px;
}

.rp-minibar .mc-svg {
    margin: 0;
}

.rp-hint {
    margin: 0 0 12px;
    padding: 8px 12px;
    border-left: 3px solid var(--info-fg);
    border-radius: 6px;
    background: var(--color-surface-variant);
    color: var(--rp-text);
}

@container rp (max-width: 560px) {
    .rp-item {
        flex-direction: column;
        align-items: stretch;
    }

    .rp-item-act .rp-btn {
        width: 100%;
    }
}

/* ---------- 8. R6: magabiztosság ---------- */
.rp-matrix {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 6px;
    margin: -6px;
    width: calc(100% + 12px);
}

.rp-matrix th {
    padding: 4px;
    text-align: center;
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--rp-muted);
    overflow-wrap: anywhere;
}

.rp-matrix tbody th {
    width: 26%;
    text-align: right;
}

.rp-mx {
    padding: 10px 6px;
    vertical-align: top;
    text-align: center;
    border: 1px solid var(--tone-bd);
    border-radius: var(--radius-md);
    background: var(--tone-bg);
    color: var(--tone-fg);
}

.rp-mx--hl {
    border-width: 2px;
}

.rp-mx-ico {
    display: block;
    font-size: 1.1rem;
}

.rp-mx-v {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.rp-mx-p {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
}

.rp-mx-l {
    display: block;
    margin-top: 4px;
    font-size: 0.72rem;
    line-height: 1.25;
}

/* ---------- 9. R7: emlékezet ---------- */
.rp-legend-help {
    display: grid;
    gap: 2px;
    margin: 10px 0 12px;
    padding: 0;
    list-style: none;
    font-size: 0.8rem;
    line-height: 1.4;
    color: var(--rp-muted);
}

.rp-legend-help strong {
    color: var(--rp-text);
}

.rp-retention {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px 18px;
    margin-top: 4px;
}

.rp-ring {
    flex: none;
    width: 96px;
}

.rp-retention-text {
    flex: 1 1 200px;
    min-width: 0;
    color: var(--color-heading);
}

/* ---------- 10. R9: iskola ---------- */
.rp-gradegrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.rp-gcard {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-gcard-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
}

.rp-gname {
    font-weight: 700;
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

.rp-gavg {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--color-heading);
    font-variant-numeric: tabular-nums;
}

.rp-gmeta,
.rp-gtrend {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--rp-muted);
}

.rp-gmeta strong {
    color: var(--rp-text);
}

.rp-recent {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-recent-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-gbadge {
    flex: none;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--tone-bd);
    border-radius: 50%;
    background: var(--tone-bg);
    color: var(--tone-fg);
    font-weight: 800;
}

.rp-recent-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    color: var(--color-heading);
}

.rp-exams {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-exam {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-exam-ring {
    flex: none;
    display: grid;
    place-items: center;
    width: 76px;
}

.rp-exam-main {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    min-width: 0;
}

.rp-exam-title {
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

/* ---------- 11. R10: összefoglaló és javaslatok ---------- */
.rp-summary {
    margin: 0 0 12px;
    padding: 12px 14px;
    border-left: 4px solid var(--btn-primary-bg, var(--color-primary));
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--color-heading);
}

.rp-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
}

.rp-findings,
.rp-todos {
    display: grid;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rp-finding {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--tone-bd);
    border-left-width: 5px;
    border-radius: var(--radius-md);
    background: var(--tone-bg);
}

.rp-find-ico {
    font-size: 1.3rem;
    line-height: 1.3;
}

.rp-find-body {
    flex: 1;
    min-width: 0;
}

.rp-find-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
}

.rp-sev {
    padding: 1px 8px;
    border: 1px solid var(--tone-bd);
    border-radius: var(--radius-full);
    color: var(--tone-fg);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.rp-find-title {
    color: var(--tone-fg);
}

.rp-find-text {
    margin: 4px 0 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--rp-text);
}

.rp-tone-warning .rp-find-text,
.rp-tone-danger .rp-find-text,
.rp-tone-info .rp-find-text,
.rp-tone-success .rp-find-text {
    color: var(--color-card-text, var(--rp-text));
}

body.theme-light .rp-finding .rp-find-text {
    color: #1e293b;
}

.rp-find-act {
    margin-top: 8px;
}

.rp-todo {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-variant);
}

.rp-todo-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.rp-todo-text {
    line-height: 1.45;
    color: var(--color-heading);
    overflow-wrap: anywhere;
}

/* ---------- 12. Mobil finomítások ---------- */
@container rp (max-width: 560px) {
    .rp-tb-actions {
        flex: 1 1 100%;
        margin-left: 0;
    }

    .rp-tb-actions .rp-btn {
        flex: 1 1 0;
    }

    #report-root .rp-select {
        min-width: 0;
        width: 100%;
    }

    .rp-student-holder,
    .rp-field--range,
    .rp-student-holder .rp-field {
        flex: 1 1 100%;
    }

    .rp-chips {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .rp-chip {
        padding: 0 6px;
    }

    .rp-field--date {
        flex: 1 1 100%;
    }

    .rp-custom .rp-apply {
        flex: 1 1 100%;
    }

    .rp-card-head {
        gap: 10px;
    }

    .rp-ico {
        width: 36px;
        height: 36px;
    }

    .rp-tile-value {
        font-size: 1.3rem;
    }

    .rp-exam {
        align-items: flex-start;
    }
}

/* ---------- 13. Nyomtatási fejléc: képernyőn nem látszik ---------- */
.rp-print-head {
    display: none;
}

/* ---------- 14. Nyomtatás: csak a riport, A4 álló, világos háttér ---------- */
@page report {
    size: A4 portrait;
    margin: 12mm;
}

@media print {
    html.rp-printing {
        background: #ffffff !important;
        color-scheme: light !important;
    }

    html:has(body.printing-report) {
        background: #ffffff !important;
        color-scheme: light !important;
    }

    body.printing-report {
        color-scheme: light;
        page: report;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        color: #111827 !important;
        font-size: 12px;
        overflow: visible !important;
    }

    body.printing-report .app-header,
    body.printing-report .bottom-nav,
    body.printing-report .app-footer,
    body.printing-report .toast-stack-container,
    body.printing-report .pwa-banner,
    body.printing-report .update-banner,
    body.printing-report .offline-banner,
    body.printing-report .modal-backdrop,
    body.printing-report .lightbox,
    body.printing-report nav,
    body.printing-report header.app-header,
    body.printing-report .no-print,
    body.printing-report .tab-view:not(#tab-analytics),
    body.printing-report #view-auth,
    body.printing-report #tab-analytics > :not(#report-root),
    body.printing-report .rp-toolbar,
    body.printing-report .rp-no-print,
    body.printing-report .rp-banner,
    body.printing-report .rp-act,
    body.printing-report #report-root .rp-btn,
    body.printing-report .rp-ico {
        display: none !important;
    }

    body.printing-report .app-content {
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body.printing-report #tab-analytics {
        display: block !important;
        column-count: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        animation: none !important;
    }

    body.printing-report #report-root {
        display: block !important;
        width: auto;
        color: #111827;
        background: #ffffff;
        /* A diagramok és a jelzések világos-téma színekkel készülnek akkor is, ha a képernyőn sötét a téma */
        --color-primary: #00796b;
        --color-primary-dark: #00695c;
        --btn-primary-bg: #00796b;
        --on-primary: #ffffff;
        --color-card-text: #1e293b;
        --color-card-title: #0f172a;
        --color-heading: #0f172a;
        --color-text-main: #111827;
        --color-text-muted: #475569;
        --rp-muted: #475569;
        --rp-text: #1e293b;
        --color-surface: #ffffff;
        --color-surface-variant: #f1f5f9;
        --color-border: #cbd5e1;
        --success-fg: #166534;
        --success-bg: #dcfce7;
        --success-border: #86efac;
        --warning-fg: #92400e;
        --warning-bg: #fef3c7;
        --warning-border: #fcd34d;
        --danger-fg: #b91c1c;
        --danger-bg: #fee2e2;
        --danger-border: #fca5a5;
        --info-fg: #075985;
        --info-bg: #e0f2fe;
        --info-border: #7dd3fc;
    }

    body.printing-report #report-root,
    body.printing-report #report-root * {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    body.printing-report .rp-print-head {
        display: block;
        margin: 0 0 10px;
        padding: 0 0 8px;
        border-bottom: 2px solid #00796b;
    }

    body.printing-report .rp-print-title {
        margin: 0 0 6px;
        font-size: 19px;
        font-weight: 800;
        color: #0f172a;
    }

    body.printing-report .rp-print-meta {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px 16px;
        margin: 0;
        font-size: 11.5px;
        color: #1e293b;
    }

    body.printing-report .rp-print-meta dt {
        display: inline;
        margin-right: 6px;
        font-weight: 700;
    }

    body.printing-report .rp-print-meta dd {
        display: inline;
        margin: 0;
    }

    body.printing-report .rp-grid {
        display: block;
    }

    body.printing-report #report-root .rp-card {
        margin: 0 0 8px !important;
        padding: 9px 11px !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 8px;
        background: #ffffff !important;
        box-shadow: none !important;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body.printing-report .rp-card-head {
        margin-bottom: 8px;
        break-after: avoid;
        page-break-after: avoid;
    }

    body.printing-report #report-root .rp-title {
        font-size: 14px;
        color: #0f172a;
    }

    body.printing-report .rp-explain {
        font-size: 10.5px;
    }

    body.printing-report .rp-tile-value {
        font-size: 17px;
    }

    body.printing-report .rp-tile,
    body.printing-report .rp-item,
    body.printing-report .rp-fact,
    body.printing-report .rp-gcard,
    body.printing-report .rp-exam,
    body.printing-report .rp-finding,
    body.printing-report .rp-todo,
    body.printing-report .rp-recent-item,
    body.printing-report .rp-callout,
    body.printing-report .rp-matrix,
    body.printing-report .rp-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    body.printing-report .rp-tiles {
        gap: 6px;
        margin-bottom: 8px;
    }

    body.printing-report .rp-tile {
        padding: 7px 8px;
    }

    body.printing-report .rp-split {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 4px 14px;
    }

    body.printing-report .rp-list {
        gap: 5px;
    }

    body.printing-report .rp-item {
        padding: 6px 8px;
        gap: 8px;
    }

    body.printing-report .rp-item-title {
        font-size: 11.5px;
    }

    body.printing-report .rp-item-sub,
    body.printing-report .rp-item-meta {
        font-size: 10px;
    }

    body.printing-report .rp-sub {
        margin: 10px 0 6px;
        font-size: 12px;
    }

    body.printing-report .rp-calwrap {
        grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    }

    body.printing-report .rp-calwrap .rp-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.printing-report .rp-tablewrap {
        overflow: visible;
        border: 1px solid #cbd5e1;
    }

    body.printing-report .rp-table {
        font-size: 10.5px;
    }

    body.printing-report .rp-table th,
    body.printing-report .rp-table td {
        padding: 5px 6px;
    }

    body.printing-report .rp-table .rp-mast {
        min-width: 0;
    }

    body.printing-report .rp-td-name {
        min-width: 0;
    }

    body.printing-report .rp-gradegrid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    body.printing-report .rp-kpi-extra {
        grid-template-columns: minmax(0, 1fr);
    }

    body.printing-report .mc-heatmap-scroll {
        overflow: visible;
    }

    body.printing-report .mc-heatmap .mc-svg {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto;
    }

    body.printing-report .rp-calwrap .mc-heatmap .mc-svg {
        max-width: 250px !important;
    }

    body.printing-report .rp-foot {
        font-size: 10px;
    }
}