/* BASE E RESET                                          */
/* ===================================================== */
html,
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #fff;
  color: #530a0a;
  margin: 0;
  padding: 0;
}

/* ===================================================== */
/* LINK STYLES                                           */
/* ===================================================== */
a {
  color: #b00;
  text-decoration: none;
  transition: color 0.15s;
}
a:hover {
  color: #530a0a;
}

a.white {
  color: #fff;
  text-decoration: underline;
}
/* ===================================================== */
/* TIPOGRAFIA                                            */
/* ===================================================== */
h1 {
  margin-top: 0;
}
.title {
  font-weight: 600;
  font-size: 1.25em;
}
.big-title {
  color: #b00;
  font-size: 2em;
}
.msg-large {
  margin: 24px 0;
  font-size: 1.2em;
}
/* ===================================================== */
/* HEADER & CONTAINER                                    */
/* ===================================================== */
header {
  width: 100%;
  min-height: 68px;
  background: #b00;
  color: #fff;
  height: 60px;
}
header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  height: 100%;
  padding-left: 10px;
  padding-right: 10px;
}

header .logo {
  height: 35px;
  width: auto;
  display: block;
}

header .vertical-stack {
  gap: 5px;
}


.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 22px;
  height: 100%;
}
.logo {
  height: 40px;
  width: auto;
  display: block;
}
.userbar {
  display: inline-flex;
  align-items: center;
}
.userpipe {
  margin: 0 10px;
  color: rgba(255,255,255,0.95);
}
.logout {
  margin-left: 0;
}
/* Hamburger menu */
.hamburger-wrap {
  position: relative;
}
.hamburger-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5em;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.15s;
}
.hamburger-btn:hover,
.hamburger-btn.open {
  background: rgba(255,255,255,0.15);
}
.hamburger-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 170px;
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.18);
  z-index: 10000;
  flex-direction: column;
  overflow: hidden;
}
.hamburger-dropdown.open {
  display: flex;
}
.hamburger-user {
  padding: 12px 16px 8px;
  font-size: 0.92em;
  color: #530a0a;
  font-weight: 700;
  border-bottom: 1px solid #f0e0e0;
  white-space: nowrap;
}
.hamburger-item {
  display: block;
  padding: 11px 16px;
  color: #530a0a;
  text-decoration: none;
  font-size: 0.95em;
  font-weight: 600;
  transition: background 0.13s;
}
.hamburger-item:hover {
  background: #f7eded;
}
/* ===================================================== */
/* LAYOUT & COMPONENTI                                   */
/* ===================================================== */
main {
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  border-radius: 5px;
  padding: 10px 20px 10px 20px;
}
.row {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}
.col {
  flex: 1 1 0;
  min-width: 180px;
}
.dashboard-wip-row.responsive {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.dashboard-wip-row .dashboard-block-card {
  min-width: 220px;
  flex: 1 1 220px;
}

/* Troncamento testi lunghi nelle liste WIP: mostra ellissi e evita overflow */
.dashboard-wip-row .wip-link,
.dashboard-wip-row a {
  display: block;
  overflow: hidden;
  max-width: 100%;
  line-height: 1.25;
}
/* WIP: wrappa sempre su tutte le view */
.wip-inline-info {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
}

.wip-asset-name {
  display: inline-block;
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  vertical-align: bottom;
}
/* Riga separatrice WIP */
@media (max-width: 700px) {
  .wip-asset-name {
    display: inline-block;
    max-width: 100%;
    vertical-align: bottom;
  }
}
.dashboard-block-card {
  flex: 1 1 0;
  min-width: 0;
}
/* ===================================================== */
/* CARD & BOX                                            */
/* ===================================================== */
.card {
  background: #f0f2f5;
  border-radius: 6px;
  margin-bottom: 18px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  padding: 10px 10px 5px 10px;
}
.card input,
.card select,
.card textarea {
  width: 100%;
  box-sizing: border-box;
}
.box {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  padding: 24px 20px;
}
/* ===================================================== */
/* UTILITY CLASSES                                       */
/* ===================================================== */
.center-v {
  display: flex;
  align-items: center;
}
.vertical-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.inline {
  display: inline-block;
  align-items: center;
}
.divider {
  width: 100%;
  border: none;
  border-top: 1px solid #ddd;
  margin: 18px 0;
}
.mob-top10px {
  margin-top: 10px;
}

.dropzone-elem #modalUploadMsg {
  margin-top: 10px;
}

/* ===================================================== */
/* NAVIGATORE                                               */
/* ===================================================== */

    .navigatore-bar {
      /* Use 100% instead of 100vw to avoid horizontal overflow when
         vertical scrollbars are present. Remove min-width forcing. */
      width: 100%;
      background: #530a0a;
      margin: 0;
      padding: 0;
      /* border-bottom: 2px solid #b00; */
      box-sizing: border-box;
    }
    .navigatore-main {
      background: none;
      display: flex;
      justify-content: left;
      align-items: left;
      gap: 20px;
      max-width: 900px;
      margin: 0 auto;
    }
    .navigatore-main a {
      background: #530a0a;
      color: #fff;
      border: none;
      border-radius: 5px;
      padding: 8px 18px;
      margin: 0 0px;
      font-weight: 600;
      font-size: 1em;
      text-decoration: none;
      box-shadow: 0 1px 4px rgba(0,0,0,0.08);
      transition: background 0.2s;
      display: inline-block;
    }
    .navigatore-main a:hover {
      background: #b00;
    }
/* ===================================================== */
/* BUTTONS                                               */
/* ===================================================== */

.btn,
.btn-icon,
input[type="submit"],
button[type="submit"],
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #530a0a;
  color: #fff;
  border: none;
  font-weight: 600;
  border-radius: 5px;
  padding: 7px 7px;
  text-decoration: none;
  font-size: 1em;
  cursor: pointer;
  transition: background 0.15s;
  box-sizing: border-box;
  gap: 0.45rem; /* spacing between icon and text when both present */
}

