/* ============================================================
   Curricolo Verticale SSAS — Area di Indirizzo (+ base condivisa)
   Design "Aurora": vetro, gradienti indaco/ciano, micro-animazioni
   ============================================================ */

:root {
    color-scheme: light;
    --bg-body: #eef1fa;
    --ink: #0b1220;
    --ink-soft: #4b5872;
    --ink-faint: #626d82;
    --accent-a: #4f46e5;
    --accent-b: #0ea5e9;
    --accent-c: #8b5cf6;
    --grad-accent: linear-gradient(120deg, var(--accent-a) 0%, var(--accent-c) 50%, var(--accent-b) 100%);
    --card: rgba(255, 255, 255, 0.82);
    --card-solid: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.85);
    --stroke: rgba(99, 102, 241, 0.16);
    --stroke-soft: rgba(148, 163, 184, 0.22);
    --shadow-card: 0 18px 44px -30px rgba(30, 41, 99, 0.45);
    --shadow-hover: 0 26px 60px -30px rgba(30, 41, 99, 0.5);
    --radius-lg: 22px;
    --radius-md: 14px;
    --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-display: "Sora", var(--font-body);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--ink);
    background-color: var(--bg-body);
}

h1, h2, h3,
.stat-value,
.card-value {
    font-family: var(--font-display);
}

/* Aurora quando la pagina è aperta da sola */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(900px 520px at 12% -6%, rgba(99, 102, 241, 0.22), transparent 62%),
        radial-gradient(820px 480px at 88% 4%, rgba(14, 165, 233, 0.20), transparent 60%),
        radial-gradient(760px 560px at 50% 108%, rgba(139, 92, 246, 0.16), transparent 62%),
        var(--bg-body);
}

/* Dentro l'iframe: sfondo trasparente (lo mette il genitore) e
   nessuno scroll interno — l'altezza è gestita dalla pagina madre */
html.embedded {
    overflow: hidden;
}

html.embedded body {
    background: transparent;
    overflow: hidden;
}

html.embedded body::before {
    display: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

/* Dentro l'iframe i margini laterali li dà già la pagina madre */
html.embedded .container {
    padding: 6px 4px 28px;
}

/* L'hero lo mostra già la pagina madre: dentro l'iframe è ridondante */
html.embedded .page-hero {
    display: none;
}

/* ---------- Header ---------- */

.header {
    text-align: center;
    margin-bottom: 32px;
}

.header.page-hero {
    margin-bottom: 34px;
    display: flex;
    justify-content: center;
}

.hero-card {
    position: relative;
    width: min(980px, 100%);
    background: var(--card);
    border-radius: 26px;
    padding: clamp(24px, 4vw, 42px);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    overflow: hidden;
}

.hero-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: var(--grad-accent);
}

.header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--ink);
    margin-bottom: 8px;
}

.subline {
    color: var(--ink-soft);
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.subtitle {
    color: var(--ink-faint);
    font-size: 0.95rem;
    font-style: italic;
}

.header.page-hero h1 {
    font-size: clamp(1.7rem, 3.6vw, 2.4rem);
    line-height: 1.15;
    margin-bottom: 12px;
    background: linear-gradient(115deg, #1e1b4b 0%, var(--accent-a) 45%, var(--accent-b) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.header.page-hero .subline {
    font-size: clamp(0.9rem, 2vw, 1rem);
    margin-bottom: 10px;
}

.header.page-hero .subtitle {
    font-size: clamp(0.85rem, 1.8vw, 0.95rem);
    margin-bottom: 0;
}

/* ---------- Statistiche in testa ---------- */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    position: relative;
    background: var(--card);
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    overflow: hidden;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--stat-accent, var(--grad-accent));
}

.stat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.stat-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    font-size: 1.3rem;
    border-radius: 12px;
    background: var(--stat-chip, rgba(99, 102, 241, 0.12));
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
}

.stat-value {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}

.stat-subtitle {
    font-size: 0.78rem;
    color: var(--ink-faint);
    font-weight: 500;
}

