/* ============================================================
   VISUALIZZATORE NOTERELLE TEI/XML  –  CSS v3
   ============================================================ */

:root {
  /* --- Palette coordinata con digitalrisorgimento.org (blu petrolio / "ottanio") ---
     Se vuoi il match esatto col tema, cambia SOLO questi valori: il resto
     del file usa le variabili, quindi il layout non si tocca. */
  --ui-bg: #ffffff;
  --ui-muted: #f4f7f8;
  --ui-border: #d8e0e3;
  --ui-text: #253238;
  --ui-text-muted: #5c6b72;
  --btn-bg: #eef3f5;
  --btn-bg-hover: #dde7ea;
  --btn-text: #1a627b;
  --accent-color: #1a627b;
  --accent-color-hover: #124b5f;

  /* --- Font: interfaccia sans (come il sito) + testo/apparato serif ---
     Per cambiare il font dell'interfaccia, sostituisci 'Inter' qui sotto
     (es. 'Manrope' o 'Montserrat') e aggiorna il link nel <head> di index.html. */
  --ui-font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif-font: 'Cardo', serif;

  --highlight-variant:  #ffe9a0;
  --highlight-persName: #b5f4ff;
  --highlight-placeName:#bcf5bc;
  --highlight-note:     #f9d5e5;
  --highlight-ref:      #ffddb0;
  --tei-font-size: 1.15em;
  --max-width: 1300px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ui-font);
  color: var(--ui-text);
  background: #f0ede8;
  overflow-x: hidden;
}

/* ============================================================
   FIX 1 – MENU: riga orizzontale compatta
   ============================================================ */

#top-controls-wrapper {
  max-width: var(--max-width);
  margin: 0.75rem auto 0 auto;
  width: 95%;
  position: relative;
}

#top-controls {
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 8px 8px 0 0;
  padding: 0.5rem 1rem;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.4rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
  transition: height 0.3s ease, padding 0.3s ease, opacity 0.3s ease, border 0.3s;
  overflow: hidden;
}

/* Tutti i controlli con peso uguale, nessun wrap */
#top-controls .control-group { flex: 1 1 0; min-width: 0; }
/* Noterella leggermente più larga perché i titoli sono lunghi */
#top-controls .control-group:nth-child(1) { flex: 1.6 1 0; }

#top-controls.collapsed {
  height: 0;
  padding: 0;
  border: none;
  opacity: 0;
  pointer-events: none;
}

.control-group {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.control-group label {
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ui-text-muted);
  margin-bottom: 3px;
  white-space: nowrap;
}

#top-controls select,
#top-controls input[type="text"],
.ui-btn-full {
  width: 100%;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  font-family: var(--ui-font);
  font-size: 0.82rem;
  height: 30px;
  background: #fff;
  color: var(--ui-text);
  min-width: 0;
}

.ui-btn-full {
  cursor: pointer;
  background: var(--btn-bg);
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border: 1px solid var(--ui-border);
  transition: background 0.2s;
  white-space: nowrap;
}
.ui-btn-full:hover { background: var(--btn-bg-hover); }

#bottom-toggle-bar {
  display: flex;
  justify-content: center;
  gap: 6px;
}

#toggle-header-btn,
#reading-mode-btn,
#dark-mode-btn,
#compare-toggle-btn {
  display: block;
  background: var(--ui-border);
  border: none;
  border-radius: 0 0 6px 6px;
  padding: 2px 16px;
  font-size: 0.65rem;
  font-weight: bold;
  color: var(--ui-text-muted);
  cursor: pointer;
  transition: background 0.2s;
  letter-spacing: 0.04em;
  font-family: var(--ui-font);
}
#toggle-header-btn:hover,
#reading-mode-btn:hover,
#dark-mode-btn:hover,
#compare-toggle-btn:hover { background: var(--btn-bg-hover); }

/* ============================================================
   NAVIGAZIONE NOTERELLA: frecce prev/next + indicatore posizione
   ============================================================ */