/* Link di navigazione usano ancora display inline-block per evitare cambio grafico */
.btn-nav {
  display: inline-block;
  vertical-align: middle;
}
.btn:hover,
input[type="submit"]:hover,
button[type="submit"]:hover,
a.btn:hover {
  background: #b00;
}
.btn-icon {
  min-width: 40px;
  padding: 7px 7px;
  align-items: center;
  justify-content: center;
}
/* Nota: spazio tra icona e testo gestito da `gap` su `.btn` */
/* Bottoni speciali toolbar */
.sidebar-toolbar .btn-save {
  background: #530a0a;
}
.sidebar-toolbar .btn-save:hover {
  background: #b00;
}
.sidebar-toolbar .btn-approva {
  background: #21863e;
  color: #fff;
}
.sidebar-toolbar .btn-approva:hover {
  background: #196432;
}
.sidebar-toolbar .btn-rifiuta {
  background: #bb0000;
  color: #fff;
}
.sidebar-toolbar .btn-rifiuta:hover {
  background: #900;
}
/* Disabilitati: tolta la gomma per renderla sempre abilitata */
/* Stato disabilitato per tutti i bottoni principali */
.btn:disabled,
.btn-icon:disabled,
.sidebar-toolbar .btn-save:disabled,
.sidebar-toolbar .btn-approva:disabled,
.sidebar-toolbar .btn-rifiuta:disabled,
.btn-approva:disabled,
.btn-rifiuta:disabled,
#tool-note:disabled,
#tool-evidenzia:disabled,
#tool-matita:disabled,
#tool-rect:disabled {
  background: #ccc !important;
  color: #222 !important;
  border-color: #bbb !important;
  cursor: not-allowed !important;
  opacity: 1 !important;
}
/* Generic inactive/disabled visual state used by JS */
/* Evidenziazione pulsante tool attivo */
.sidebar-toolbar button.btn-active {
  background: #fff;
  color: #21863e;
  box-shadow: 0 2px 6px rgba(33,134,62,0.12);
  border: 1px solid #21863e;
}
/* Stati */
.stato-approvato {
  background: #21863e;
  color: #fff;
  font-weight: bold;
  padding: 4px 10px;
  text-align: center;
}
.stato-rifiutato {
  background: #bb0000;
  color: #fff;
  font-weight: bold;
  padding: 4px 10px;
  text-align: center;
}
/* Stato archivio: azzurro stile banda stato */
.stato-archiviato {
  background: #0b78d1;
  color: #fff;
  font-weight: bold;
  padding: 4px 10px;
  text-align: center;
}

/* Pulsante selettore colore nella toolbar */
.sidebar-toolbar button.tool-color-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid #ccc;
  background: #fff;
  cursor: pointer;
  width: 35px;
  height: 35px;
  min-width: 35px;
  min-height: 35px;
  padding: 7px;
  box-sizing: border-box;
}
.sidebar-toolbar .color-swatch {
  width: 25px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,0.12);
  margin: 0;
  vertical-align: middle;
}

/* Swatch grigia se bottone disabilitato */
button.tool-color-btn:disabled .color-swatch {
  background: #ccc !important;
  border-color: #bbb !important;
}

/* ===================================================== */
/* FORM ELEMENTS                                         */
/* ===================================================== */
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: 1em;
  accent-color: #b00;
}
input,
select,
textarea {
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid #b00;
  background: #fff;
  color: #222;
  box-sizing: border-box;
  transition: border 0.13s;
}
input:focus,
select:focus,
textarea:focus {
  border: 1.5px solid #888;
  outline: none;
}
select option {
  font-size: 0.8em;
}

