/* ==========================================================================
   Condivisi: file, note e codice per tutti gli utenti o per persone scelte
   (js/condivisi.js)
   ========================================================================== */
.sh { display: flex; flex-direction: column; gap: 16px; padding-bottom: 40px; }
.sh-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.sh-head h1 { font-size: 34px; margin: 0; }
.sh-sub { margin: 4px 0 0; color: var(--ink-3); font-size: 14.5px; }
.sh-new { display: inline-flex; align-items: center; gap: 8px; }
.sh-new svg { width: 18px; height: 18px; }

.sh-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sh-tabs { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--fill-2); align-self: flex-start; max-width: 100%; overflow-x: auto; }
.sh-tabs a { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 14px; white-space: nowrap; }
.sh-tabs a span { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.sh-tabs a.on { background: var(--raised); color: var(--ink); box-shadow: 0 0 0 1px var(--stroke), 0 1px 2px rgba(0,0,0,0.12); }

/* tipo: Tutto / File / Note / Codice */
.sh-kinds { display: flex; gap: 6px; flex-wrap: wrap; }
.sh-kind { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--stroke); border-radius: 999px; background: none; color: var(--ink-2); font: inherit; font-size: 13.5px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.sh-kind svg { width: 15px; height: 15px; }
.sh-kind:hover { background: var(--fill); color: var(--ink); }
.sh-kind.on { background: var(--solid); border-color: transparent; color: var(--on-solid); }

.sh-search { position: relative; display: block; }
.sh-search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.sh-search .nb-input { width: 100%; padding-left: 38px; min-height: 42px; }

.sh-empty { color: var(--ink-3); margin: 8px 0; }
.sh-quota { color: var(--ink-3); font-size: 13px; margin: 0; }
.sh-muted { color: var(--ink-3); font-size: 13px; }

.sh-list { list-style: none; margin: 0; padding: 0; width: 100%; max-width: none; border: 1px solid var(--stroke); border-radius: var(--r-tray); background: var(--sheet); overflow: hidden; }
.sh-row { max-width: none; margin: 0; display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; }
.sh-row + .sh-row { border-top: 1px solid var(--stroke); }
.sh-open { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 12px; padding: 10px; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 12px; }
.sh-open:hover { background: var(--fill); }
.sh-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--fill-2); color: var(--ink-2); }
.sh-ic svg { width: 20px; height: 20px; }
.sh-ic-note { background: rgba(255, 159, 10, 0.16); color: #c77700; }
.sh-ic-code { background: rgba(10, 132, 255, 0.14); color: #0a6fd6; }
:root[data-theme="dark"] .sh-ic-note { color: #ffb340; }
:root[data-theme="dark"] .sh-ic-code { color: #5eb0ff; }
.sh-txt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sh-txt b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-txt small { color: var(--ink-3); font-size: 13px; }
.sh-note { font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.sh-aud { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.sh-aud svg { width: 14px; height: 14px; flex: none; }
.sh-aud-none { color: var(--ko); }
.sh-acts { display: flex; gap: 4px; flex: none; }
.sh-del:hover { color: #ff453a; }
.sh-acts .spin svg { animation: sh-spin .9s linear infinite; }
@keyframes sh-spin { to { transform: rotate(360deg); } }

/* dentro il Quaderno (#/quaderno/condivisi): la pagina è .nb-page, qui solo il contenuto */
.sh.sh-in { padding-bottom: 0; gap: 14px; }

#shared-count:not(:empty) { min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--solid); color: var(--on-solid); font-size: 11.5px; font-weight: 650; text-align: center; }

/* finestra: condividi / con chi è condiviso */
.sh-modal { width: min(560px, 100%); }
.sh-form { display: flex; flex-direction: column; gap: 12px; }
.sh-form h3 { margin: 0; overflow-wrap: anywhere; }
.sh-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 14px; border: 1.5px dashed var(--stroke); border-radius: 14px; color: var(--ink-2); cursor: pointer; text-align: center; transition: background .15s, border-color .15s; }
.sh-drop svg { width: 26px; height: 26px; }
.sh-drop small { color: var(--ink-3); }
.sh-drop:hover, .sh-drop.over { background: var(--fill); border-color: var(--ink-3); }
.sh-picked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sh-picked:empty { display: none; }
.sh-picked li { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 6px; border-radius: 10px; background: var(--fill-2); }
.sh-picked li > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-picked li small { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.sh-picked li.bad small { color: var(--ko); }
.sh-picked .sh-ic { width: 30px; height: 30px; }
.sh-picked .sh-ic svg { width: 17px; height: 17px; }
.sh-notein { width: 100%; resize: vertical; min-height: 56px; }
.sh-seg { align-self: flex-start; }
.sh-seg button { display: inline-flex; align-items: center; gap: 6px; }
.sh-seg svg { width: 16px; height: 16px; }
.sh-pick { display: flex; flex-direction: column; gap: 8px; }
.sh-pick[hidden] { display: none; }
.sh-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; align-items: center; }
.sh-chip { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--fill-2); color: var(--ink); font: inherit; font-size: 13px; cursor: pointer; }
.sh-chip:hover { background: var(--fill-3); }
.sh-chip span { opacity: .7; margin-left: 2px; }
.sh-users { list-style: none; margin: 0; padding: 4px; max-height: min(40vh, 320px); overflow-y: auto; border: 1px solid var(--stroke); border-radius: 12px; }
.sh-user { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 0; border-radius: 9px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.sh-user:hover { background: var(--fill); }
.sh-user.on { background: var(--fill-2); }
/* le persone: ognuna col suo colore (--lv, dal suo id) e le iniziali */
.sh-av { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--lv, var(--fill-2)); color: #fff; font-size: 12.5px; font-weight: 650; letter-spacing: .02em; line-height: 1; }
.sh-av.xs { width: 20px; height: 20px; font-size: 8.5px; letter-spacing: 0; }
.sh-txt small .sh-av.xs { display: inline-grid; vertical-align: middle; margin: -3px 6px -1px 0; position: relative; top: -1px; }
.sh-avs { display: inline-flex; flex: none; }
.sh-avs .sh-av + .sh-av { margin-left: -6px; }
.sh-avs .sh-av { box-shadow: 0 0 0 1.5px var(--card, var(--sheet, #fff)); }
.sh-user.on .sh-av { box-shadow: 0 0 0 2px var(--raised), 0 0 0 4px var(--lv, var(--solid)); }
.sh-un { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-un b { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-un small { color: var(--ink-3); font-size: 12.5px; }
.sh-tick { width: 20px; height: 20px; flex: none; color: var(--ink); }
.sh-tick svg { width: 20px; height: 20px; }
.sh-err { margin: 0; color: var(--ko); font-size: 14px; }
.sh-err[hidden] { display: none; }
.sh-what { align-self: stretch; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.sh-what button { justify-content: center; }
.sh-items .sh-ic { width: 32px; height: 32px; border-radius: 9px; }
.sh-items .sh-ic svg { width: 17px; height: 17px; }
.sh-items .sh-un small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-again { display: flex; gap: 8px; align-items: flex-start; margin: 0; padding: 9px 12px; border-radius: 12px; background: var(--fill); color: var(--ink-2); font-size: 13.5px; }
.sh-again svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.sh-again[hidden] { display: none; }

/* nota: «Manda una copia» o «Scrivi insieme» (nota dal vivo, js/live.js) */
.sh-how { align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; }
.sh-how button { justify-content: center; }
.sh-how[hidden], .sh-seg[hidden], .sh-notein[hidden] { display: none; }
.sh-livei { margin: 0; padding: 9px 12px; border-radius: 12px; background: var(--fill); color: var(--ink-2); font-size: 13.5px; line-height: 1.45; }
.sh-livei.warn { background: rgba(255, 159, 10, 0.14); color: var(--ink); }
.sh-livei[hidden] { display: none; }
.sh-user[disabled] { cursor: default; opacity: .55; }
.sh-user[disabled]:hover { background: none; }
/* chi scrive nella nota dal vivo */
.lv-people { max-height: min(46vh, 360px); }
.lv-person { cursor: default; }
.lv-person:hover { background: none; }
.lv-person .sh-av { font-size: 13px; }
/* testo scuro sui colori chiari (arancione, verde, azzurro, giallo), come in css/live.css */
@supports (color: oklch(from red l c h)) {
  .sh-av { color: oklch(from var(--lv, #8e8e93) clamp(0.2, (0.72 - l) * 1000, 1) 0 0); }
}
.lv-person .btn { flex: none; }
.sh-modal .nb-modal-actions .btn svg { width: 17px; height: 17px; margin-right: 6px; vertical-align: -3px; }

/* anteprima di una nota o del codice */
.nb-modal.sh-prev { width: min(880px, 100%); display: flex; flex-direction: column; gap: 12px; }
.sh-prev-head { display: flex; align-items: center; gap: 12px; }
.sh-prev-head .sh-txt { flex: 1; }
.sh-prev-head .sh-txt b { font-size: 17px; white-space: normal; overflow-wrap: anywhere; }
.sh-prev-note { margin: 0; padding: 8px 12px; border-left: 3px solid var(--ink-4); }
.sh-prev-body { min-height: 120px; max-height: min(64vh, 720px); overflow: auto; border: 1px solid var(--stroke); border-radius: 14px; background: var(--sheet); padding: 18px 20px; }
.sh-prev-body > .sh-empty { margin: 0; }
.sh-prev-acts { margin-top: 0; justify-content: space-between; }
.sh-prev-acts .btn { display: inline-flex; align-items: center; gap: 8px; }
.sh-prev-acts .btn svg { width: 17px; height: 17px; }
.sh-ro { display: inline-flex; align-items: center; gap: 6px; }
.sh-ro svg { width: 16px; height: 16px; }
.sh-doc { max-width: 72ch; margin: 0 auto; }
.sh-doc .nb-fig img { cursor: default; }
.sh-doc .nb-draw-svg svg { max-height: 320px; }
.sh-ink { width: 100%; margin: 0 auto; gap: 14px; }
.sh-prev-body:has(.sh-ink) { background: var(--tray); padding: 14px; }
.sh-map { height: min(56vh, 560px); }
.sh-map svg { width: 100%; height: 100%; }
.sh-filecard { display: flex; align-items: center; gap: 12px; }
.sh-filecard .nb-file-main { flex: 1; display: flex; flex-direction: column; }

/* codice: elenco dei file a sinistra, testo con i numeri di riga */
.sh-prev-body:has(.sh-codev) { padding: 0; overflow: hidden; display: flex; }
.sh-codev { flex: 1; min-width: 0; display: flex; }
.sh-cfiles { list-style: none; margin: 0; padding: 6px; width: 220px; flex: none; overflow: auto; border-right: 1px solid var(--stroke); background: var(--tray); }
.sh-cfiles button { width: 100%; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.sh-cfiles button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.sh-cfiles button svg { width: 15px; height: 15px; flex: none; }
.sh-cfiles button:hover { background: var(--fill); color: var(--ink); }
.sh-cfiles button.on { background: var(--fill-2); color: var(--ink); font-weight: 550; }
.sh-cbody { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sh-code-head { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; border-bottom: 1px solid var(--stroke); font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.sh-code-head span { color: var(--ink-3); white-space: nowrap; font-family: inherit; }
.sh-code-scroll { flex: 1; overflow: auto; display: flex; align-items: flex-start; min-height: 0; max-height: min(58vh, 660px); }
.sh-code-scroll pre { margin: 0; padding: 12px 0; font-family: var(--mono); font-size: 13px; line-height: 1.55; background: none; border: 0; border-radius: 0; }
.sh-gut { position: sticky; left: 0; flex: none; padding: 12px 10px 12px 14px !important; text-align: right; color: var(--ink-4); background: var(--sheet) !important; user-select: none; }
.sh-src { flex: 1; padding-right: 16px !important; color: var(--ink); tab-size: 4; }
.sh-src code { font: inherit; background: none; padding: 0; border-radius: 0; white-space: pre; }
.sh-cbody > .sh-muted { padding: 10px 14px; margin: 0; }
.sh-bin { padding: 18px !important; }

@media (max-width: 600px) {
  .sh-head h1 { font-size: 28px; }
  .sh-new { width: 100%; justify-content: center; }
  .nb-shared .nb-actions { flex: 1 1 100%; }
  .sh-row { padding-right: 4px; }
  .sh-acts .btn-icon { width: 34px; height: 34px; }
  .sh-bar { align-items: stretch; }
  .sh-tabs { width: 100%; }
  .sh-tabs a { flex: 1; justify-content: center; }
  .sh-kinds { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .sh-prev-body { padding: 14px; max-height: none; }
  .sh-codev.multi { flex-direction: column; }
  .sh-cfiles { width: auto; display: flex; gap: 4px; border-right: 0; border-bottom: 1px solid var(--stroke); overflow-x: auto; }
  .sh-cfiles button { white-space: nowrap; }
  .sh-cfiles button span { direction: ltr; }
  .sh-code-scroll { max-height: 60vh; }
  .sh-prev-acts { flex-direction: column-reverse; align-items: stretch; }
  .sh-prev-acts .btn { justify-content: center; }
  .sh-ro { justify-content: center; }
}