.control-group-noterella { position: relative; }
.noterella-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.noterella-nav select { flex: 1; min-width: 0; }
.nav-arrow-btn {
  flex-shrink: 0;
  width: 26px;
  height: 30px;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--btn-text);
  cursor: pointer;
  font-size: 0.75rem;
  transition: background 0.2s;
}
.nav-arrow-btn:hover:not(:disabled) { background: var(--btn-bg-hover); }
.nav-arrow-btn:disabled { opacity: 0.35; cursor: default; }
/* Sulla stessa riga della label, per non alterare l'altezza del control-group
   (altrimenti #top-controls, allineato con align-items:flex-end, sfalsa gli
   altri controlli della riga) */
.noterella-position {
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ui-text-muted);
  white-space: nowrap;
}

/* ============================================================
   CONFRONTO AFFIANCATO DI DUE NOTERELLE
   ============================================================ */
#compare-panel {
  max-width: var(--max-width);
  width: 95%;
  margin: 0.5rem auto 0 auto;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  box-shadow: 0 2px 5px rgba(0,0,0,0.06);
}
.compare-panel-inner {
  display: flex;
  align-items: flex-end;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.compare-panel-inner .control-group { flex: 1 1 220px; }
.compare-panel-inner select {
  width: 100%; padding: 0.3rem 0.4rem; height: 32px;
  border: 1px solid var(--ui-border); border-radius: 4px;
  font-family: var(--ui-font); font-size: 0.82rem;
}

.compare-wrap {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  height: 100%;
}
.compare-col {
  padding: 0 1.5rem;
  overflow-y: auto;
}
.compare-col:first-child { border-right: 1px solid var(--ui-border); }
.compare-col > div[data-section-index] { border-top: none; margin-top: 0; padding-top: 0; }

/* ============================================================
   GRAFICO FREQUENZA TEMI (@ana)
   ============================================================ */
.occurrence-list li.temi-chart {
  cursor: default;
  background: none;
  border: none;
  padding: 4px 2px;
}
.temi-chart-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-family: var(--ui-font);
}
.temi-chart-label { font-size: 0.8rem; color: var(--ui-text); }
.temi-chart-bar-track {
  position: relative;
  height: 16px;
  background: var(--ui-muted);
  border-radius: 3px;
  overflow: hidden;
}
.temi-chart-bar {
  height: 100%;
  background: var(--accent-color);
  border-radius: 3px 0 0 3px;
  transition: width 0.3s ease;
}
.temi-chart-value {
  position: absolute;
  right: 6px; top: 0;
  font-size: 0.7rem;
  line-height: 16px;
  color: var(--ui-text);
  font-weight: 600;
}

/* ============================================================
   MODALITÀ SCURA
   ============================================================ */
body.dark-mode {
  --ui-bg: #1e2528;
  --ui-muted: #262e32;
  --ui-border: #3a4448;
  --ui-text: #dfe6e9;
  --ui-text-muted: #9aa7ac;
  --btn-bg: #2a3336;
  --btn-bg-hover: #34403f;
  --btn-text: #7ec8e3;
  --accent-color: #4fa3c4;
  --accent-color-hover: #6bb9d8;
  background: #14181a;
}
body.dark-mode #tei-text-area,
body.dark-mode #tei-sidebar-content,
body.dark-mode .occurrence-list li,
body.dark-mode #note-popup,
body.dark-mode #selection-popup,
body.dark-mode #top-controls select,
body.dark-mode #top-controls input[type="text"],
body.dark-mode .compare-panel-inner select { background: var(--ui-bg); color: var(--ui-text); }
body.dark-mode #tei-text-area > div[data-section-index] { border-top-color: var(--ui-border); }
body.dark-mode mark.tei-search { background: #7a6a00 !important; color: #fff !important; }

/* ============================================================
   IMPOSTAZIONI INLINE (riga collassabile sotto i controlli)
   ============================================================ */

/* Bottone impostazioni: stesso look degli altri select */
.settings-toggle {
  width: 100%;
  min-height: 32px;
  max-height: 32px;
  padding: 0 0.5rem;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  background: var(--ui-bg);
  color: var(--ui-text);
  font-family: var(--ui-font);
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
  transition: background 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  line-height: 1;
  margin: 0;
}
.settings-toggle:hover { background: var(--btn-bg); }
.settings-toggle[aria-expanded="true"] { background: var(--ui-muted); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.settings-arrow { font-size: 0.75rem; transition: transform 0.2s; }
.settings-toggle[aria-expanded="true"] .settings-arrow { transform: rotate(180deg); }

/* Riga impostazioni */
#settings-row {
  background: var(--ui-muted);
  border: 1px solid var(--ui-border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, padding 0.25s ease;
}
#settings-row.open {
  max-height: 80px;
}

.settings-row-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 1.2rem;
  padding: 0.5rem 1rem;
}