/* ===================================================== */
/* SELECT2 OVERRIDES                                     */
/* Bordo rosso anche al container esterno */
/* Nessun bordo sul container esterno, solo sull'interno */
.select2clienti + .select2-container,
.select2utenti + .select2-container {
  border: none;
  border-radius: 5px;
}
/* ===================================================== */
/* Font-size 0.9em su tutti gli elementi interni Select2 */
/* Centra verticalmente i choice Select2 nel container */
.select2-container--default .select2-selection--multiple {
  border-radius: 5px;
  background: #fff;
  min-height: 36px;
  padding: 0px 2px 6px 5px;
  box-sizing: border-box;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.select2clienti + .select2-container,
.select2utenti + .select2-container {
  width: 100%;
  min-width: 200px;
  max-width: 400px;
  box-sizing: border-box;
  font-size: 0.9em;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove,
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  cursor: pointer;
  font-size: 0.9em;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
  color: #530a0a;
  background: #f8eaea;
  border: 1px solid #b00;
  font-size: 0.9em;
  transition: color 0.15s, background 0.15s;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice:hover {
  color: #b00;
  background: #fff0f0;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
  color: #b00;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
  color: #530a0a;
}
.select2-container--default .select2-selection--multiple .select2-search--inline .select2-search__field {
  border: none;
  outline: none;
  font-size: 1.2em;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: #b00;
  color: #fff;
}
.select2-container--default .select2-results__option[aria-selected=true] {
  background-color: #eee;
  color: #530a0a;
}
.select2-container--default .select2-selection--multiple,
.select2-container--default .select2-selection--multiple:focus,
.select2-container--default .select2-selection--multiple:active,
.select2-container--default .select2-selection--multiple:hover {
  border-color: #b00 !important;
  box-shadow: none !important;
}


/* ===================================================== */
/* TABLES                                                */
/* ===================================================== */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 1em;
  border-radius: 10px;
  overflow: hidden;
}
th,
td {
  padding: 0.32em 0.65em;
  border: 1px solid #eee;
  text-align: left;
  vertical-align: middle;
}
.asset-list th,
.asset-list td {
  padding: 0;
}

td.col-center {
  text-align: center;
  vertical-align: middle;
}
th {
  background: #b00;
  font-weight: 600;
  color: #f5f6fa;
  text-align: center;
}
tr:nth-child(even) td {
  background: #f0f2f5;
}
/* Stato: assicurati che i colori degli stati sovrascrivano lo striping delle righe */
table td.stato-approvato {
  background: #21863e;
  color: #fff;
  font-weight: bold;
  padding: 4px 10px;
  text-align: center;
}
table td.stato-rifiutato {
  background: #bb0000;
  color: #fff;
  font-weight: bold;
  padding: 4px 10px;
  text-align: center;
}
/* ===================================================== */
/* MESSAGING                                             */
/* ===================================================== */
.msg-error,
.error {
  color: #bb0000;
}
.msg-success {
  color: #21863e;
}
.empty-msg {
  color: #222;
}
/* ===================================================== */
/* ASSET/ANTEPRIME/MODAL                                 */
/* ===================================================== */
.asset-thumb {
  max-width: 60px;
  max-height: 60px;
  display: block;
  margin: 0 auto 4px auto;
}
.asset-thumb-filename {
  display: block;
  font-size: 0.85em;
  color: #530a0a;
  text-align: center;
  word-break: break-all;
  margin-top: 2px;
}

/* Numero asset leggermente più grande sui pulsanti/azioni delle collezioni */
.asset-count {
  font-size: 110%;
}
.asset-actions-row {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

/* =============== MODAL GENERICA (conferma, popup) =============== */
.modal-overlay {
  display: none;
  position: fixed;
  z-index: 3000;
  inset: 0;
  background: rgba(0,0,0,0.45);
  justify-content: center;
  align-items: center;
}
.modal-overlay.active {
  display: flex;
}

/* modal-confirm: usata nei template DAM e generata dal JS */
.modal-confirm {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  align-items: center;
  justify-content: center;
  z-index: 200000;
}
.modal-confirm.active {
  display: flex;
}
.modal-confirm-inner {
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  max-width: 520px;
  width: calc(100% - 24px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}
.modal-confirm-msg {
  margin-bottom: 16px;
  color: #222;
  line-height: 1.4;
}
/* Bottoni conferma uniformi su tutto il sito */
.btn-cancel { background: #b00 !important; color: #fff !important; border: none; }
.btn-cancel:hover { background: #900 !important; }
.btn-ok     { background: #188e18 !important; color: #fff !important; border: none; }
.btn-ok:hover { background: #126d12 !important; }
.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 1.5px 8px rgba(0,0,0,0.10);
  padding: 28px 28px 18px 28px;
  min-width: 320px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
}
.modal__title {
  font-size: 1.25em;
  font-weight: 700;
  color: #b00;
  margin-bottom: 12px;
  text-align: center;
}
.modal__body {
  font-size: 1.08em;
  color: #530a0a;
  margin-bottom: 18px;
  text-align: center;
  white-space: pre-line;
}
.modal__actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
  flex-wrap: wrap;
}

/* =============== POPUP/OVERLAY =============== */
/* =============== DAM PREVIEW OVERLAY =============== */
.img-modal-overlay {
  display: none;
  position: fixed;
  z-index: 2000;
  inset: 0;
  background: rgba(0,0,0,0.75);
  overscroll-behavior: contain;
  touch-action: none;
}
.img-modal-overlay.active {
  display: flex;
}
.img-modal-content {
  width: 100%; height: 100%;
  display: flex;
  padding: 0; margin: 0;
  box-sizing: border-box;
}

/* Orientamento: regole solo per overlay generici non-DAM */
@media (orientation: portrait) {
  .img-modal-content:not(#damPreviewBody *) .img-modal-media { height: 100%; width: auto; max-width: 100%; max-height: 100%; }
}
@media (orientation: landscape) {
  .img-modal-content:not(#damPreviewBody *) .img-modal-media { width: 100%; height: auto; max-width: 100%; max-height: 100%; }
}

#img-modal-img {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}


.preview-popup {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  display: none;
  z-index: 9999;
}
.preview-popup img {
  max-width: 90vw;
  max-height: 90vh;
  display: block;
  margin: 0 auto;
  border-radius: 6px;
}
.modal-upload-elem {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,29,29,0.67);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}
.modal-upload-elem.active {
  display: block;
}
.upload-inner-elem {
  background: #fff;
  max-width: 440px;
  margin: 80px auto 0 auto;
  border-radius: 9px;
  padding: 28px 25px 40px 25px;
  position: relative;
  box-shadow: 0 2px 48px #222;
}
.modal-close-elem {
  position: absolute;
  top: 14px;
  right: 18px;
  font-size: 2.1em;
  color: #900;
  font-weight: bold;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.dropzone-elem {
  border: 2px dashed #b00;
  background: #ffecec;
  border-radius: 7px;
  padding: 34px 20px;
  box-sizing: border-box;
  text-align: center;
  color: #b00;
  margin-bottom: 18px;
  cursor: pointer;
  transition: background 0.14s;
}

.dropzone-elem #modalUploadMsg { padding: 0 8px; display:block; box-sizing:border-box; word-break:break-word; }
.dropzone-choose-elem {
  color: #b00;
  text-decoration: underline;
  font-weight: 600;
  cursor: pointer;
}
.modal-upload-elem input[type="file"] {
  display: none;
}
.modal-upload-elem .btn {
  margin-top: 18px;
  font-size: 1.18em;
  padding: 13px 32px;
  border-radius: 7px;
  font-weight: 700;
  background: #b00;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}
.modal-upload-elem .msg-error,
.modal-upload-elem .msg-success {
  display: block;
  margin: 10px auto 0 auto;
  text-align: center;
  font-size: 1em;
  max-width: 90%;
}
.upload-invalid-names {
  color: #bb0000;
  font-size: 0.92em;
  margin: 6px 0 0 0;
  padding: 0;
  list-style: disc;
  padding-left: 1.4em;
  text-align: left;
}
.upload-invalid-label {
  color: #bb0000;
  font-weight: 600;
  font-size: 0.95em;
}
.upload-valid-label {
  color: #222;
  font-size: 0.92em;
}
.modal-upload-elem .asset-uploaded-name {
  display: block;
  margin: 10px auto 0 auto;
  text-align: center;
  font-size: 1em;
  color: #21863e;
  font-weight: 600;
  word-break: break-all;
}

/* ===================================================== */
/* ANNOTATORE PDF & TOOLBAR                              */
/* ===================================================== */
.layout-annotator {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #fff;
  border-radius: 10px;
}

.toolbar-center-wrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.sidebar-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 3px;
  flex-wrap: wrap;
  width: auto;
  box-sizing: border-box;
  margin-bottom: 5px;
}

.sidebar-toolbar button {
  display: inline-flex;
  min-width: 35px;
  min-height: 35px;
  box-sizing: border-box;
  font-size: 1.2em;
  cursor: pointer;
}
.tools-pagination {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  background: #fff;
  border: 1.5px solid #b00;
  overflow: hidden;
  height: 35px;
  min-height: 35px;
  box-sizing: border-box;
  
}
.sidebar-toolbar .tool-page-btn {
  min-width: 35px;
  min-height: 35px;
  background: transparent;
  border: none;
  color: #b00;
  font-size: 1.2em;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 7px;
  border-radius: 0;
  font-weight: 600;
  transition: background 0.15s;
}
#prevPageBtn {
  margin-left: 0;
}
#nextPageBtn {
  margin-right: 0;
}
.tools-page-sep {
  color: #b00;
  font-weight: 700;
  margin: 0 4px;
  background: transparent;
  border: none;
}
#pageNumDisplay,
#pageCountDisplay {
  font-size: 1.07em;
  font-weight: bold;
  color: #b00;
  background: transparent;
  border: none;
  padding: 0 2px;
}
#pageNumDisplay,
#pageCountDisplay,
.sidebar-toolbar .tool-page-btn,
.tools-page-sep {
  color: #b00;
}
.sidebar-toolbar .tool-page-btn:hover {
  color: #fff;
}
.main-content-annotator {
  display: flex;
  height: calc(100vh - 140px); /* header + toolbar */
  position: relative;
}

 .pdf-canvas-host {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: #ddd;
  padding: 10px 0; /* keep vertical padding, remove horizontal spacing so viewer centers */
}

.pdf-canvas-area {
  position: relative;
  display: block;
  margin: 0 auto; /* ensure the canvas area is centered inside the host */
}

#pdf-canvas,
#annot-canvas {
  position: absolute;
  top: 0;
  left: 0;
}


/* === Pannello Annotazioni — Tab laterale a scomparsa === */
.notes-panel {
  position: fixed;
  top: 105px;
  right: 0;
  width: 340px;
  height: calc(100vh - 105px);
  box-sizing: border-box;
  display: flex;
  flex-direction: row;
  z-index: 11000;
  pointer-events: none; /* lascia passare click al canvas quando chiuso */
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  transform: translateX(0);
}
.notes-panel.collapsed {
  transform: translateX(340px); /* nasconde il corpo, ma il tab sporge */
}

/* Quando il pannello annotazioni è aperto, renderlo interattivo e in primo piano */
.notes-panel:not(.collapsed) {
  pointer-events: auto; /* permette interazione con il pannello */
  z-index: 2147483647; /* metti in primo piano rispetto a qualsiasi altro elemento */
}

/* Il tab-handle sporge sempre a sinistra del pannello */
.notes-tab-handle {
  pointer-events: auto;
  position: absolute;
  left: -38px;
  top: 0;
  width: 38px;
  writing-mode: vertical-lr;
  text-orientation: mixed;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: #530a0a;
  color: #fff;
  border: none;
  border-radius: 8px 0 0 8px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 600;
  letter-spacing: 0.5px;
  box-shadow: -2px 2px 8px rgba(0,0,0,0.15);
  transition: background 0.2s, box-shadow 0.2s;
  z-index: 11001;
}
.notes-tab-handle:hover {
  background: #b00;
  box-shadow: -3px 3px 12px rgba(0,0,0,0.22);
}
.notes-tab-handle i {
  font-size: 1.1em;
  margin-bottom: 2px;
}
.notes-tab-badge {
  background: #fff;
  color: #b00;
  font-size: 0.85em;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  writing-mode: horizontal-tb;
  line-height: 1.3;
}

/* Corpo interno del pannello */
.notes-panel-inner {
  pointer-events: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,0.97);
  border-left: 2px solid #b00;
  padding: 14px 12px;
  overflow: auto;
  box-shadow: -4px 0 16px rgba(0,0,0,0.08);
}

/* Mobile portrait: bottom sheet */
@media (max-width: 700px) and (orientation: portrait) {
  .notes-panel {
    top: auto; right: auto; left: 0; bottom: 0;
    width: 100%; height: 40vh;
    flex-direction: column;
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -6px 30px rgba(0,0,0,0.13);
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  }
  .notes-panel.collapsed {
    transform: translateY(calc(100% - 42px)); /* mostra solo il tab */
  }
    .notes-tab-handle {
    position: static;
    left: auto; top: auto;
    writing-mode: horizontal-tb;
    text-orientation: initial;
    width: 100%;
    border-radius: 14px 14px 0 0;
    padding: 10px 16px;
    justify-content: center;
    gap: 8px;
    font-size: 1em;
  }
  .notes-panel-inner {
    border-left: none;
    border-top: 1px solid #eee;
  }
  .notes-title { font-size: 0.95em; margin-bottom: 8px; }
}

/* Piccola etichetta data usata nella colonna azioni */
.note-date-small {
  font-size: 0.8em;
  color: #888;
  margin-bottom: 6px;
}

.notes-title {
  font-weight: bold;
  color: #b00;
  margin-bottom: 12px;
}
#notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
  max-height: 92vh;
}
#notes-list li {
  padding-top: 2px;
  padding-bottom: 2px;
  margin-bottom: 8px;
}

