/* Area spartiti: stessa palette e font del sito (sito.css) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink: #1B2745;
  --ink-2: #26365F;
  --ink-soft: #4F5B7D;
  --paper: #FFF6E8;
  --paper-2: #FFFCF6;
  --peach: #FFE2C6;
  --sky: #E3ECFF;
  --coral: #EE5A4F;
  --coral-d: #BF3A30;
  --saffron: #FFB02E;
  --saffron-s: #FFE9B8;
  --blue: #2F5BD0;
  --line: rgba(27,39,69,0.14);
  --ff-display: 'Gabarito', 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  --ff-body: 'Nunito Sans', 'Segoe UI', system-ui, sans-serif;
  --shadow-sm: 0 1px 3px rgba(27,39,69,0.14), 0 8px 18px -10px rgba(27,39,69,0.4);
  --shadow-md: 0 3px 8px rgba(27,39,69,0.14), 0 18px 32px -14px rgba(27,39,69,0.5);
  --r: 14px;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--ff-body); color: var(--ink); line-height: 1.5;
  background: var(--paper);
  background-image: radial-gradient(circle at 85% 0%, var(--peach) 0, transparent 45%);
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------- testata ---------- */
.sp-testa { position: relative; background: var(--ink); color: var(--paper); padding: 1.25rem 3rem 5.5rem; overflow: hidden; border-bottom: 4px solid var(--saffron); }
.sp-testa-riga { display: flex; align-items: center; justify-content: space-between; gap: 1rem; max-width: 1100px; margin: 0 auto; }
.sp-logo img { display: block; width: clamp(180px, 22vw, 300px); height: auto; }
.sp-utente { display: flex; align-items: center; gap: 0.75rem; font-weight: 700; font-size: 0.95rem; text-align: right; }
.sp-titolo { position: relative; z-index: 1; max-width: 1100px; margin: 2rem auto 0; }
.sp-occhiello { font-family: var(--ff-display); font-weight: 700; color: var(--saffron); letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.85rem; }
.sp-titolo h1 { font-family: var(--ff-display); font-weight: 800; font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; letter-spacing: -0.02em; margin: 0.3rem 0 0.4rem; }
.sp-sotto { color: rgba(255,246,232,0.78); font-size: 1.05rem; }
/* pentagramma con note, come nel sito */
.sp-pentagramma {
  position: absolute; left: 0; right: 0; bottom: 14px; height: 62px; pointer-events: none; opacity: 0.9;
  background:
    radial-gradient(ellipse 9px 6.5px at 8% 72%, var(--coral) 98%, transparent 100%),
    radial-gradient(ellipse 9px 6.5px at 22% 40%, var(--blue) 98%, transparent 100%),
    radial-gradient(ellipse 9px 6.5px at 36% 56%, var(--saffron) 98%, transparent 100%),
    radial-gradient(ellipse 9px 6.5px at 61% 64%, var(--coral) 98%, transparent 100%),
    radial-gradient(ellipse 9px 6.5px at 77% 48%, var(--blue) 98%, transparent 100%),
    radial-gradient(ellipse 9px 6.5px at 92% 34%, var(--saffron) 98%, transparent 100%),
    repeating-linear-gradient(to bottom, transparent 0 14px, rgba(255,246,232,0.13) 14px 15.5px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 100%, 100% 62px;
  background-repeat: no-repeat; background-position: 0 0;
}

/* ---------- contenuto ---------- */
.sp-main { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.sp-card { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 1.75rem; }
.sp-card h2 { font-family: var(--ff-display); font-weight: 800; font-size: 1.5rem; letter-spacing: -0.01em; }
.sp-caricamento, .sp-vuoto { text-align: center; color: var(--ink-soft); padding: 2rem 0; }

.sp-accesso { display: flex; justify-content: center; }
.sp-login { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 0.9rem; }
.sp-nota { color: var(--ink-soft); font-size: 0.95rem; margin-top: -0.4rem; }
.sp-login label, .sp-campo { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 700; font-size: 0.92rem; }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea:not(.sp-editor-codice) {
  border: 1.5px solid var(--line); border-radius: 10px; padding: 0.7rem 0.85rem; background: #fff; font-weight: 400; font-size: 1rem; width: 100%;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, .sp-editor-area:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
.sp-esito { min-height: 1.2em; font-weight: 700; font-size: 0.92rem; color: var(--coral-d); }
.sp-esito.ok { color: #2E7D32; }
.sp-link { background: none; border: none; color: var(--blue); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; align-self: center; padding: 0.4rem; min-height: 44px; }

.sp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: none; border-radius: 999px; padding: 0.65rem 1.2rem; min-height: 44px; font-family: var(--ff-display); font-weight: 700; font-size: 0.98rem; cursor: pointer; text-decoration: none; transition: transform 0.12s, background 0.15s; white-space: nowrap; }
.sp-btn:active { transform: translateY(1px); }
.sp-btn-primario { background: var(--coral); color: #fff; }
.sp-btn-primario:hover { background: var(--coral-d); }
.sp-btn-secondario { background: var(--ink); color: var(--paper); }
.sp-btn-secondario:hover { background: var(--ink-2); }
.sp-btn-chiaro { background: var(--sky); color: var(--ink); }
.sp-btn-chiaro:hover { background: #cfdcff; }
.sp-btn-piccolo { padding: 0.35rem 0.9rem; min-height: 36px; font-size: 0.88rem; }
.sp-testa .sp-btn-chiaro { background: rgba(255,246,232,0.14); color: var(--paper); }
.sp-testa .sp-btn-chiaro:hover { background: rgba(255,246,232,0.25); }
.sp-icona-btn { background: none; border: 1px solid transparent; border-radius: 8px; min-width: 36px; min-height: 36px; cursor: pointer; font-size: 1rem; color: var(--ink-soft); }
.sp-icona-btn:hover { background: var(--sky); color: var(--ink); }
.sp-icona-btn.pericolo:hover { background: #ffe1de; color: var(--coral-d); }

/* briciole */
.sp-briciole { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; font-family: var(--ff-display); font-weight: 700; font-size: 1.05rem; margin-bottom: 1.25rem; }
.sp-briciole a { color: var(--blue); text-decoration: none; padding: 0.2rem 0.35rem; border-radius: 6px; }
.sp-briciole a:hover { background: var(--sky); }
.sp-briciole .sep { color: var(--ink-soft); opacity: 0.6; }
.sp-briciole .qui { padding: 0.2rem 0.35rem; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; width: 100%; }

/* barra admin */
.sp-barra-admin { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; padding: 0.9rem; margin-bottom: 1.25rem; background: var(--saffron-s); border: 1px dashed var(--saffron); border-radius: var(--r); }
.sp-cartella-azioni { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-left: auto; }
.sp-gruppi-cartella { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: -0.5rem 0 1.25rem; }
.sp-chip { display: inline-block; padding: 0.15rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.02em; background: var(--sky); color: var(--blue); }
.sp-chip.g1 { background: #ffe1de; color: var(--coral-d); }
.sp-chip.g2 { background: #fff1c9; color: #8a5a00; }
.sp-chip.g3 { background: #ece3ff; color: #5b3aa8; }
.sp-chip.g4 { background: #dff3f5; color: #1d6870; }
.sp-chip.nessuno { background: #eee; color: #666; }

/* istruzioni */
.sp-istruzioni { background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--saffron); border-radius: var(--r); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; overflow: hidden; }
.sp-istruzioni > summary { font-family: var(--ff-display); font-weight: 800; font-size: 1.1rem; padding: 0.85rem 1.25rem; min-height: 44px; display: flex; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none; user-select: none; }
.sp-istruzioni > summary::-webkit-details-marker { display: none; }
.sp-istruzioni > summary::after { content: ''; margin-left: auto; width: 9px; height: 9px; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: rotate(45deg); transition: transform 0.2s; opacity: 0.6; }
.sp-istruzioni[open] > summary::after { transform: rotate(-135deg); }
.sp-istruzioni[open] > summary { padding-bottom: 0; }
.sp-istruzioni iframe { display: block; width: 100%; border: 0; min-height: 60px; }

/* cartelle */
.sp-cartelle { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.sp-cartella { position: relative; display: flex; flex-direction: column; gap: 0.35rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); padding: 1.1rem 1.1rem 1rem; transition: transform 0.15s, box-shadow 0.15s; }
.sp-cartella:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.sp-cartella::before { content: ''; position: absolute; left: 1.1rem; top: -1px; width: 56px; height: 5px; border-radius: 0 0 4px 4px; background: var(--cat, #8A8F98); }
.sp-cartella-icona { color: var(--cat, var(--ink-soft)); }
.sp-cartella-icona .sp-ic { width: 28px; height: 28px; }
.sp-ic { width: 18px; height: 18px; flex-shrink: 0; }
.sp-istruzioni > summary .sp-ic { color: var(--saffron); width: 22px; height: 22px; }
.sp-cartella:has(.sp-cartella-nome:focus-visible) { outline: 3px solid var(--saffron); outline-offset: 2px; }
.sp-cartella-nome { font-family: var(--ff-display); font-weight: 800; font-size: 1.15rem; line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.sp-cartella-nome:focus-visible { outline: none; }
/* tutta la card è cliccabile tramite il link del nome */
.sp-cartella-nome::after { content: ''; position: absolute; inset: 0; border-radius: var(--r); }
.sp-cartella-info { color: var(--ink-soft); font-size: 0.88rem; }
.sp-cartella .sp-chip { margin-right: 0.25rem; }
.sp-ordina { position: absolute; top: 0.4rem; right: 0.4rem; display: flex; gap: 0.1rem; z-index: 1; }

/* file */
.sp-file { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.sp-riga { display: grid; grid-template-columns: auto 1fr auto; gap: 0.4rem 0.9rem; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 0.9rem; }
.sp-tipo { width: 46px; height: 46px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-family: var(--ff-display); font-weight: 800; font-size: 0.72rem; letter-spacing: 0.04em; color: #fff; background: var(--ink-soft); }
.sp-tipo.pdf { background: var(--coral); }
.sp-tipo.audio { background: var(--blue); }
.sp-tipo.img { background: #2E8B6E; }
.sp-tipo.html { background: var(--saffron); color: var(--ink); }
.sp-riga-testo { min-width: 0; }
.sp-riga-titolo { font-weight: 800; overflow-wrap: anywhere; }
.sp-riga-meta { color: var(--ink-soft); font-size: 0.85rem; overflow-wrap: anywhere; }
.sp-riga-azioni { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-end; align-items: center; }
.sp-riga audio { grid-column: 1 / -1; width: 100%; height: 40px; }
.sp-riga-admin { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0.2rem; border-top: 1px dashed var(--line); padding-top: 0.4rem; }

/* upload */
.sp-drop { border: 2px dashed var(--ink-soft); border-radius: var(--r); padding: 1.4rem; text-align: center; color: var(--ink-soft); margin-bottom: 1rem; font-weight: 700; }
.sp-drop.sopra { background: var(--sky); border-color: var(--blue); color: var(--blue); }
.sp-upload-lista:empty, .sp-cartelle:empty, .sp-file:empty { display: none; }
.sp-upload-lista { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 1rem; }
.sp-upload-lista li { display: grid; grid-template-columns: 1fr auto; gap: 0.2rem 0.8rem; font-size: 0.9rem; background: #fff; border-radius: 10px; padding: 0.5rem 0.8rem; border: 1px solid var(--line); }
.sp-upload-lista progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--blue); }
.sp-upload-lista .err { color: var(--coral-d); font-weight: 700; }
.sp-upload-lista .ok { color: #2E7D32; font-weight: 700; }

/* dialog */
.sp-dialog { border: none; border-radius: var(--r); box-shadow: var(--shadow-md); padding: 0; width: min(480px, calc(100vw - 32px)); margin: auto; color: var(--ink); background: var(--paper-2); }
.sp-dialog-largo { width: min(820px, calc(100vw - 32px)); }
.sp-dialog::backdrop { background: rgba(27,39,69,0.55); }
.sp-dialog-corpo { display: flex; flex-direction: column; gap: 0.9rem; padding: 1.5rem; }
.sp-dialog h2 { font-family: var(--ff-display); font-weight: 800; font-size: 1.35rem; }
.sp-dialog-piede { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }
.sp-spunte { display: flex; flex-direction: column; gap: 0.4rem; font-weight: 400; }
.sp-spunte label { display: flex; align-items: center; gap: 0.5rem; min-height: 36px; font-weight: 700; }
.sp-spunte input { width: 20px; height: 20px; accent-color: var(--coral); }
.sp-aiuto { font-size: 0.85rem; color: var(--ink-soft); font-weight: 400; }

/* editor istruzioni */
.sp-editor-barra { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.sp-editor-barra button { border: 1px solid var(--line); background: #fff; border-radius: 8px; min-height: 36px; min-width: 36px; padding: 0 0.6rem; cursor: pointer; font-size: 0.9rem; }
.sp-editor-barra button:hover { background: var(--sky); }
.sp-editor-html { margin-left: auto; font-family: ui-monospace, monospace; }
.sp-editor-html[aria-pressed=true] { background: var(--ink) !important; color: var(--paper); }
.sp-editor-area, .sp-editor-codice { min-height: 280px; max-height: 55vh; overflow: auto; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 0.9rem 1rem; }
.sp-editor-area h3 { font-family: var(--ff-display); margin: 0.6rem 0 0.3rem; }
.sp-editor-area ul, .sp-editor-area ol { padding-left: 1.4rem; }
.sp-editor-codice { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.88rem; line-height: 1.45; resize: vertical; }

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .sp-testa { padding: 1rem 1rem 5.25rem; }
  .sp-sotto { font-size: 0.98rem; }
  .sp-titolo { margin-top: 1.25rem; }
  .sp-main { padding: 1.25rem 1rem 3rem; }
  .sp-card { padding: 1.25rem; }
  .sp-cartelle { grid-template-columns: 1fr 1fr; gap: 0.7rem; }
  .sp-cartella { padding: 0.95rem 0.85rem 0.85rem; }
  .sp-cartella-nome { font-size: 1.02rem; }
  .sp-riga { grid-template-columns: auto 1fr; }
  .sp-riga-azioni { grid-column: 1 / -1; justify-content: stretch; }
  .sp-riga-azioni .sp-btn { flex: 1; }
  .sp-cartella-azioni { margin-left: 0; width: 100%; }
  .sp-utente span { display: none; }
}
@media (max-width: 420px) {
  .sp-cartelle { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-cartella, .sp-btn { transition: none; }
}

/* Cartelle comuni e collegamenti */
.sp-chip.comune { background: #e3f4e6; color: #1f6b33; }
.sp-collegamento { border-style: dashed; }
.sp-collegamento .sp-cartella-icona { color: #1f6b33; }

/* Visibilità cartelle (solo gestione) */
.sp-chip.spenta { background: #eee; color: #8a2a1f; }
.sp-chip.date { background: #e8eefc; color: #2F5BD0; }
.sp-spunta-riga { display: flex; align-items: center; gap: 0.5rem; min-height: 36px; font-weight: 700; }
.sp-spunta-riga input { width: 20px; height: 20px; accent-color: var(--coral); }
#sp-dialog-campi { display: flex; flex-direction: column; gap: 0.8rem; }

/* Scelta cartella ad albero (sposta file) */
.sp-albero, .sp-albero ul { list-style: none; margin: 0; padding: 0; }
.sp-albero { max-height: min(55vh, 420px); overflow: auto; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; padding: 0.35rem; }
.sp-albero ul { padding-left: 1.15rem; border-left: 1px dashed var(--line); margin-left: 0.95rem; }
.sp-albero-riga { display: flex; align-items: center; gap: 0.15rem; }
.sp-albero-apri, .sp-albero-vuoto { flex: none; width: 32px; height: 36px; }
.sp-albero-apri { border: none; background: none; cursor: pointer; border-radius: 8px; position: relative; }
.sp-albero-apri::before { content: ''; position: absolute; left: 11px; top: 13px; width: 8px; height: 8px; border-right: 2.5px solid var(--ink-soft); border-bottom: 2.5px solid var(--ink-soft); transform: rotate(-45deg); transition: transform 0.15s; }
.sp-albero-apri[aria-expanded="true"]::before { transform: rotate(45deg); left: 12px; top: 11px; }
.sp-albero-apri:hover { background: var(--sky); }
.sp-albero label { flex: 1; display: flex; align-items: center; gap: 0.45rem; min-height: 36px; padding: 0.2rem 0.5rem; border-radius: 8px; cursor: pointer; font-weight: 600; }
.sp-albero label:hover { background: var(--sky); }
.sp-albero label:has(input:checked) { background: #ffe1de; color: var(--coral-d); }
.sp-albero label.attuale { opacity: 0.55; cursor: default; }
.sp-albero label em { font-weight: 400; }
.sp-albero input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sp-albero label .sp-ic { width: 18px; height: 18px; flex: none; color: var(--ink-soft); }

/* Trascinamento cartelle e file (gestione) */
[data-drag] { cursor: grab; }
.sp-trascinato { opacity: 0.45; }
.sp-cartella.sp-drop-sopra { outline: 3px dashed var(--coral); outline-offset: 3px; background: #ffe1de; transform: scale(1.02); }
.sp-briciole a.sp-drop-sopra { background: #ffe1de; outline: 2px dashed var(--coral); border-radius: 6px; }

/* Categorie (nome + colore) */
.sp-chip-cat { background: #fff; color: var(--ink); border: 1px solid var(--line); display: inline-flex; align-items: center; gap: 0.4rem; }
.sp-chip-cat i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.sp-categorie { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; }
.sp-categorie li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; border-bottom: 1px solid var(--line); }
.sp-categorie li .sp-aiuto { flex: 1; }
.sp-scelta-cat { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sp-scelta-cat label { cursor: pointer; }
.sp-scelta-cat input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sp-scelta-cat .sp-chip-cat { font-size: 0.9rem; padding: 0.4rem 0.8rem; min-height: 36px; }
.sp-scelta-cat input:checked + .sp-chip-cat { border: 2px solid var(--ink); box-shadow: 0 0 0 3px #ffe1de; }
.sp-scelta-cat input:focus-visible + .sp-chip-cat { outline: 3px solid var(--saffron); }
.sp-tavolozza { border: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.sp-tavolozza legend { margin-bottom: 0.4rem; }
.sp-tavolozza label { cursor: pointer; display: inline-flex; }
.sp-tavolozza input[type=radio] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sp-tavolozza span, .sp-tavolozza input[type=color] { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--line); display: block; }
.sp-tavolozza input[type=color] { padding: 0; cursor: pointer; background: none; }
.sp-tavolozza input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.sp-tavolozza input[type=color]::-webkit-color-swatch { border: none; border-radius: 50%; }
.sp-tavolozza input[type=radio]:checked + span, .sp-tavolozza input[type=radio]:checked + input[type=color] { box-shadow: 0 0 0 3px var(--ink); }
.sp-tavolozza input[type=radio]:focus-visible + span { outline: 3px solid var(--saffron); outline-offset: 2px; }

/* Barra visualizzazione: ordina per + card/lista (per tutti) */
.sp-vista-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.6rem; margin-bottom: 1rem; }
.sp-ordina-per { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 0.92rem; }
.sp-ordina-per select { width: auto; padding: 0.4rem 0.7rem; min-height: 36px; font-size: 0.92rem; }
.sp-verso:disabled { opacity: 0.5; cursor: default; }
.sp-verso .sp-ic { width: 16px; height: 16px; }
.sp-vista { margin-left: auto; display: inline-flex; gap: 2px; background: var(--sky); border-radius: 999px; padding: 3px; }
.sp-vista button { display: inline-flex; align-items: center; gap: 0.35rem; border: none; background: none; border-radius: 999px; min-height: 36px; padding: 0.3rem 0.9rem; cursor: pointer; font-family: var(--ff-display); font-weight: 700; font-size: 0.88rem; color: var(--ink); }
.sp-vista button .sp-ic { width: 16px; height: 16px; }
.sp-vista button[aria-pressed=true] { background: var(--ink); color: var(--paper); }

/* Icona personalizzata delle cartelle: immagine caricata */
.sp-cartella-icona img { display: block; width: 52px; height: 52px; border-radius: 12px; object-fit: cover; box-shadow: 0 0 0 2px var(--cat, #8A8F98); }

/* Vista a lista: cartelle una per riga */
[data-vista=lista] .sp-cartelle { grid-template-columns: 1fr; gap: 0.5rem; }
[data-vista=lista] .sp-cartella { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.8rem; padding: 0.65rem 1rem 0.65rem 1.15rem; }
[data-vista=lista] .sp-cartella:has(.sp-ordina) { padding-right: 5.5rem; }
[data-vista=lista] .sp-cartella:hover { transform: none; }
[data-vista=lista] .sp-cartella::before { left: -1px; top: 0.6rem; width: 5px; height: calc(100% - 1.2rem); border-radius: 0 4px 4px 0; }
[data-vista=lista] .sp-cartella-icona .sp-ic { width: 24px; height: 24px; }
[data-vista=lista] .sp-cartella-icona img { width: 36px; height: 36px; border-radius: 9px; }
[data-vista=lista] .sp-cartella-nome { flex: 1 1 12rem; font-size: 1.05rem; }
[data-vista=lista] .sp-ordina { top: 50%; transform: translateY(-50%); }

/* Vista a card: file in griglia */
[data-vista=card] .sp-file { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.8rem; }
[data-vista=card] .sp-riga { grid-template-columns: auto 1fr; align-content: start; box-shadow: var(--shadow-sm); }
[data-vista=card] .sp-riga-azioni { grid-column: 1 / -1; justify-content: stretch; }
[data-vista=card] .sp-riga-azioni .sp-btn { flex: 1; }

/* Scelta del simbolo (gestione) */
.sp-simboli { border: none; padding: 2px; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 0.4rem; max-height: min(42vh, 320px); overflow: auto; }
.sp-simboli legend { margin-bottom: 0.4rem; }
.sp-simboli label { cursor: pointer; display: block; }
.sp-simboli input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sp-simboli span { display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--cat, var(--ink)); }
.sp-simboli span .sp-ic { width: 26px; height: 26px; }
.sp-simboli span img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
.sp-simboli label:hover span { background: var(--sky); }
.sp-simboli input:checked + span { border: 2px solid var(--ink); box-shadow: 0 0 0 3px #ffe1de; }
.sp-simboli input:focus-visible + span { outline: 3px solid var(--saffron); outline-offset: 2px; }

@media (max-width: 768px) {
  .sp-vista { margin-left: 0; }
}
.sp-simboli label.predefinita span { border-style: dashed; background: transparent; color: var(--ink-soft); }
