:root { --red: #d12031; --ink: #1d1f23; --muted: #6b7078; --line: #e3e5e8; --bg: #f4f5f7; --card: #fff; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--red); }
h1 { font-size: 1.6rem; margin: .4em 0 .6em; }
h2 { font-size: 1.2rem; margin: 0 0 .6em; }
h3 { font-size: 1.05rem; margin: .2em 0; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: #fff; border-bottom: 3px solid var(--red); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { height: 26px; }
.topbar nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: .95rem; }
.topbar nav a { text-decoration: none; color: var(--ink); }
.topbar nav form { margin: 0; }
.linklike { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin: 0 0 14px; }
.card.link { text-decoration: none; color: inherit; transition: border-color .15s; }
.card.link:hover { border-color: var(--red); }
.card.hero { border-left: 5px solid var(--red); }
.card.narrow { max-width: 420px; margin: 40px auto; }
.card.danger summary { color: var(--red); cursor: pointer; }
.kicker { text-transform: uppercase; letter-spacing: 1px; font-size: .75rem; color: var(--muted); }
.muted { color: var(--muted); }
.warn { background: #fff4e0; border: 1px solid #f3d29a; border-radius: 10px; padding: 10px 12px; }
.crumbs { margin: 0; font-size: .9rem; color: var(--muted); }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; background: #e8f5e9; border: 1px solid #b7dfb9; }
.flash.error { background: #fdecea; border-color: #f5c2bd; }
.flash.info { background: #e8f0fe; border-color: #bcd0f7; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.list .card { margin-bottom: 8px; }
.btn { display: inline-block; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn:disabled { opacity: .5; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #cfd3d8; border-radius: 10px; background: #fff; width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; }
.form label, .form > div > label { display: block; font-weight: 600; margin: 10px 0 4px; }
.form label input, .form label select, .form label textarea { margin-top: 4px; font-weight: 400; }
.form .helptext { display: block; color: var(--muted); font-size: .85rem; margin-top: 2px; }
.form .errorlist { color: var(--red); margin: 4px 0; padding-left: 18px; }
.form > .btn, .form button.btn { margin-top: 14px; }
.row label { display: flex; flex-direction: column; font-weight: 600; font-size: .9rem; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 400 !important; margin: 6px 0 !important; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; margin: 8px 0; }
.presence { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: center; }
.presence .radio { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.presence .sub { flex: 1 1 260px; font-size: .9rem; }
form.inline { display: inline; }
details summary { cursor: pointer; margin: 6px 0; }
.pill { font-size: .8rem; padding: 3px 10px; border-radius: 999px; background: #eef0f3; white-space: nowrap; }
.pill.open { background: #e8f5e9; color: #1b7a2e; }
.pill.locked { background: #fff4e0; color: #9a5b00; }
.pill.draft { background: #eef0f3; }
.pill.archived { background: #ece8f5; color: #5a3d8f; }
.copy { display: flex; gap: 8px; margin: 10px 0; }

/* anteprime slide */
.stage-host { position: relative; overflow: hidden; background: #000; aspect-ratio: 16 / 9; border-radius: 8px; margin: 8px 0; }
.stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; }
.play-badge { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 110px; display: flex; align-items: center; justify-content: center; }
.preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.preview-grid.wide figure { margin: 0; }
.preview-grid figcaption { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preview-grid .grid-title { grid-column: 1 / -1; margin: 14px 0 0; color: var(--red); }

/* upload */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px; border: 2px dashed #cfd3d8; border-radius: 14px;
  text-align: center; cursor: pointer; background: #fafbfc; }
.dropzone.over, .dropzone:hover { border-color: var(--red); background: #fff5f6; }
.dropzone input { display: none; }
.dropzone strong { color: var(--red); }
.transfer { display: grid; grid-template-columns: 1fr 120px 70px; gap: 8px; align-items: center; font-size: .9rem; margin: 8px 0; }
.transfer .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfer progress { width: 100%; accent-color: var(--red); }
.transfer.failed { color: var(--red); grid-template-columns: 1fr auto; }
.transfer.failed progress { display: none; }
.items { margin-top: 12px; }
.item { display: grid; grid-template-columns: 120px 1fr auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.item .thumb { position: relative; display: block; width: 120px; aspect-ratio: 16 / 9; background: #eee; border-radius: 6px; overflow: hidden; }
.item .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item .thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.item .badge { position: absolute; right: 4px; bottom: 4px; background: rgba(0, 0, 0, .7); color: #fff; font-size: .7rem; padding: 1px 6px; border-radius: 4px; }
.removed-slides { margin-top: 14px; }
.removed-slides summary { cursor: pointer; color: var(--muted, #666); padding: 6px 0; }
.item.removed .thumb img { opacity: .55; filter: grayscale(1); }
.item .meta { min-width: 0; }
.item .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.item .meta small { color: var(--muted); }
.item.error .meta small { color: var(--red); }
.item .actions { display: flex; gap: 4px; }
.item .actions button, .tbl button { min-width: 38px; height: 38px; border: 1px solid var(--line); background: #fff; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.item .actions button:disabled, .tbl button:disabled { opacity: .35; cursor: default; }
.spinner { width: 22px; height: 22px; border: 3px solid #ddd; border-top-color: var(--red); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* gestione */
.columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.off td { opacity: .5; }
.tbl .num { color: var(--muted); width: 28px; }
.nowrap { white-space: nowrap; text-align: right; }
.toggle { min-width: 52px !important; font-weight: 700; font-size: .75rem !important; color: var(--muted); }
.toggle.on { background: var(--red) !important; color: #fff; border-color: var(--red) !important; }
.members { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.member { display: flex !important; gap: 12px; align-items: center; margin: 0 !important; }
.member img, .member .avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.member .avatar { display: flex; align-items: center; justify-content: center; background: var(--red); color: #fff; font-weight: 700; }
.member.off { opacity: .5; }
.account { padding: 12px 0; border-bottom: 1px solid var(--line); }
.grid-rows { display: flex; flex-direction: column; gap: 8px; }
.grid-row, .grid-head { display: grid; grid-template-columns: 1.2fr 1.2fr 1fr; gap: 8px; }
.grid-rows.two .grid-row { grid-template-columns: 1fr 1fr; }
.grid-head { font-size: .8rem; color: var(--muted); }
.grid-row .stack { display: flex; flex-direction: column; gap: 4px; }

@media (max-width: 720px) {
  .columns { grid-template-columns: 1fr; }
  .grid-row, .grid-head { grid-template-columns: 1fr; }
  .grid-head { display: none; }
  .grid-row { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .item { grid-template-columns: 96px 1fr; }
  .item .thumb { width: 96px; }
  .item .actions { grid-column: 1 / -1; justify-content: flex-end; }
  h1 { font-size: 1.35rem; }
}

/* barra superadmin "agisci come" */
.imp-bar { background: #23262b; color: #ddd; font-size: .85rem; padding: 6px 16px; }
.imp-bar.active { background: #ffd54a; color: #3a2d00; }
.imp-bar form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; max-width: 1100px; margin: 0 auto; }
.imp-bar select { width: auto; max-width: 340px; padding: 4px 8px; font-size: .85rem; }
.imp-bar a { color: inherit; margin-left: auto; }
.imp-btn { background: #3a2d00; color: #ffd54a; border: 0; border-radius: 6px; padding: 5px 12px; font-weight: 700; cursor: pointer; }

/* team */
.role-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: #f1f2f4; border-radius: 999px; padding: 3px 4px 3px 12px; font-size: .9rem; }
.chip button { border: 0; background: #fff; border-radius: 50%; width: 24px; height: 24px; cursor: pointer; }
.chip.add { background: none; padding: 0; }
.chip.add select { padding: 4px 8px; font-size: .85rem; border-radius: 999px; }
.preview-grid.one { grid-template-columns: 1fr; }
.paste-btn { margin-top: 8px; width: 100%; }
.paste-btn[hidden] { display: none; }
@media (hover: none) { .paste-hint { display: none; } }
.item .meta .num { color: var(--muted); font-weight: 400; }
.edit-label { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .95rem; padding: 0 4px; }
.edit-label:hover { color: var(--red); }
.item .meta b.editing { display: flex; align-items: center; gap: 6px; overflow: visible; }
.item .meta b.editing .edit-label { display: none; }
.label-input { flex: 1; min-width: 0; padding: 4px 8px; font-size: .95rem; }

/* anteprima cliccabile e slideshow */
.preview-grid figure { margin: 0; }
.preview-grid .stage-host { cursor: zoom-in; }
.preview-actions { gap: 6px; }
.preview-actions .btn { padding: 6px 12px; }
body.ss-open { overflow: hidden; }
.ss-overlay { position: fixed; inset: 0; z-index: 100; background: #0d0e10; color: #eee; }
.ss-overlay[hidden] { display: none; }
.ss-top { position: absolute; left: 0; right: 0; top: 0; height: 48px; display: flex; align-items: center; gap: 10px; padding: 0 12px; }
.ss-count { font-variant-numeric: tabular-nums; color: #aaa; white-space: nowrap; }
.ss-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-btn { background: #24272d; color: #eee; border: 1px solid #3a3e46; border-radius: 8px; min-width: 38px; height: 34px; cursor: pointer; font-size: 1rem; }
.ss-btn:hover { background: #30343c; }
.ss-stage.stage-host { position: absolute; left: 0; right: 0; top: 48px; bottom: 12px; aspect-ratio: auto; border-radius: 0; margin: 0; background: #0d0e10; cursor: pointer; }
.ss-empty { text-align: center; margin-top: 30vh; color: #999; }
.ss-nav { position: absolute; top: 50%; width: 52px; height: 88px; margin-top: -44px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .1);
  color: #fff; font-size: 2.6rem; line-height: 1; cursor: pointer; z-index: 2; }
.ss-nav:hover { background: rgba(255, 255, 255, .22); }
.ss-nav:disabled { opacity: .15; cursor: default; }
.ss-nav.prev { left: 10px; }
.ss-nav.next { right: 10px; }
@media (hover: none) { .ss-nav { background: rgba(0, 0, 0, .25); width: 40px; } }

/* partecipanti attesi (home) */
.attendance { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.attendance-total { font-size: 2.2rem; font-weight: 800; color: var(--red); line-height: 1; }
.attendance small { color: var(--muted); }

/* aggiunta sezioni alla riunione */
.add-section { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.add-section summary { font-weight: 600; color: var(--red); }
.add-section select { width: auto; flex: 1; }

/* presentazioni approfondite */
.info { background: #eef4ff; border: 1px solid #c9dafb; border-radius: 10px; padding: 10px 12px; }
.deep-badge { margin: 6px 0 0; color: var(--red); font-weight: 600; font-size: .92rem; }
ul.plain { list-style: none; padding: 0; margin: 6px 0; }
ul.plain li { padding: 4px 0; }
.speaker-add .row label { flex: 1 1 200px; }
.speaker-add .row label.grow { flex: 3 1 260px; }
.nowrap-left { white-space: nowrap; }

/* date di visibilità */
.dates { color: #2c5ea8; }
.dates.expired { color: var(--muted); text-decoration: line-through; }
.dates.future { color: #9a5b00; }
.dates-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; font-size: .85rem; }
.dates-form[hidden] { display: none; }
.dates-form input { width: auto; padding: 4px 6px; }
.dates-form .btn { padding: 4px 10px; }

/* riuso slide */
.reuse-toggle { margin-top: 8px; width: 100%; }
.reuse-panel { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fafbfc; }
.reuse-panel[hidden] { display: none; }
.reuse-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.reuse-scopes { display: flex; gap: 12px; flex-wrap: wrap; font-size: .9rem; }
.reuse-scopes label { display: flex; align-items: center; gap: 4px; }
.reuse-search { flex: 1 1 180px; max-width: 280px; padding: 6px 10px; }
.reuse-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; max-height: 420px; overflow-y: auto; }
.reuse-item { display: flex; flex-direction: column; gap: 2px; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 8px; padding: 4px; cursor: pointer; font: inherit; }
.reuse-item.selected { border-color: var(--red); box-shadow: 0 0 0 2px rgba(209, 32, 49, .2); }
.reuse-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #eee; border-radius: 4px; overflow: hidden; }
.reuse-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reuse-thumb i { position: absolute; right: 3px; bottom: 3px; background: rgba(0, 0, 0, .7); color: #fff; font-size: .7rem; font-style: normal; padding: 0 5px; border-radius: 3px; }
.reuse-item b { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reuse-item small { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reuse-actions { display: flex; gap: 8px; align-items: center; }
.reuse-actions .grow { flex: 1; }

/* l'attributo hidden deve vincere su display:inline-block dei pulsanti */
.btn[hidden] { display: none; }