.stat-card.blue   { --stat-accent: linear-gradient(90deg, #2563eb, #38bdf8); --stat-chip: rgba(37, 99, 235, 0.12); }
.stat-card.green  { --stat-accent: linear-gradient(90deg, #059669, #34d399); --stat-chip: rgba(5, 150, 105, 0.12); }
.stat-card.purple { --stat-accent: linear-gradient(90deg, #7c3aed, #c084fc); --stat-chip: rgba(124, 58, 237, 0.12); }
.stat-card.orange { --stat-accent: linear-gradient(90deg, #ea580c, #fbbf24); --stat-chip: rgba(234, 88, 12, 0.12); }

.stat-card.blue .stat-value   { color: #1d4ed8; }
.stat-card.green .stat-value  { color: #047857; }
.stat-card.purple .stat-value { color: #6d28d9; }
.stat-card.orange .stat-value { color: #c2410c; }

/* Compat: classi colore usate anche altrove */
.blue   { color: #1d4ed8; }
.green  { color: #047857; }
.purple { color: #6d28d9; }
.orange { color: #c2410c; }

/* ---------- Pannello filtri ---------- */

.filter-panel {
    background: var(--card);
    padding: 22px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: 30px;
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.filter-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    border-radius: 11px;
    background: rgba(99, 102, 241, 0.12);
}

.filter-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.filter-item label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ink-soft);
    margin-bottom: 6px;
}

.filter-item select,
#rubrica-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--stroke-soft);
    border-radius: 10px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--card-solid);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    min-height: 44px;
}

.filter-item select:hover,
#rubrica-select:hover {
    border-color: rgba(99, 102, 241, 0.45);
}

.filter-item select:focus,
#rubrica-select:focus,
.search-container input:focus {
    outline: none;
    border-color: var(--accent-a);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.search-row {
    display: flex;
    gap: 14px;
    align-items: center;
    flex-wrap: wrap;
}

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

.export-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.action-label {
    color: var(--ink-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.rubrica-picker {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-right: 8px;
}

.rubrica-picker #rubrica-select {
    width: auto;
    max-width: 280px;
}

.search-container {
    flex: 1;
    min-width: 240px;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 11px 42px 11px 14px;
    border: 1px solid var(--stroke-soft);
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
    color: var(--ink);
    background: var(--card-solid);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-container input::placeholder {
    color: var(--ink-faint);
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-faint);
    pointer-events: none;
}

/* ---------- Pulsanti ---------- */

.primary-btn,
.secondary-btn,
.reset-btn {
    font-family: inherit;
    font-weight: 600;
    font-size: 0.86rem;
    border-radius: 11px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
    min-height: 44px;
}

.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.reset-btn:focus-visible,
.anno-pill:focus-visible,
.group-header:focus-visible,
.gen-acc-header:focus-visible,
.uda-acc-header:focus-visible {
    outline: 3px solid rgba(14, 165, 233, 0.55);
    outline-offset: 3px;
}

.primary-btn {
    padding: 10px 18px;
    background: var(--grad-accent);
    color: #ffffff;
    border: none;
    box-shadow: 0 10px 24px -10px rgba(79, 70, 229, 0.55);
}

.primary-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px -10px rgba(79, 70, 229, 0.65);
}

.primary-btn:active {
    transform: translateY(1px);
    box-shadow: 0 6px 16px -8px rgba(79, 70, 229, 0.55);
}

.secondary-btn {
    padding: 10px 16px;
    background: var(--card-solid);
    color: var(--ink-soft);
    border: 1px solid var(--stroke-soft);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.secondary-btn:hover {
    border-color: rgba(99, 102, 241, 0.45);
    color: var(--accent-a);
    transform: translateY(-1px);
}

.secondary-btn:active {
    transform: translateY(1px);
}

.reset-btn {
    padding: 10px 16px;
    background: rgba(148, 163, 184, 0.15);
    color: var(--ink-soft);
    border: 1px solid transparent;
}

.reset-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

/* ---------- Tabella statistiche ---------- */

.stats-table-container {
    background: var(--card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 30px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.stats-table-header {
    background: linear-gradient(120deg, rgba(79, 70, 229, 0.08), rgba(14, 165, 233, 0.08));
    padding: 16px 20px;
    border-bottom: 1px solid var(--stroke);
}

.stats-table-header h3 {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.stats-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.stats-table-wrapper:focus-visible,
.table-wrapper:focus-visible {
    outline: 3px solid rgba(14, 165, 233, 0.55);
    outline-offset: -3px;
}

.scroll-hint {
    display: none;
    margin: 0;
    padding: 9px 16px;
    color: var(--ink-soft);
    background: rgba(14, 165, 233, 0.07);
    border-bottom: 1px solid var(--stroke);
    font-size: 0.78rem;
    font-weight: 600;
}

.stats-table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
}

.stats-table thead {
    background: transparent;
}

.stats-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--stroke);
    white-space: nowrap;
}

.stats-table th:not(:first-child) {
    text-align: center;
}

.stats-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
    font-variant-numeric: tabular-nums;
}

.stats-table td:not(:first-child) {
    text-align: center;
}

.stats-table tbody tr {
    transition: background-color 0.15s ease;
}

.stats-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.06);
}

.stats-table tbody tr:last-child td {
    border-bottom: none;
}

.stat-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.badge-blue   { background: rgba(37, 99, 235, 0.12);  color: #1e40af; }
.badge-green  { background: rgba(22, 163, 74, 0.12);  color: #166534; }
.badge-purple { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.badge-orange { background: rgba(234, 88, 12, 0.14);  color: #c2410c; }

.progress-bar {
    width: 100%;
    min-width: 110px;
    height: 8px;
    background: rgba(148, 163, 184, 0.22);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--grad-accent);
    border-radius: 999px;
    transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- Gruppi e schede competenza ---------- */

.main-table-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.group-container {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--card);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.group-header {
    background: linear-gradient(120deg, rgba(79, 70, 229, 0.07), rgba(14, 165, 233, 0.07));
    padding: 16px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    user-select: none;
    width: 100%;
    border: 0;
    color: inherit;
    font: inherit;
    text-align: left;
}

.group-header:hover {
    background: linear-gradient(120deg, rgba(79, 70, 229, 0.13), rgba(14, 165, 233, 0.13));
}

.group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.group-chevron {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    font-size: 0.85rem;
    color: var(--accent-a);
    background: rgba(99, 102, 241, 0.12);
    border-radius: 8px;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.group-expanded .group-chevron {
    transform: rotate(90deg);
}

.group-name {
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--ink);
}

.group-count {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-a);
    background: rgba(99, 102, 241, 0.12);
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.group-content {
    display: none;
    padding: 18px;
    background: transparent;
}

.group-expanded .group-content {
    display: block;
}

.item-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.competence-card {
    background: var(--card-solid);
    border: 1px solid var(--stroke-soft);
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 8px 26px -22px rgba(30, 41, 99, 0.5);
    transition: box-shadow 0.25s ease, border-color 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
    animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.competence-card:hover {
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 22px 50px -28px rgba(30, 41, 99, 0.55);
    transform: translateY(-2px);
}

.competence-card header {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.competence-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0;
}

.competence-card header p {
    font-size: 0.85rem;
    color: var(--ink-soft);
    margin: 0;
    line-height: 1.55;
}

.competence-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.competence-meta .meta-pill,
.competence-metrics .metric-pill,
.insegnamenti-chips span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 11px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.75rem;
}

.meta-pill {
    background: rgba(14, 165, 233, 0.12);
    color: #0369a1;
}

.competence-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.metric-pill {
    background: rgba(79, 70, 229, 0.1);
    color: var(--accent-a);
}

.insegnamenti-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.insegnamenti-chips span {
    background: rgba(234, 88, 12, 0.12);
    color: #c2410c;
}

/* Pill colorate in testa alla scheda (periodo, QNQ, competenza) */
.card-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 11px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 12px;
}

.per-biennio { background: rgba(37, 99, 235, 0.12);  color: #1e40af; }
.per-terzo   { background: rgba(22, 163, 74, 0.12);  color: #166534; }
.per-quarto  { background: rgba(234, 88, 12, 0.14);  color: #c2410c; }
.per-quinto  { background: rgba(124, 58, 237, 0.12); color: #6d28d9; }
.per-default { background: rgba(99, 102, 241, 0.10); color: var(--accent-a); }

.pill-qnq  { background: rgba(139, 92, 246, 0.12); color: #6d28d9; }
.pill-comp { background: rgba(99, 102, 241, 0.10); color: var(--accent-a); }

.competence-card .card-title {
    font-family: var(--font-display);
    font-size: 16.5px;
    font-weight: 700;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0 0 6px;
    line-height: 1.4;
}

.competence-card .card-subtitle {
    font-size: 13px;
    color: var(--ink-faint);
    margin: 0 0 16px;
    line-height: 1.55;
}

.competence-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}

.info-block h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-soft);
    margin: 0 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid rgba(99, 102, 241, 0.15);
}

.info-block ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.info-block ul li {
    position: relative;
    padding-left: 16px;
    line-height: 1.5;
}

.info-block ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.55em;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--grad-accent);
}

.knowledge-chip {
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: 13px;
    padding: 11px 13px;
    background: rgba(14, 165, 233, 0.06);
    margin-bottom: 10px;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.knowledge-chip:hover {
    border-color: rgba(14, 165, 233, 0.5);
    background: rgba(14, 165, 233, 0.1);
}

.knowledge-chip:last-child {
    margin-bottom: 0;
}

.knowledge-title {
    font-weight: 600;
    color: #0369a1;
    margin-bottom: 6px;
    font-size: 0.82rem;
    line-height: 1.45;
}

.knowledge-subjects {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.knowledge-subjects span {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: rgba(79, 70, 229, 0.12);
    color: var(--accent-a);
    font-size: 0.68rem;
    font-weight: 700;
}

.empty-placeholder {
    font-size: 0.8rem;
    color: var(--ink-faint);
}

/* ---------- Stati ---------- */

.loading, .empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--ink-soft);
    background: var(--card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.hidden {
    display: none !important;
}

/* ---------- UDA ---------- */

.uda-intro {
    text-align: center;
    max-width: 760px;
    margin: 0 auto 26px;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.6;
}

.uda-section {
    margin-bottom: 38px;
}

.uda-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.uda-section-header .uda-icon {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    font-size: 18px;
    border-radius: 12px;
    background: rgba(99, 102, 241, 0.12);
}

.uda-section-header h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--ink);
    margin: 0;
}

.uda-section-header .uda-rule {
    flex: 1;
    height: 1px;
    background: rgba(99, 102, 241, 0.2);
}

.uda-section-desc {
    margin: 0 0 16px;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1.55;
    max-width: 760px;
}

.uda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
    gap: 18px;
}

.uda-card {
    position: relative;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: rise 0.4s ease both;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease;
}

.uda-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.uda-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: var(--grad-accent);
}

.uda-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.uda-card-top .pill-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill-stato {
    background: rgba(234, 88, 12, 0.12);
    color: #c2410c;
    font-size: 11.5px;
    white-space: nowrap;
}

.uda-card h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0 0 6px;
    color: var(--ink);
    line-height: 1.3;
}

.uda-card .uda-desc {
    margin: 0;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.55;
}

.uda-label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-faint);
    margin-bottom: 6px;
}

.uda-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.uda-chips .chip-comp {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(139, 92, 246, 0.12);
    color: #6d28d9;
    font-size: 12px;
    font-weight: 700;
}

.uda-chips .chip-disc {
    display: inline-flex;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(234, 88, 12, 0.10);
    color: #c2410c;
    font-size: 12px;
    font-weight: 700;
}

.uda-prodotto {
    border: 1px solid rgba(14, 165, 233, 0.25);
    border-radius: 13px;
    padding: 12px 14px;
    background: rgba(14, 165, 233, 0.06);
}

.uda-prodotto .uda-label {
    color: #0369a1;
    margin-bottom: 4px;
}

.uda-prodotto div:last-child {
    font-size: 13.5px;
    color: var(--ink);
    line-height: 1.5;
}

.uda-fasi ol {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 5px;
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.5;
}

.uda-valutazione {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    font-size: 13px;
    color: var(--ink-soft);
}

.uda-valutazione strong {
    color: var(--ink);
}

.uda-placeholder {
    border: 2px dashed rgba(99, 102, 241, 0.35);
    border-radius: 20px;
    padding: 32px 24px;
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--ink-soft);
    min-height: 160px;
}

.uda-placeholder .uda-placeholder-icon {
    font-size: 34px;
    margin-bottom: 10px;
}

.uda-placeholder .uda-placeholder-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 16px;
    color: var(--ink);
    margin-bottom: 6px;
}

.uda-placeholder p {
    margin: 0 auto;
    font-size: 13.5px;
    line-height: 1.6;
    max-width: 300px;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .search-row {
        flex-direction: column;
        align-items: stretch;
    }

    .actions-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
        justify-content: stretch;
    }

    .actions-row > * {
        width: 100%;
        min-width: 0;
    }

    .rubrica-picker {
        width: 100%;
        margin-right: 0;
    }

    .rubrica-picker #rubrica-select {
        flex: 1;
        min-width: 0;
        max-width: none;
    }

    .export-actions {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .export-actions .action-label {
        grid-column: 1 / -1;
        margin-bottom: -2px;
    }

    .export-actions button {
        width: 100%;
        min-width: 0;
        padding-inline: 8px;
    }

    .scroll-hint {
        display: block;
    }

    .stats-table {
        min-width: 720px;
    }

    .filter-panel {
        padding: 18px 16px;
    }

    .group-content {
        padding: 12px;
    }

    .competence-card {
        padding: 17px;
    }
}
