/* Pannello gestione — usa i token di styles.css */
.panel-main { padding-top: 1.6rem; padding-bottom: 4rem; max-width: 980px; }
.panel-actions { display: flex; gap: .5rem; align-items: center; }
.panel-actions form { margin: 0; }
.btn--sm { padding: .5rem 1rem; font-size: .82rem; }
.panel-title { font-size: clamp(1.6rem, 5vw, 2.2rem); color: var(--text-bright); }
.panel-intro { margin-bottom: 1.2rem; }
.panel-section { padding-top: 1.2rem; scroll-margin-top: 80px; }
.panel-section h2 { font-size: 1.35rem; margin-bottom: 1rem; color: var(--text-bright); }
.tip { font-size: .88rem; margin: 1rem 0 1.2rem; }

/* Tab */
.panel-tabs { display: flex; gap: .5rem; margin: 0 0 .5rem; position: sticky; top: 64px; z-index: 20; padding: .5rem 0; background: linear-gradient(var(--bg) 70%, transparent); }
.panel-tabs a { display: inline-flex; gap: .5rem; align-items: center; padding: .55rem 1.1rem; border-radius: 999px; border: 1px solid var(--border-strong); font-weight: 700; font-size: .9rem; background: rgba(16,19,32,.8); }
.panel-tabs a span { font-size: .75rem; padding: .05rem .5rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.panel-tabs a:hover { border-color: var(--accent); }

/* Messaggi */
.flash-list { display: grid; gap: .5rem; margin-bottom: 1rem; }
.flash { padding: .75rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--panel); font-size: .92rem; }
.flash--success { border-color: rgba(45,212,191,.5); background: rgba(45,212,191,.1); }
.flash--error { border-color: rgba(255,90,90,.5); background: rgba(255,90,90,.1); }

/* Login */
.login-card { max-width: 420px; margin: 8vh auto 0; display: grid; gap: 1rem; }
.login-card h1 { font-size: 1.6rem; color: var(--text-bright); }
.form-stack { display: grid; gap: 1rem; }

/* Upload */
.upload { padding: 0; overflow: hidden; }
.upload__drop { position: relative; display: grid; justify-items: center; gap: .4rem; text-align: center; padding: 1.8rem 1rem; cursor: pointer; border: 2px dashed var(--border-strong); border-radius: var(--radius); margin: .8rem; transition: border-color .2s ease, background .2s ease; }
.upload__drop:hover, .upload__drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.upload__drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload__icon { font-size: 2rem; }
.upload__drop small { color: var(--muted); max-width: 32ch; }
.upload__status { margin: 0 .8rem .8rem; font-size: .9rem; color: var(--gold); }

/* Foto */
.role-btns { display: flex; gap: .4rem; flex-wrap: wrap; }
.role-btns form { margin: 0; }
.role-btns .btn:disabled { opacity: 1; cursor: default; }
.photo-grid, .video-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.photo-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.photo { padding: .7rem; display: grid; gap: .6rem; align-content: start; }
.photo:hover, .video:hover { transform: none; }
.photo__img { position: relative; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 4/3; background: #000; }
.photo__img img { width: 100%; height: 100%; object-fit: cover; }
.tag { position: absolute; top: .5rem; left: .5rem; padding: .2rem .65rem; border-radius: 999px; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--accent); color: #fff; }
.tag--alt { background: var(--accent-2); }
.photo__caption { display: flex; gap: .4rem; }
.photo__caption input, .video-add input { flex: 1; min-width: 0; padding: .6rem .8rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: rgba(14,17,28,.85); color: var(--text); font: inherit; font-size: .9rem; }
.photo__caption input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.photo__tools { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.photo__tools form { margin: 0; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border-strong); background: rgba(16,19,32,.9); color: var(--text); font-size: 1.05rem; cursor: pointer; transition: background .2s ease, border-color .2s ease, opacity .2s ease; }
.icon-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn--danger:hover:not(:disabled) { border-color: #ff5a5a; background: rgba(255,90,90,.15); }

/* Video */
.video-add { display: grid; gap: 1rem; margin-bottom: 1.2rem; }
.video { display: grid; gap: .8rem; padding: .7rem; }
.video > img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-sm); }
.video__body { display: grid; gap: .6rem; align-content: start; }
.video.is-hidden { opacity: .6; }
@media (min-width: 40rem) {
  .video { grid-template-columns: 220px 1fr; align-items: center; }
}

@media (prefers-reduced-motion: no-preference) {
  .panel .photo, .panel .video { animation: panelIn .5s var(--ease) both; }
}
@keyframes panelIn { from { opacity: 0; transform: translateY(10px); } }

/* ===== Mobile e riordino a trascinamento ===== */
.howto { list-style: none; padding: 0; margin: 1rem 0; display: grid; gap: .4rem; font-size: .88rem; color: var(--muted); }
.howto li { display: flex; gap: .6rem; align-items: center; }
.howto__ico { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 800; }
.push-right { margin-left: auto !important; }
.drag-handle {
  position: absolute; top: .5rem; right: .5rem;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.35);
  background: rgba(10,12,20,.72); color: #fff;
  font-size: 1.35rem; line-height: 1; cursor: grab;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.drag-handle:active { cursor: grabbing; background: var(--accent); }