/* Note item layout */
.note-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 6px 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.note-divider {
  height: 1px;
  background: #b00;
  margin: 0 0 8px 0;
}
.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.88em;
}
.note-author {
  color: #21863e;
  font-weight: 700;
  font-size: 0.95em;
}
.note-date {
  color: #666;
  font-size: 0.78em;
}
.note-container {
  display: flex;
  align-items: flex-start;
}
.note-body {
  flex: 1;
  font-size: 0.95em;
}
.note-text {
  white-space: normal;
  overflow-wrap: break-word;
}
.note-msg-edit {
  width: 100%;
  min-height: 48px;
  padding: 6px;
  box-sizing: border-box;
  resize: vertical;
}
.note-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 8px;
}
.note-actions .btn {
  border: none;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-actions .note-save {
  background: #21863e;
  color: #fff;
}
.note-actions .note-del {
  background: #b00;
  color: #fff;
}
.note-actions .note-jump {
  background: #eee;
  color: #333;
}

/* Close button (legacy, rimosso dal template) */

/* Evita stili inutili su input colore nascosto per tool-color-btn */
input[type='color'].tool-color-btn {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  width: 0 !important;
  height: 0 !important;
  min-width: 0 !important;
  min-height: 0 !important;
  outline: none !important;
}

/* ===================================================== */
/* VIDEO ANNOTATORE                                      */
/* ===================================================== */

.player-area .video-player-center {
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Wrapper principale */
#video-row {
  display: flex;
  justify-content: center;
  position: relative;
}

@media (max-width: 600px) {
  #video-row {
    justify-content: flex-start;
  }
}

/* Contenitore video + canvas */
#video-overlay-container {
  position: relative;
  width: 100%;
  max-width: 1080px;
}

/* VideoJS */
#video-overlay-container .video-js {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  display: block;
}

/* Canvas sopra il video */
#video-annot-canvas {
  background: transparent;
  position: absolute;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
}

#video-annot-canvas.active {
  opacity: 1;
}

#video-overlay-container.drawing-active {
  box-sizing: border-box;
}