.settings-inline-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ui-text-muted);
  white-space: nowrap;
}

.settings-inline-group input[type="color"] {
  width: 34px;
  height: 26px;
  padding: 1px;
  border: 1px solid var(--ui-border);
  border-radius: 3px;
  cursor: pointer;
}

.settings-inline-group input[type="range"] {
  width: 100px;
  cursor: pointer;
}

.settings-font-group { flex: 0 0 auto; }
.settings-font-group label { text-align: center; }

.settings-inline-group select {
  font-size: 0.8rem;
  padding: 2px 4px;
  border-radius: 4px;
  border: 1px solid var(--ui-border);
  font-family: var(--ui-font);
  height: 26px;
  background: var(--ui-bg);
  color: var(--ui-text);
}

#font-size-value { font-family: monospace; }

/* ============================================================
   FIX 4 – VISTA SINOTTICA: allineamento colonne
   ============================================================ */

#synoptic-view {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  max-width: var(--max-width);
  width: 95%;
  margin: 0.5rem auto 2rem auto;
  align-items: start;
}

#synoptic-view.full-text { grid-template-columns: 1fr; }
#synoptic-view.full-text #sidebar-column { display: none; }

#left-col { position: relative; min-width: 0; }

/* ============================================================
   AREA TESTO
   ============================================================ */

#tei-text-area {
  font-size: var(--tei-font-size);
  font-family: var(--serif-font);
  line-height: 1.75;
  text-align: justify;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  padding: 2rem 3rem;
  height: 80vh;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* FIX 2 – SPAZIO TRA SEZIONI */
#tei-text-area > div[data-section-index] {
  padding-top: 1.5rem;
  margin-top: 1rem;
  border-top: 1px solid #e8e4de;
}
#tei-text-area > div[data-section-index]:first-child {
  padding-top: 0;
  margin-top: 0;
  border-top: none;
}

.tei-section-head {
  text-align: right;
  font-weight: bold;
  margin-bottom: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ui-text);
  font-size: 1em;
  position: relative;
}

/* Gruppo icone (cita / permalink / salva) — appare solo all'hover */
.section-icon-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: auto;
  flex-shrink: 0;
}
.save-noterella-btn {
  opacity: 0;
  visibility: hidden;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  margin: 0;
  line-height: 1;
  transition: opacity 0.2s, visibility 0.2s;
  flex-shrink: 0;
  pointer-events: auto;   /* sempre cliccabile */
}
.tei-section-head:hover .save-noterella-btn {
  opacity: 1;
  visibility: visible;
}

/* ============================================================
   FIX 6 – TOGGLE SIDEBAR: bottone su #left-col, sempre visibile
   ============================================================ */

#toggle-sidebar-btn {
  position: absolute;
  right: -14px;
  top: 40px;
  width: 14px;
  height: 52px;
  background: #c8c4be;
  border: none;
  border-radius: 0 5px 5px 0;
  cursor: pointer;
  z-index: 200;
  font-size: 0.65rem;
  color: #555;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  padding: 0;
}
#toggle-sidebar-btn:hover { background: #a8a4a0; color: #222; }