.video__thumb { position: relative; }
.video__thumb img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.js-sort .arrows { display: none; }
.is-dragging { z-index: 5; transform: scale(1.04) !important; box-shadow: 0 22px 50px rgba(0,0,0,.6), 0 0 0 2px var(--accent) !important; opacity: .96; transition: none !important; animation: none !important; }
.is-sorting { user-select: none; -webkit-user-select: none; }
.toast { position: fixed; left: 50%; bottom: calc(1rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 300; padding: .7rem 1.2rem; border-radius: 999px; background: rgba(12,14,24,.96); border: 1px solid rgba(45,212,191,.5); color: #fff; font-weight: 600; font-size: .9rem; box-shadow: var(--shadow); }
.toast.is-error { border-color: rgba(255,90,90,.6); }

@media (max-width: 39.99rem) {
  .panel-main { padding-top: 1rem; }
  .panel-actions .btn--ghost { display: none; }
  .photo-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .photo { padding: .5rem; gap: .5rem; }
  .photo .tag { font-size: .62rem; padding: .15rem .5rem; }
  .role-btns { flex-wrap: nowrap; }
  .role-btns form { flex: 1; }
  .role-btns .btn { width: 100%; padding: .55rem .3rem; font-size: .74rem; white-space: nowrap; }
  .photo__caption { flex-wrap: wrap; }
  .photo__caption input { flex-basis: 100%; }
  .photo__caption .btn { flex: 1; }
  .icon-btn { width: 44px; height: 44px; }
  .drag-handle { width: 44px; height: 44px; top: .35rem; right: .35rem; }
  .upload__drop { padding: 1.4rem .8rem; }
  .panel-tabs { top: 56px; }
}

/* ===== Pagina Testi ===== */
.lang-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.lang-tabs a { padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--border-strong); font-weight: 700; font-size: .85rem; background: rgba(16,19,32,.8); }
.lang-tabs a.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.text-section { margin-bottom: 1rem; display: grid; gap: .9rem; }
.text-section h2 { font-size: 1.05rem; margin: 0; color: var(--gold); }
.text-field { display: grid; gap: .35rem; }
.text-field > span { font-size: .8rem; font-weight: 700; letter-spacing: .03em; color: var(--muted); display: flex; gap: .5rem; align-items: center; }
.text-field textarea { width: 100%; padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: rgba(14,17,28,.85); color: var(--text); font: inherit; font-size: .95rem; line-height: 1.55; resize: none; overflow: hidden; }
.text-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.badge-changed { font-size: .65rem; padding: .1rem .5rem; border-radius: 999px; background: rgba(233,184,114,.15); color: var(--gold); text-transform: uppercase; letter-spacing: .06em; }
.savebar { position: sticky; bottom: 0; z-index: 30; display: flex; gap: .6rem; align-items: center; padding: .8rem 0 calc(.8rem + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 35%); }
.savebar .btn { flex: 1; }
.back-link { display: inline-block; margin-bottom: .6rem; color: var(--muted); font-size: .9rem; }

/* ===== Sezioni e menu ===== */
[hidden] { display: none !important; }
.panel-tabs { flex-wrap: wrap; }
.section-list { list-style: none; padding: 0; display: grid; gap: .8rem; }
.section-item { display: grid; gap: .7rem; padding: 1rem 4.2rem 1rem 1rem; }
.section-item:hover { transform: none; }
.section-item h3 { font-size: 1.05rem; color: var(--text-bright); margin-bottom: .4rem; }
.section-item.is-hidden { opacity: .6; }
.section-item .drag-handle { top: .8rem; right: .8rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: 0; }
.chip { padding: .15rem .65rem; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--border-strong); color: var(--muted); }
.chip--on { color: var(--accent-3); border-color: rgba(45,212,191,.5); }
.chip--off { color: #ff9a9a; border-color: rgba(255,90,90,.5); }
.section-form { display: grid; gap: 1rem; }
.section-form fieldset { border: 1px solid var(--border); min-width: 0; }
.choice { display: flex; gap: .8rem; align-items: flex-start; padding: .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input { margin-top: .3rem; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.choice small { display: block; color: var(--muted); font-weight: 400; }
.check { display: flex; gap: .6rem; align-items: center; font-size: .95rem; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.text-field input, .text-field select { width: 100%; padding: .75rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: rgba(14,17,28,.85); color: var(--text); font: inherit; font-size: .95rem; }
.text-field input:focus, .text-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.text-field small { font-weight: 400; color: var(--muted); }
.text-section h2 small { font-size: .75rem; font-weight: 400; }
.lang-tabs button { padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--border-strong); font: 700 .85rem var(--font); color: var(--text); background: rgba(16,19,32,.8); cursor: pointer; }
.lang-tabs button.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.current-image { display: flex; gap: 1rem; align-items: center; }
.current-image img { width: 120px; height: 90px; object-fit: cover; border-radius: var(--radius-sm); }
