/* Filo: Appunti condivisi (voce 7e). Colori solo dai token di style.css. */
.cv-root { position: relative; display: flex; flex-direction: column; min-height: 100%; color: var(--text); }
.cv-loading, .cv-list-empty { padding: 24px 20px; color: var(--muted); }
.cv-gone { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; text-align: center; color: var(--muted); }
.cv-gone p { margin: 0; max-width: 360px; }
.cv-gone-note { margin: 8px 20px 0; padding: 8px 12px; border-radius: 8px; background: var(--mention-bg); color: var(--mention-text); font-size: 14px; }
.cv-ic { display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* intestazione */
.cv-head { display: flex; align-items: center; gap: 4px; min-width: 0; }
.cv-head-title { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; font-weight: 800; }
.cv-head-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-star[aria-pressed="true"] { color: var(--accent); }
.cv-panel-head { display: flex; min-width: 0; width: 100%; }
.cv-panel-head .cv-head { width: 100%; }
#panel-title:has(.cv-panel-head) { flex: 1; min-width: 0; }
.cv-root > .cv-head { padding: 10px 20px; border-bottom: 1px solid var(--border); min-height: 54px; }

/* barra di formattazione */
.cv-toolbar { position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 16px; background: var(--bg); border-bottom: 1px solid var(--border); }
.cv-tb { width: 30px; height: 30px; border-radius: 6px; display: inline-grid; place-items: center; color: var(--muted); transition: background .12s, color .12s; }
.cv-tb:hover, .cv-tb:focus-visible { background: var(--bg-hover); color: var(--text); }
.cv-tb[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-strong); }
.cv-type { height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); padding: 0 6px; margin-right: 6px; font: inherit; font-size: 13px; }
.cv-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.cv-readonly { margin: 10px 20px 0; padding: 8px 12px; border-radius: 8px; background: var(--bg-soft); color: var(--muted); font-size: 14px; }
.cv-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 20px 0; min-height: 30px; }
.cv-status { font-size: 12px; color: var(--muted); }
.cv-status[data-state="offline"], .cv-status[data-state="error"] { color: var(--danger); }
.cv-peers { display: flex; gap: 4px; }
.cv-peer { width: 22px; height: 22px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }

/* foglio */
.cv-page { position: relative; padding: 8px 20px 80px; max-width: 760px; width: 100%; margin: 0 auto; }
.cv-title { display: block; width: 100%; border: 0; resize: none; overflow: hidden; background: transparent; color: var(--text); font: inherit; font-size: 30px; line-height: 1.2; font-weight: 800; padding: 10px 0 14px; outline: none; }
.cv-title::placeholder { color: var(--muted); opacity: .7; }
.compact .cv-title { font-size: 22px; }
.cv-blocks { display: flex; flex-direction: column; }
.cv-b { position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 2px 0; }
.cv-t { flex: 1; min-width: 0; outline: none; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; min-height: 1.6em; margin: 0; font: inherit; }
.cv-t[data-ph]:empty::before { content: attr(data-ph); color: var(--muted); opacity: .8; pointer-events: none; }
.cv-root:not(.readonly) .cv-b:focus-within .cv-t:empty:not([data-ph])::before { content: "Scrivi, oppure @ per menzionare"; color: var(--muted); opacity: .6; pointer-events: none; }
.cv-h1 .cv-t { font-size: 24px; font-weight: 800; line-height: 1.3; margin-top: 14px; }
.cv-h2 .cv-t { font-size: 19px; font-weight: 800; line-height: 1.35; margin-top: 12px; }
.cv-h3 .cv-t { font-size: 16px; font-weight: 800; margin-top: 8px; }
.cv-ul::before { content: "•"; width: 18px; text-align: center; line-height: 1.6; color: var(--muted); flex: none; }
.cv-ol::before { content: attr(data-n) "."; min-width: 18px; text-align: right; line-height: 1.6; color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.cv-check-box { width: 16px; height: 16px; margin: .35em 1px 0; accent-color: var(--accent); flex: none; cursor: pointer; }
.cv-check.done .cv-t { color: var(--muted); text-decoration: line-through; }
.cv-quote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--muted); }
.cv-code .cv-t { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13.5px; background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.cv-hr { padding: 10px 0; outline: none; border-radius: 4px; }
.cv-hr hr { flex: 1; border: 0; border-top: 1px solid var(--border); margin: 0; }
.cv-hr:focus-visible, .cv-hr:focus { box-shadow: 0 0 0 2px var(--accent-soft); }
.cv-t code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 3px; }
.cv-t a { color: var(--accent-strong); text-decoration: underline; }
.cv-mention { background: var(--mention-bg); color: var(--mention-text); border-radius: 4px; padding: 0 2px; font-weight: 600; cursor: pointer; white-space: nowrap; }