/* Nasconde il pulsante play centrale di Video.js */
#video-overlay-container .vjs-big-play-button,
.video-js .vjs-big-play-button {
  display: none !important;
}
/* ===================================================== */
/* MEDIA                                 */
/* ===================================================== */

/* Wrapper scroll orizzontale per tabelle larghe */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
/* Tabella permessi: testatine stabili */
.perm-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 600px;
}
.perm-table th {
  white-space: nowrap;
  vertical-align: middle;
}
.perm-table td {
  vertical-align: middle;
}

.desktop-view th { display: table-cell; }

@media (max-width: 600px) {
  #pdf-filename {
    font-size: 0.75em !important;
    font-weight: bold !important;
  }
}
.desktop-view div { display: flex; }
.mobile-view  { display: none; }
@media (max-width: 600px) {
  .desktop-view { display: none; }
  .mobile-view  { display: flex; flex-direction: column; width: 100%; }
}
/* Breakpoint dedicato tabella utenti */
@media (max-width: 800px) {
  .user-table-view.desktop-view { display: none; }
  .user-table-view.mobile-view { display: flex; flex-direction: column; width: 100%; }
  .dashboard-sidebar { display: block; width: 100%; margin-bottom: 12px; }
  .dashboard-wip-row.responsive { display: block; }
  .dashboard-wip-row .wip-link,
  .dashboard-wip-row .empty-msg { font-size: 0.85em; }
  .dashboard-block-title { font-size: 0.8em; }
  .dashboard-block-card { width: 100%; min-width: 0; margin-bottom: 16px; }
  #asset-video {
    width: 95vw;
    max-width: 600px;
    height: auto;
    margin: 0 auto;
    display: block;
  }
  .container {
    padding: 0 2px;
  }
  .navigatore-bar {
    padding: 0 0 0 8px;
}
 
  .video-page-container #asset-video {
    width: 95vw;
    max-width: 320px;
    height: auto;
    aspect-ratio: 16/9;
    max-height: 60vh;
    min-width: 0;
    margin: 0 auto;
    display: block;
  }
}

/* ===================================================== */
/* Make video toolbar buttons match PDF viewer mobile sizing */
@media (max-width: 700px) {
.video-toolbar-sticky .sidebar-toolbar button,
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: 1em;
  accent-color: #b00;
}
input,
select,
textarea {
  padding: 6px 10px;
  border-radius: 5px;
  border: 1px solid #b00;
  background: #fff;
  color: #222;
  box-sizing: border-box;
  transition: border 0.13s;
}
input:focus,
select:focus,
textarea:focus {
  border: 1.5px solid #888;
  outline: none;
}
}
  


@media (max-width: 700px) {
  .sidebar-toolbar {
    gap: 2px;
  }
  .sidebar-toolbar button,
  .sidebar-toolbar .btn-icon,
  .sidebar-toolbar .tool-page-btn {
    min-width: 28px;
    min-height: 28px;
    font-size: 1em;
    padding: 4px 4px;
  }
  .sidebar-toolbar button.tool-color-btn {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 4px !important;
    font-size: 1em !important;
  }
  .video-toolbar-sticky .color-swatch,
  .video-toolbar-sticky .tool-color-btn .color-swatch {
    width: 14px;
    height: 14px;
  }
  .sidebar-toolbar .color-swatch {
    width: 16px;
    height: 16px;
  }
  
  .tools-pagination {
    height: 28px;
    min-height: 28px;
  }
  #pageNumDisplay,
  #pageCountDisplay {
    font-size: 0.95em;
    padding: 0 1px;
  }
  .tools-page-sep {
    font-size: 0.9em;
    margin: 0 2px;
  }

  
  .mob-tab-progetti tr th:nth-child(1),
  .mob-tab-progetti tr th:nth-child(4),
  .mob-tab-progetti tr th:nth-child(5),
  .mob-tab-progetti tr td:nth-child(1),
  .mob-tab-progetti tr td:nth-child(4),
  .mob-tab-progetti tr td:nth-child(5) {
    display: none;
  }

    .clienti-table th:nth-child(2),
    .clienti-table th:nth-child(3),
    .clienti-table td:nth-child(2),
    .clienti-table td:nth-child(3) {
      display: none;
    }
    /* Mostra la tabella anche se nel markup ha `desktop-view` */
    .clienti-table.mobile-view,
    table.clienti-table.desktop-view {
      display: table;
    }

  /* Centra e compatta le colonne numeriche nella vista desktop */
  .clienti-table th:nth-child(2),
  .clienti-table th:nth-child(3),
  .clienti-table td:nth-child(2),
  .clienti-table td:nth-child(3) {
    text-align: center;
    vertical-align: middle;
    padding-left: 0.2em;
    padding-right: 0.2em;
  }

/* info per rotazioen mobile */