/* ============================================================
   SIDEBAR
   ============================================================ */

#sidebar-column { min-width: 0; height: 80vh; }

#tei-sidebar-content {
  height: 100%;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  background: #fdfdfd;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-toolbar {
  padding: 0.7rem 0.9rem;
  background: var(--ui-muted);
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}
.sidebar-toolbar label {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ui-text-muted); display: block; margin-bottom: 3px;
}
#view-select {
  width: 100%; padding: 0.4rem 0.5rem;
  font-size: 0.9rem; font-weight: 600;
  font-family: var(--ui-font);
  border-radius: 4px; border: 1px solid var(--ui-border);
  background: var(--ui-bg); color: var(--ui-text);
}

.sidebar-header-dynamic {
  padding: 4px 8px; display: flex; justify-content: flex-end;
  gap: 4px; border-bottom: 1px solid #eee; flex-shrink: 0;
}
.sidebar-header-dynamic:empty { display: none; }

.occurrence-list {
  flex: 1; overflow-y: auto; padding: 8px;
  list-style: none; margin: 0;
  scrollbar-width: thin; scrollbar-color: #ccc #fdfdfd;
}
.occurrence-list::-webkit-scrollbar { width: 5px; }
.occurrence-list::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }

.occurrence-list li {
  margin-bottom: 8px; padding: 9px 11px;
  background: #fff; border: 1px solid #ebebeb;
  border-radius: 6px; border-left: 3px solid var(--accent-color);
  font-size: 0.9rem; cursor: pointer; line-height: 1.5;
  transition: transform 0.1s, background 0.15s;
}
.occurrence-list li:hover { transform: translateX(3px); background: #f8f7f5; }
.occurrence-list li.active-note { border-left-color: #8b0000; background: #fff8f7; }
.occurrence-list .empty {
  color: var(--ui-text-muted); font-style: italic; padding: 1rem; font-size: 0.9rem;
}

.section-tag {
  font-size: 0.65rem; font-weight: 700;
  color: var(--accent-color); text-transform: uppercase;
  letter-spacing: 0.06em; display: block; margin-bottom: 4px;
}

/* Intestazione descrittiva sopra la lista (ricerca, filtri, indice, temi) */
.sidebar-subheader {
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ui-text-muted);
  border-bottom: 1px solid var(--ui-border);
}

/* Intestazione di raggruppamento dentro la lista (apparato, indice nomi) */
.apparato-section-header {
  background: var(--ui-muted);
  border-left: 3px solid #8b6000;
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: default;
  margin-bottom: 2px;
  color: var(--ui-text);
}

.index-count {
  float: right;
  color: var(--ui-text-muted);
  font-family: var(--ui-font);
  font-size: 0.8em;
}

/* ============================================================
   FIX 3 – NOTE AUTORE: numero apice interattivo + popup
   ============================================================ */

sup.note-ref {
  font-size: 0.65em;
  vertical-align: super;
  line-height: 0;
  cursor: pointer;
  color: #8b0000;
  font-weight: bold;
  border-bottom: 1px dotted #8b0000;
  padding: 0 1px;
  transition: color 0.15s;
  font-style: normal;
}
sup.note-ref:hover { color: #c0392b; background: #fff5f5; border-radius: 2px; }

#note-popup {
  position: absolute;
  background: #fffdf7;
  border: 1px solid #d4b896;
  border-left: 4px solid #8b0000;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  max-width: 380px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
  z-index: 3500;
  font-size: 0.88rem;
  line-height: 1.55;
  display: none;
}
#note-popup .note-popup-header {
  font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; color: #8b0000;
  letter-spacing: 0.06em; margin-bottom: 0.4rem;
  display: flex; justify-content: space-between; align-items: center;
}
#note-popup .note-popup-close {
  background: none; border: none;
  font-size: 1rem; cursor: pointer; color: #888; padding: 0;
}