/* cursori degli altri */
.cv-carets { position: absolute; inset: 0; pointer-events: none; }
.cv-caret { position: absolute; width: 2px; background: var(--peer); margin-left: -1px; border-radius: 1px; transition: left .08s, top .08s; }
.cv-caret-name { position: absolute; left: -1px; bottom: 100%; padding: 1px 5px; border-radius: 4px 4px 4px 0; background: var(--peer); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.4; white-space: nowrap; }

/* modelli */
.cv-tpl { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px 14px; margin: 6px 0 16px; background: var(--bg-soft); }
.cv-tpl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cv-tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.cv-tpl-item { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); transition: border-color .12s, background .12s; }
.cv-tpl-item:hover, .cv-tpl-item:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.cv-tpl-item span { font-size: 13px; color: var(--muted); }

/* menzioni: elenco mentre si scrive */
.cv-mpop { position: fixed; z-index: 60; width: 270px; max-height: 330px; overflow-y: auto; padding: 5px; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.cv-mitem { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.cv-mitem.on, .cv-mitem:hover { background: var(--bg-hover); }
.cv-mdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.cv-muser { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }

/* nel pannello e nella conversazione */
.cv-panel-host { min-height: 100%; }
.panel .cv-toolbar { padding: 6px 12px; }
.panel .cv-page, .panel .cv-top { padding-left: 16px; padding-right: 16px; }
.panel .cv-title { font-size: 24px; }
.cv-card { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 14px; max-width: 420px; width: 100%; text-align: left; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); transition: border-color .12s, background .12s; }
.cv-card:hover, .cv-card:focus-visible { border-color: var(--accent); background: var(--bg-soft); }
.cv-card-ic { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-strong); flex: none; }
.cv-card-txt { display: flex; flex-direction: column; min-width: 0; }
.cv-card-txt b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-card-txt span { font-size: 13px; color: var(--muted); }
.cv-msg-text { color: var(--muted); }
.cv-card.gone { opacity: .65; }
.cv-card.gone .cv-card-title { font-weight: 600; color: var(--muted); }
.cv-bar { display: inline-flex; align-items: center; gap: 4px; }
.cv-bar-n { color: var(--muted); font-weight: 400; }
.cv-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.cv-new { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; margin: 0 6px 6px; }
.cv-row { text-align: left; width: 100%; }
.cv-row-star { color: var(--accent); }
.cv-pop-list { width: 320px; max-height: 420px; overflow-y: auto; }

/* pagina a tutta larghezza */
.cv-full-page { grid-row: 2; grid-column: main-start / panel-end; min-width: 0; min-height: 0; overflow-y: auto; background: var(--bg); }
.cv-page-host { min-height: 100%; }
.app.cv-full > .main, .app.cv-full > .view-page, .app.cv-full > .search-page, .app.cv-full > .panel, .app.cv-full > #rs-panel { display: none !important; }
.cv-full-page .cv-page { padding-top: 24px; }
.cv-full-page .cv-title { font-size: 34px; }
.cv-back { margin-top: 8px; }
@media (max-width: 760px) {
  .cv-full-page { grid-area: main; }
  .cv-page { padding: 8px 16px 60px; }
  .cv-toolbar { padding: 6px 10px; }
  .cv-title, .cv-full-page .cv-title { font-size: 24px; }
}

/* stampa: solo il documento */
.cv-print { display: none; }
@media print {
  body.cv-printing > :not(.cv-print) { display: none !important; }
  body.cv-printing { background: #fff; color: #000; }
  body.cv-printing .cv-print { display: block; padding: 0; font: 12pt/1.5 Georgia, "Times New Roman", serif; color: #000; }
  .cv-print h1 { font-size: 22pt; margin: 0 0 12pt; }
  .cv-print h2 { font-size: 16pt; margin: 14pt 0 4pt; } .cv-print h3 { font-size: 13pt; margin: 12pt 0 4pt; } .cv-print h4 { font-size: 12pt; margin: 10pt 0 4pt; }
  .cv-print .cv-pb { white-space: pre-wrap; margin: 2pt 0; }
  .cv-print blockquote { border-left: 2pt solid #999; margin: 6pt 0; padding-left: 8pt; color: #333; }
  .cv-print pre { font: 10pt ui-monospace, Menlo, monospace; border: 1px solid #ccc; padding: 6pt; }
  .cv-print a { color: #000; }
  .cv-print .cv-mention { background: none; color: #000; font-weight: 700; }
  .cv-print hr { border: 0; border-top: 1px solid #999; }
}
@media (prefers-reduced-motion: reduce) { .cv-caret, .cv-tb, .cv-tpl-item, .cv-card { transition: none; } }