#rotateNotice {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#rotateNotice.visible {
  display: flex;
}
header .big-title, header h1, header .title {
  font-size: 1.15em;
  line-height: 1.2;
  margin: 0;
  text-align: right;
}
header {
  height: 44px;
  min-height: 44px;
}
header .logo {
  height: 24px;
}
header .vertical-stack {
  gap: 2px;
}
}
/* Icona fallback  */
.dyn-fileicon{
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: #fff;
  border: 2px solid #bb0000;
  box-sizing: border-box;
  position: relative;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

.dyn-fileicon::after{
  content: attr(data-ext);
  color: #bb0000;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: translateY(0.5px);
  text-transform: uppercase;
}

/* Large variant for DAM collection previews */
.dyn-fileicon--large {
  width: 88px;
  height: 88px;
  border-radius: 12px;
}

.dyn-fileicon--large::after{
  font-size: 20px;
}

/* ===================================================== */
/* DAM — Accesso, Griglia, Asset, Preview                */
/* (unificato da stili_dam.css)                          */
/* ===================================================== */

.dam-accesso-main {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  --dam-accesso-pt: clamp(56px, 8vw, var(--site-header-height, 120px));
  --dam-accesso-pb: clamp(20px, 3.5vw, 48px);
  padding-top: var(--dam-accesso-pt);
  padding-bottom: calc(var(--dam-accesso-pb) + 200px);
  min-height: calc(100vh - var(--site-header-height, 120px) - var(--dam-accesso-pb));
  box-sizing: border-box;
  z-index: 0;
}
.dam-accesso-main > div { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }
.dam-accesso-icon { font-size: clamp(1.2rem, 4.5vw, 2.4rem); opacity: 0.9; display: block; }
.dam-accesso-badge { font-size: 0.8em; font-weight: 400; opacity: 0.75; margin-top: 2px; }

a.dam-accesso-btn {
  width: clamp(120px, 18vw, 180px); display: flex; padding: 16px; gap: 8px; aspect-ratio: 1 / 1;
  font-weight: 700; font-size: 1.3em; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; border-radius: 16px; background: #530a0a; color: #fff; border: 2px solid transparent;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15); transition: transform .2s, box-shadow .2s, border-color .2s;
  text-decoration: none; outline: none;
}
a.dam-accesso-btn:hover, a.dam-accesso-btn:focus { transform: translateY(-10px); box-shadow: 0 8px 24px rgba(0,0,0,.25); border-color: #fff4; background: #b00; }
a.dam-accesso-btn:focus-visible { outline: 3px solid rgba(255,255,255,0.18); outline-offset: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.20); }

/* MIBox: barra filtri attivi */
.mibox-filter-bar{margin-top:10px;background:#f5f7fa;padding:8px;border-radius:4px;border:1px solid #e1e6eb;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.mibox-filter-badge{background:#ffffff;border:1px solid #d0d7de;color:#333;padding:4px 8px;border-radius:16px;font-size:0.9em}
.mibox-filter-clear{margin-left:auto;color:#007bff;text-decoration:none;font-size:0.9em}
.mibox-filter-clear:hover{text-decoration:underline}

/* Griglia collezioni e asset */
.dam-grid { padding-left: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 10px; justify-content: flex-start; margin-top: 20px; }
.dam-grid-item { display: flex; flex-direction: column; min-width: 0; box-sizing: border-box; justify-content: space-between; background: #fff; border: 1px solid #b00; border-radius: 8px; padding: 10px; }
.dam-grid-assets { padding-left: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; justify-content: flex-start; margin-top: 20px; }
@media (max-width: 1200px) { .dam-grid-assets { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .dam-grid-assets { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px)  { .dam-grid-assets { grid-template-columns: 1fr; } }
.dam-grid-assets-item { display: flex; flex-direction: column; min-width: 0; box-sizing: border-box; justify-content: space-between; background: #fff; border: 1px solid #b00; border-radius: 8px; padding: 10px; }
.dam-thumb { max-width: 200px; max-height: 200px; }
.dam-thumb-filename { display: block; font-size: 0.85em; color: #530a0a; text-align: center; word-break: break-all; margin-top: 2px; }

/* Upload progress */
.upload-progress-wrap { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.upload-progress { flex: 1 1 auto; height: 10px; background: #eee; border-radius: 6px; overflow: hidden; }
.upload-progress-bar { height: 100%; background: linear-gradient(90deg,#b00,#ff6b6b); width: 0%; transition: width .15s linear; }
.upload-progress-text { min-width: 44px; text-align: right; font-size: 0.9em; color: #333; }
#modalUploadMsg, .dropzone-elem #modalUploadMsg { margin-top: 8px; color: #b00; }
.upload-error { color: #b00; margin-top: 8px; }
.upload-success { color: #21863e; margin-top: 8px; }

.modal-upload-elem .upload-inner-elem { max-width: 720px; box-sizing: border-box; margin: 120px auto 0; }

/* ===== DAM PREVIEW: wrapper, media, PDF ===== */
/* Body iniettato da JS: riempie il content flex */
#damPreviewBody {
  width: 100%; height: 100%;
  display: flex;
}

/* Wrapper comune: si estende, poi centra il media al suo interno */
.img-modal-media-wrapper {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  box-sizing: border-box;
}

/* Immagini e video: padding uniforme attorno, media centrato e contenuto */
.img-modal-media-wrapper:not(.pdf-preview) {
  padding: 40px;
}
@media (max-width: 768px) {
  .img-modal-media-wrapper:not(.pdf-preview) { padding: 10px; }
}
/* Immagini e video nel wrapper DAM: centrati e contenuti, padding uniforme */
#damPreviewBody .img-modal-media-wrapper:not(.pdf-preview) img,
#damPreviewBody .img-modal-media-wrapper:not(.pdf-preview) video {
  max-width: 100%; max-height: 100%;
  width: auto; height: auto;
  object-fit: contain; display: block;
}

/* PDF: iframe riempie tutto il wrapper senza padding */
.img-modal-media-wrapper.pdf-preview {
  padding: 0;
  align-items: stretch; justify-content: stretch;
}
.img-modal-media-wrapper.pdf-preview iframe {
  width: 100%; height: 100%; border: none; display: block; background: #fff;
}

/* Pulsante chiudi preview DAM */
#damPreviewClose { position: fixed; top: 5px; right: 5px; z-index: 20000; background: #b00; color: #fff; border: none; font-size: 22px; line-height: 1; padding: 6px 8px; border-radius: 6px; cursor: pointer; display: none; }
#damPreviewClose:focus { outline: 2px solid #fff; }
#damPreviewOverlay { z-index: 19999; }

/* Download selezionati attivo */
.btn-active-selection { background: #21863e !important; color: #fff !important; border-color: #196432 !important; }
#damPreviewOverlay.active + #damPreviewClose,
#damPreviewOverlay.active ~ #damPreviewClose,
.img-modal-overlay.active + #damPreviewClose,
.img-modal-overlay.active ~ #damPreviewClose { display: block !important; }

/* Posizionamento pulsanti chiusura modale */
.img-modal-close, .modal-close-elem, #damPreviewClose, .img-modal-content .img-modal-close { top: 5px !important; right: 5px !important; }

/* Dialogo duplicati DAM */
.duplicate-dialog { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); background: #fff; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,0.35); z-index: 50000; padding: 14px; max-width: 520px; width: calc(100% - 40px); }
.duplicate-dialog-inner { display: block; }
.duplicate-dialog-title { font-weight: 600; margin-bottom: 8px; }
.duplicate-list { max-height: 200px; overflow: auto; border: 1px dashed #ddd; padding: 8px; margin-bottom: 10px; }
.duplicate-actions { text-align: right; display: flex; gap: 8px; justify-content: flex-end; }
.duplicate-dialog label { display: block; font-size: 0.95em; margin-bottom: 6px; }

/* Intestazioni nelle pagine DAM */
main h2 { font-weight: normal; font-size: 1.2em; }

/* DAM responsive */
@media (max-width: 700px) {
  .dam-grid { grid-template-columns: 1fr; box-sizing: border-box; width: 100%; }
  .dam-grid-item { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
  .dam-accesso-main { padding: 12px; align-items: flex-start; height: auto; padding-top: 20px; }
  .dam-accesso-main > div { gap: 12px; }
  a.dam-accesso-btn { width: clamp(96px, 30vw, 152px); aspect-ratio: 1/1; padding: clamp(8px, 3vw, 13px); gap: 7px; font-size: clamp(0.95rem, 3.4vw, 1.05rem); border-radius: 13px; box-shadow: 0 4px 13px rgba(0,0,0,0.12); }
  a.dam-accesso-btn:hover, a.dam-accesso-btn:focus { transform: translateY(-6px); box-shadow: 0 10px 31px rgba(0,0,0,0.18); }
  a.dam-accesso-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.18); outline-offset: 3px; }
  .dam-accesso-icon { font-size: clamp(1rem, 5.5vw, 1.6rem); opacity: 0.98; }
  .dam-accesso-badge { font-size: 0.8em; padding: 4px 6px; border-radius: 7px; color: #fff; border: 1px solid rgba(255,255,255,0.03); }
}

/* Dashboard: bordi e helper (usati anche nelle pagine DAM) */
.dashboard-card.admin table { border-collapse: separate; border-spacing: 0; }
tr.dashboard-dam td { border-top: 1.5px solid #888 !important; }
.dashboard-sidebar table, .dashboard-wip-row table, .dashboard-card table { border-collapse: separate; border-spacing: 0; }
.dashboard-sidebar { margin-top: 10px; }
.dashboard-card.flex-grow { flex: 1 1 0; min-width: 0; }
.dashboard-fullwidth-table { width: 100%; }
.wip-3col-min { min-width: 180px; }
.wip-header { background-color: #530a0a; text-align: left; }
.table-th-left { text-align: left; }
.dashboard-row { display: flex; gap: 16px; align-items: stretch; }
.va-top { vertical-align: top; }
.col-divider { border-left: 2px solid #fff; }
.wip-link-block { display: block; max-width: 100%; overflow: hidden; }
.wip-col {
  color: #fff;
  text-align: center;
  font-weight: 700;
  font-size: 0.88em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 6px 6px;
  vertical-align: middle;
}
.wip-col i { display: inline; font-size: 1em; margin-right: 4px; opacity: 0.9; }
.wip-col-new      { background: linear-gradient(#666,#666) left/5px 100% no-repeat, linear-gradient(white,white) 5px 0/7px 100% no-repeat, linear-gradient(160deg,#666 0%,#444 100%); border-left: none; width: 34%; max-width: 34%; }
.wip-col-rejected { background: linear-gradient(#bb0000,#bb0000) left/5px 100% no-repeat, linear-gradient(white,white) 5px 0/7px 100% no-repeat, linear-gradient(160deg,#bb0000 0%,#900 100%); border-left: none; width: 33%; max-width: 33%; }
.wip-col-approved { background: linear-gradient(#21863e,#21863e) left/5px 100% no-repeat, linear-gradient(white,white) 5px 0/7px 100% no-repeat, linear-gradient(160deg,#21863e 0%,#196432 100%); border-left: none; width: 33%; max-width: 33%; }
.mobile-wip-header {
  text-align: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.88em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 8px;
}
.mobile-wip-header i { margin-right: 5px; }
.mobile-wip-new      { background: linear-gradient(#666,#666) left/5px 100% no-repeat, linear-gradient(white,white) 5px 0/7px 100% no-repeat, linear-gradient(90deg,#666 0%,#444 100%); border-left: none; }
.mobile-wip-rejected { background: linear-gradient(#bb0000,#bb0000) left/5px 100% no-repeat, linear-gradient(white,white) 5px 0/7px 100% no-repeat, linear-gradient(90deg,#bb0000 0%,#900 100%); border-left: none; }
.mobile-wip-approved { background: linear-gradient(#21863e,#21863e) left/5px 100% no-repeat, linear-gradient(white,white) 5px 0/7px 100% no-repeat, linear-gradient(90deg,#21863e 0%,#196432 100%); border-left: none; }
.row-border-bottom td { border-bottom: 1.5px solid #888; }
.row-border-top td { border-top: 1.5px solid #888; }
.row-border-top-td { border-top: 1.5px solid #888; }

/* Timbro stato viewer (APPROVATO / RIFIUTATO) */
.stato-timbro {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-12deg);
  z-index: 99998;
  pointer-events: auto;
  user-select: none;
  display: inline-block;
  cursor: pointer;
}
.stato-timbro__text {
  display: block;
  font-size: 1.8em;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-top: 4px double currentColor;
  border-bottom: 4px double currentColor;
  line-height: 1.35;
  opacity: 0.85;
  font-family: 'Arial Narrow', Arial, sans-serif;
  white-space: nowrap;
}
.stato-timbro--approvato { color: #21863e; }
.stato-timbro--rifiutato { color: #bb0000; }

/* Banda stato (visibile dopo click sul timbro) */
.stato-banda {
  display: none;
  width: 100%;
  padding: 5px 20px;
  align-items: center;
  justify-content: center;
  font-size: 0.88em;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #fff;
  box-sizing: border-box;
  flex-shrink: 0;
}
.stato-banda--approvato { background: #21863e; }
.stato-banda--rifiutato { background: #bb0000; }
/* Archivio banda azzurra */
.stato-banda--archiviato { background: #0b78d1; display: flex; }

/* Toast notifications (showToast) */
.toast-notif {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translateX(-50%) translateY(-50%) scale(0.92);
  padding: 18px 36px;
  border-radius: 8px;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.28);
  z-index: 99999;
  opacity: 0;
  transition: opacity .25s ease, transform .25s ease;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  white-space: normal;
  text-align: center;
  box-sizing: border-box;
}
.toast-notif--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(-50%) scale(1);
}
.toast-notif--success  { background: #21863e; }
.toast-notif--error    { background: #b00; pointer-events: auto; cursor: pointer; padding-right: 48px; }
.toast-notif__close    { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); font-size: 1.4rem; line-height: 1; opacity: 0.8; }
.toast-notif__close:hover { opacity: 1; }
.toast-notif--warning  { background: #b87b00; }
.toast-notif--info     { background: #1565c0; }

/* ===== Bottoni generici mancanti ===== */
.btn-sm {
  font-size: 0.82em;
  padding: 4px 8px;
}
.btn-danger {
  background: #bb0000;
}
.btn-danger:hover {
  background: #900;
}
.btn-primary {
  background: #21863e;
}
.btn-primary:hover {
  background: #196432;
}

/* ===== MIBox ===== */
.mibox-wrap {
  width: 100%;
  max-width: 1200px;
}

/* Dashboard warning icon for MIBox */
.dashboard-warning-icon {
  margin-left: 8px;
  position: relative;
  color: #b00;
  cursor: help;
  font-size: 0.95em;
}
.dashboard-tool-label { 
  white-space: nowrap; 
  display: inline-block; 
  vertical-align: middle; 
  overflow: hidden; 
  text-overflow: ellipsis; 
  max-width: calc(100% - 28px);
}
.dashboard-warning-icon { display: inline-block; vertical-align: middle; margin-left:6px; }
.dashboard-warning-icon::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 10px);
  white-space: pre-line;
  background: #fff;
  color: #b00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.3;
  display: none;
  z-index: 1200;
  min-width: 160px;
  text-align: left;
  border: 1px solid rgba(176,0,0,0.12);
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.dashboard-warning-icon:hover::after,
.dashboard-warning-icon:focus::after {
  display: block;
}

/* Show tooltip when toggled via JS (click/tap) */
.dashboard-warning-icon.dashboard-tooltip-visible::after { display: block; }

/* Barra utilizzo */
.mibox-usage {
  margin-bottom: 18px;
}
.mibox-usage-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
  font-size: 0.92em;
  gap: 8px;
}
.mibox-usage-label span {
  color: #555;
  white-space: nowrap;
}
.mibox-usage-bg {
  background: #e0e0e0;
  border-radius: 6px;
  height: 12px;
  overflow: hidden;
}
.mibox-usage-fill {
  height: 100%;
  background: #21863e;
  border-radius: 6px;
  transition: width .3s;
}
.mibox-usage-fill.mibox-usage-orange { background: #e07b00; }
.mibox-usage-fill.mibox-usage-red    { background: #b00; }

/* Titolo sezione file */
.mibox-files-title {
  /* Match spacing of .stato-banda (no external top margin, same internal padding) */
  margin: 0;
  padding: 5px 20px;
  font-size: 1.1em;
  font-weight: 600;
}

/* Lista file */
.mibox-empty {
  color: #888;
  font-style: italic;
}

.mibox-file-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mibox-file-item {
  display: flex;
  align-items: flex-start; /* align top edges so name and actions start at same height */
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.mibox-file-main {
  flex: 1;
  min-width: 0;
}

.mibox-file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: #530a0a;
  text-decoration: none;
}
.mibox-file-name { margin: 0; }
.mibox-file-name:hover {
  text-decoration: underline;
}

.mibox-file-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
  font-size: 0.82em;
  color: #888;
}
.mibox-meta-sep {
  color: #ccc;
}
.mibox-shared-badge {
  color: #21863e;
  font-size: 0.85em;
}

.mibox-file-actions {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  flex-shrink: 0;
}

.mibox-file-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 0.92em;
  min-height: 34px;
  box-sizing: border-box;
}

/* ===== MIBox — modale condivisione ===== */
#shareCloseTop {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.6em;
  line-height: 1;
  z-index: 1;
}
#shareCopy {
  flex-shrink: 0;
  padding: 5px 9px;
  font-size: 0.82em;
}
.mibox-share-title {
  font-weight: bold;
  font-size: 1.05em;
  margin-bottom: 10px;
}
.mibox-share-filename {
  font-size: 0.95em;
  color: #530a0a;
  font-weight: 600;
  margin-bottom: 14px;
  word-break: break-word;
}
.mibox-share-loading {
  text-align: center;
  padding: 18px 0;
  color: #666;
}
.mibox-share-label {
  display: block;
  font-size: 0.88em;
  font-weight: 600;
  margin-bottom: 5px;
  color: #444;
}
.mibox-share-link-row {
  --mibox-share-control-height: 40px; /* desktop default */
  display: flex;
  gap: 8px;
  align-items: flex-start; /* align top edges */
}
.mibox-share-url-input {
  flex: 1;
  min-width: 0;
  height: var(--mibox-share-control-height);
  padding: 0 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.88em;
  background: #f7f7f7;
  color: #333;
  box-sizing: border-box;
  display: block;
  margin: 0;
  line-height: normal;
}
#shareCopy {
  flex-shrink: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  height: var(--mibox-share-control-height);
  padding: 0 12px;
  font-size: 0.88em;
  white-space: nowrap;
  box-sizing: border-box;
  margin: 0;
  line-height: normal;
}
/* make copy button green */
#shareCopy {
  background: #21863e;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.06);
}
#shareCopy:hover {
  background: #196432;
}
.mibox-share-expiry {
  display: block;
  font-size: 0.82em;
  color: #888;
  margin-top: 4px;
}
.mibox-share-email-input {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9em;
  box-sizing: border-box;
}
.mibox-share-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
  flex-wrap: wrap;
}
.mibox-share-error {
  background: #fff0f0;
  border: 1px solid #f5c6c6;
  border-radius: 4px;
  padding: 10px 12px;
  color: #b00;
  font-size: 0.9em;
  margin-top: 10px;
}
@media (max-width: 600px) {
  .mibox-share-link-row { 
    flex-direction: column; 
    --mibox-share-control-height: auto; /* let controls size naturally on mobile */
  }
  .mibox-share-url-input { width: 100%; height: auto; }
  #shareCopy { width: 100%; height: auto; padding: 8px 12px; }
  .mibox-share-actions { flex-direction: column; }
  .mibox-share-actions .btn { width: 100%; justify-content: center; }
  .mibox-share-sep { display: none; }
  .mibox-share-sub { display: block; margin-top: 8px; }
}
@media (max-width: 600px) {
  .mibox-usage-label {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .mibox-usage-label span {
    white-space: normal;
  }

  .mibox-file-item {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
  }

  .mibox-file-main {
    width: 100%;
    flex: none;
  }

  .mibox-file-name {
    white-space: normal;
    word-break: break-word;
  }

  .mibox-file-meta {
    margin-top: 4px;
  }

  .mibox-file-actions {
    width: 100%;
    justify-content: flex-end;
    gap: 8px;
  }

  .mibox-file-actions .btn-sm {
    flex: 1;
    justify-content: center;
    padding: 7px 6px;
    font-size: 0.88em;
  }
}