/* ============================================================
   FIX 5 – SALVA LEMMA: bottone chiaro e reattivo
   ============================================================ */

.btn-save-lemma {
  display: inline-flex; align-items: center; gap: 3px;
  float: right; margin-left: 6px;
  background: #f5f0e8; color: #666;
  border: 1px solid #d4b896; border-radius: 4px;
  padding: 2px 7px; font-size: 0.72rem;
  cursor: pointer; transition: background 0.2s;
  font-family: var(--ui-font);
}
.btn-save-lemma:hover { background: #ece4d4; }
.btn-save-lemma.saved {
  background: #e8f5e9; color: #2e7d32;
  border-color: #a5d6a7; cursor: default;
}

/* ============================================================
   PULSANTI GENERICI
   ============================================================ */

.btn {
  background: var(--accent-color); color: #fff;
  border: none; border-radius: 5px;
  padding: 0.35rem 0.65rem; cursor: pointer;
  font-family: var(--ui-font); font-size: 0.88rem;
  transition: background 0.2s;
}
.btn:hover { background: var(--accent-color-hover); }
.btn-sm { padding: 0.2rem 0.4rem; font-size: 0.78rem; }

.btn-export {
  background: #777; color: #fff; border: none;
  padding: 2px 7px; border-radius: 3px;
  font-size: 0.7rem; cursor: pointer; transition: background 0.2s;
}
.btn-export:hover { background: #444; }

/* ============================================================
   EVIDENZIAZIONE
   ============================================================ */

[data-tei-type="lem"].highlight-variant,
[data-tei-type="rdg"].highlight-variant { background: var(--highlight-variant); border-radius: 2px; }
[data-tei-type="persName"].highlight-persName { background: var(--highlight-persName); border-radius: 2px; }
[data-tei-type="placeName"].highlight-placeName { background: var(--highlight-placeName); border-radius: 2px; }
[data-tei-type="note"].highlight-note { background: var(--highlight-note); border-radius: 2px; }
[data-tei-type="ref"].highlight-ref { background: var(--highlight-ref); border-radius: 2px; }

/* Nota editoriale (es. avviso di cambio testimone tra due noterelle): sempre
   ben distinta dal testo, anche senza evidenziazione attiva — corsivo,
   carattere più piccolo, tra parentesi quadre e con spazio prima/dopo. */
[data-tei-type="note"][data-type="comment"] {
  display: block;
  font-style: italic;
  font-size: 0.85em;
  color: var(--ui-text-muted);
  margin: 1.3em 0 0.4em 0;
}
[data-tei-type="note"][data-type="comment"]::before { content: "["; }
[data-tei-type="note"][data-type="comment"]::after { content: "]"; }

[data-tei-type] { position: relative; cursor: pointer; border-radius: 2px; transition: background 0.15s; }
[data-tei-type="persName"]:hover  { border-bottom: 1px dotted #0066cc; }
[data-tei-type="placeName"]:hover { border-bottom: 1px dotted #009900; }
[data-tei-type="lem"][data-has-variant="true"]:hover { border-bottom: 1px dotted #cc9900; }

.wit-sigla { font-style: normal !important; font-weight: bold; color: var(--ui-text); margin-right: 3px; }

mark.tei-search { background: #ffff00 !important; color: #000 !important; border-radius: 2px; padding: 0 1px; }

.flash-highlight {
  outline: 2px solid #8b0000; outline-offset: 1px; border-radius: 2px;
  animation: flash-fade 2s ease-out forwards;
}
@keyframes flash-fade { 0% { outline-color: #8b0000; } 100% { outline-color: transparent; } }

/* Variante selezionata dalla sidebar: evidenziazione persistente */
[data-tei-type="lem"].pinned-variant {
  background: var(--highlight-variant) !important;
  outline: 2px solid color-mix(in srgb, var(--highlight-variant) 60%, #333);
  outline-offset: 1px;
  border-radius: 2px;
}

/* Card sidebar attiva (variante selezionata) */
.occurrence-list li.active-variant-li {
  border-left-color: #8b6000 !important;
  background: #fffbef !important;
}

/* ============================================================
   POPUP SELEZIONE TESTO
   ============================================================ */

#selection-popup {
  position: absolute; background: #fff;
  border: 1px solid var(--ui-border); border-radius: 6px;
  padding: 5px; box-shadow: 0 5px 15px rgba(0,0,0,0.15);
  z-index: 3000; display: flex; gap: 0.4rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1050px) {
  #top-controls { flex-wrap: wrap; }
  #top-controls .control-group { flex: 1 1 28% !important; }
}
@media (max-width: 980px) {
  #synoptic-view { grid-template-columns: 1fr; }
  #tei-text-area, #sidebar-column { height: auto; max-height: 62vh; }
  #toggle-sidebar-btn { display: none; }
}
@media (max-width: 600px) {
  #top-controls .control-group { flex: 1 1 45% !important; }
  #tei-text-area { padding: 1rem 1.2rem; }
}
@media (max-width: 400px) {
  #top-controls .control-group { flex: 1 1 100% !important; }
}
/* ============================================================
   SALVATAGGI: pulsante "Svuota lista" + rimozione singola (✕)
   ============================================================ */
.btn-export.btn-clear {
  background: #fbe9e7;
  color: #b23c17;
  margin-left: 4px;
}
.btn-export.btn-clear:hover { background: #f5d3cc; }

/* La ✕ va posizionata dentro ogni voce salvata */
.occurrence-list li { position: relative; }
li:has(.saved-del) { padding-right: 30px; }

.saved-del {
  position: absolute;
  top: 6px; right: 6px;
  width: 20px; height: 20px;
  padding: 0; line-height: 18px; text-align: center;
  border: none; border-radius: 50%;
  background: transparent; color: var(--ui-text-muted);
  font-size: 0.78rem; cursor: pointer;
  opacity: 0.5; transition: opacity 0.15s, background 0.15s, color 0.15s;
}
.saved-del:hover { opacity: 1; background: #fbe9e7; color: #b23c17; }

/* ============================================================
   STRUTTURA DEL TESTO: paragrafi, versi, separatori (come cartaceo)
   ============================================================ */
#tei-text-area .tei-p {
  margin: 0 0 0.9em 0;
  text-indent: 1.6em;      /* rientro prima riga come nell'edizione a stampa */
  text-align: justify;
}
#tei-text-area .tei-section-head + .tei-p,
#tei-text-area .tei-asterism + .tei-p { text-indent: 0; }

/* Gruppi di versi e singoli versi */
#tei-text-area .tei-lg { margin: 1em 0 1em 2.2em; font-style: italic; font-size: 0.93em; }
#tei-text-area .tei-l  { display: block; text-indent: 0; }

/* Separatore "* * *" centrato su riga propria */
#tei-text-area .tei-asterism {
  display: block;
  text-align: center;
  letter-spacing: 0.4em;
  margin: 1.1em 0;
  color: var(--ui-text-muted);
  text-indent: 0;
}

/* Evidenziazione del nome scelto dal filtro Luoghi/Personaggi */
#tei-text-area .highlight-filter {
  background: #ffe08a;
  outline: 2px solid var(--accent-color);
  border-radius: 3px;
  padding: 0 1px;
}

/* ============================================================
   FONT: apparato critico e testi salvati in serif; etichette/UI in sans
   ============================================================ */
/* Il contenuto delle voci nella sidebar (apparato, porzioni, noterelle) resta
   nel carattere classico, coerente col testo */
.occurrence-list li { font-family: var(--serif-font); }
/* ma le etichette di sezione, i pulsanti e i tag restano nel font UI */
.occurrence-list .section-tag,
.occurrence-list button,
.sidebar-header-dynamic,
.sidebar-header-dynamic * { font-family: var(--ui-font); }
