.editor-screen {
  display: grid;
  grid-template-columns: 1fr;    /* entrambi i pannelli flottano: resta solo il canvas */
  height: 100%;
  position: relative;            /* ancora le card flottanti (absolute) */
  background: var(--editor-bg);  /* sfondo-editor neutro: le card "galleggiano" */
}

/* Left panel — card flottante stile Stripo (speculare al destro) */
.editor-screen .panel-left {
  position: absolute;
  top: var(--sp-4); left: var(--sp-4); bottom: var(--sp-4);
  width: var(--lp-w, 240px);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-panel);
  display: flex;
  flex-direction: column;
  overflow: visible;            /* lascia sporgere la maniglia di resize */
  z-index: 5;
  transition: transform .2s ease;
}
.editor-screen .panel-left > .panel-body {
  border-radius: var(--r-lg);
  overflow: hidden;             /* il contenuto rispetta gli angoli arrotondati */
}

/* Nascosta: slide-out a sinistra + linguetta di riapertura */
.editor-screen.left-hidden .panel-left { transform: translateX(calc(-100% - var(--sp-4))); }

/* Maniglia di resize sul bordo destro della card */
.editor-screen .lp-resize {
  position: absolute; right: -6px; top: 0; bottom: 0; width: 12px;
  cursor: ew-resize; touch-action: none; z-index: 6;
}
.editor-screen .lp-resize::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 4px; height: 44px; border-radius: 2px; background: var(--border-mid);
  transition: background .12s ease;
}
.editor-screen .lp-resize:hover::before { background: var(--coop-red); }
.editor-screen .lp-resize:focus-visible { outline: 2px solid var(--coop-red); outline-offset: 2px; }

/* Linguetta di riapertura (visibile solo a pannello nascosto) */
.editor-screen .lp-reopen {
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 24px; height: 60px; display: none; align-items: center; justify-content: center;
  background: var(--bg-card); color: var(--ink-2);
  border: 1px solid var(--border-soft); border-left: none;
  border-radius: 0 var(--r-md) var(--r-md) 0;
  box-shadow: var(--shadow-md); cursor: pointer; z-index: 5;
}
.editor-screen.left-hidden .lp-reopen { display: flex; }
.editor-screen .lp-reopen:focus-visible { outline: 2px solid var(--coop-red); outline-offset: 2px; }

/* Il corpo riempie il pannello; solo la lista pagine scrolla, Blocchi/Legenda restano visibili */
.editor-screen .panel-left .panel-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.editor-screen .panel-section {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-soft);
}

/* La sezione Pagine prende lo spazio elastico e la sua lista scrolla internamente */
.editor-screen .panel-section.pages-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.editor-screen .panel-section.pages-section .pages-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.editor-screen .panel-left h4 {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--ink-3);
  margin-bottom: var(--sp-3);
}

.editor-screen .pages-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.editor-screen .page-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-md);
  position: relative;            /* ancora l'icona elimina (assoluta, non occupa spazio a riposo) */
}

.editor-screen .page-row:hover { background: #ede9e3; }

.editor-screen .page-row.active {
  background: var(--coop-red-tint);
  color: var(--ink-1);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--coop-red);
}

.editor-screen .page-row .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
}
.editor-screen .page-row .dot.warn { background: var(--warn); }
.editor-screen .page-row .dot.empty { background: #ccc; }

.editor-screen .block-palette {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2);
}

.editor-screen .block-tile {
  background: white;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  padding: var(--sp-3) var(--sp-2);
  text-align: center;
  font-size: var(--fs-xs);
  cursor: grab;
}

.editor-screen .block-tile:hover { border-color: var(--coop-red); }

.editor-screen .block-tile .ico {
  font-size: 14px;
  margin-bottom: var(--sp-1);
  opacity: 0.6;
}

.editor-screen .block-tile.ai {
  background: linear-gradient(135deg, var(--ai-bg) 0%, #ffeed2 100%);
  border-color: var(--ai);
}

/* Area toggle */
.area-toggle {
  display: flex;
  background: var(--bg-dark-2);
  border-radius: var(--r-md);
  padding: 2px;
}

.area-toggle button {
  background: transparent;
  color: var(--ink-5);
  border: none;
  padding: 6px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--r-sm);
  cursor: pointer;
}

.area-toggle button.active {
  background: var(--coop-red);
  color: white;
}

/* Canvas */
.editor-screen .canvas {
  padding: var(--sp-6);
  overflow-y: auto;
}

.editor-screen .canvas-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  font-size: var(--fs-md);
}

.editor-screen .canvas-toolbar .crumb { color: var(--ink-3); min-width: 0; flex-shrink: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-screen .canvas-toolbar .crumb strong { color: var(--ink-2); }

.editor-screen .ai-btn {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--ai);
  border: 1px solid var(--ai-border);
  padding: 7px 12px;
  font-size: var(--fs-sm);
  font-weight: 600;
  border-radius: var(--r-md);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.editor-screen .ai-btn + .ai-btn { margin-left: var(--sp-2); }
.editor-screen .ai-btn:hover { background: var(--ai-bg); border-color: var(--ai-2); }

.editor-screen .pages-spread {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  margin: 0 auto;
  width: 100%;
  max-width: min(100%, calc((100vh - 220px) * 1.61));
}

.editor-screen .page {
  background: white;
  aspect-ratio: 651/808;
  padding: 12px 14px;
  position: relative;
  border: 1px solid var(--border-mid);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-page);
}

.editor-screen .page-header {
  background: var(--coop-red);
  color: white;
  padding: 8px 12px;
  margin: -12px -14px var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.editor-screen .page-header .pg-title {
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: 0.5px;
  cursor: text;
  border-radius: 3px;
  padding: 0 4px;
  margin: 0 -4px;
}
.editor-screen .page-header .pg-title:hover { background: rgba(255,255,255,0.15); }
.editor-screen .page-header .pg-title[contenteditable="true"] {
  background: rgba(0,0,0,0.18);
  outline: 1px solid rgba(255,255,255,0.7);
  cursor: text;
}


.editor-screen .page-grid {
  display: grid;
  gap: var(--sp-2);
  height: calc(100% - 36px);
  grid-auto-rows: 1fr;
}

.editor-screen .page-grid.grid-3x3 {
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: var(--sp-1);
}

.editor-screen .page-grid.grid-3x3 .slot {
  padding: 4px;
}


.editor-screen .page-grid.grid-4x2 {
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr 1fr;
}

.editor-screen .page-grid.grid-4x4 {
  grid-template-columns: 1fr 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr 1fr;
  gap: 3px;
}

.editor-screen .page-grid.grid-4x4 .slot {
  padding: 3px;
}

.editor-screen .page-grid.grid-3-2 {
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: var(--sp-1);
}
.editor-screen .page-grid.grid-3-2 > .slot:nth-child(-n+3) { grid-column: span 2; } /* riga 1: 3 celle da 2 col */
.editor-screen .page-grid.grid-3-2 > .slot:nth-child(n+4)  { grid-column: span 3; } /* riga 2: 2 celle da 3 col */


.editor-screen .page-grid.hero-single {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.editor-screen .page-grid.hero-single .slot-img {
  font-size: var(--fs-lg);
  font-weight: 700;
}


/* Slot */
.editor-screen .slot {
  background: white;
  border: 1px dashed #ccc;
  border-radius: var(--r-sm);
  padding: var(--sp-2);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  position: relative;
  cursor: pointer;
  min-height: 64px;
}

.editor-screen .slot.filled {
  border-style: solid;
  border-color: var(--border-soft);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .12s ease, transform .12s ease;
}
.editor-screen .slot.filled:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.editor-screen .slot.filled.selected { box-shadow: var(--shadow-md); }

.editor-screen .slot.empty { background: #faf9f7; }

.editor-screen .slot.selected {
  border-color: var(--coop-red);
  border-width: 2px;
  box-shadow: 0 0 0 3px rgba(227,6,19,0.15);
}

.editor-screen .slot.drag-over {
  border-color: var(--coop-red);
  background: #fff4f5;
}

.editor-screen .slot.override-area {
  border-color: var(--ai);
  border-width: 2px;
}

.editor-screen .slot-img {
  background: var(--bg-app);
  flex: 1;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-5);
  font-size: var(--fs-xs);
  min-height: 60px;
}

.editor-screen .slot-img.real {
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.2;
  color: #222;
  height: 100%;
}

.editor-screen .slot-img.real:hover { cursor: text; }
.editor-screen .slot-img.real.editing {
  outline: 2px solid var(--coop-red);
  outline-offset: -2px;
  cursor: text;
  background: #fff;
}

/* Right panel — card flottante stile Stripo */
.editor-screen .panel-right {
  position: absolute;
  top: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4);
  width: var(--rp-w, 340px);
  display: flex;
  flex-direction: column;
  overflow: visible;            /* contenitore trasparente: tab e contenuto sono due card distinte */
  z-index: 5;
  transition: transform .2s ease;
}
.editor-screen .panel-right > #panel-right-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  gap: var(--sp-3);             /* stacco tra la pillola dei tab e la card del contenuto */
}

/* Nascosta: slide-out a destra + linguetta di riapertura */
.editor-screen.right-hidden .panel-right { transform: translateX(calc(100% + var(--sp-4))); }

/* Maniglia di resize sul bordo sinistro della card */
.editor-screen .rp-resize {
  position: absolute; left: -6px; top: 0; bottom: 0; width: 12px;
  cursor: ew-resize; touch-action: none; z-index: 6;
}
.editor-screen .rp-resize::before {
  content: ""; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 4px; height: 44px; border-radius: 2px; background: var(--border-mid);
  transition: background .12s ease;
}
.editor-screen .rp-resize:hover::before { background: var(--coop-red); }
.editor-screen .rp-resize:focus-visible { outline: 2px solid var(--coop-red); outline-offset: 2px; }
body.rp-resizing { user-select: none; cursor: ew-resize; }

/* Linguetta di riapertura (visibile solo a pannello nascosto) */
.editor-screen .rp-reopen {
  position: absolute; right: 0; top: 50%; transform: translateY(-50%);
  width: 24px; height: 60px; display: none; align-items: center; justify-content: center;
  background: var(--bg-card); color: var(--ink-2);
  border: 1px solid var(--border-soft); border-right: none;
  border-radius: var(--r-md) 0 0 var(--r-md);
  box-shadow: var(--shadow-md); cursor: pointer; z-index: 5;
}
.editor-screen.right-hidden .rp-reopen { display: flex; }
.editor-screen .rp-reopen:focus-visible { outline: 2px solid var(--coop-red); outline-offset: 2px; }

/* Il canvas riserva spazio alle card flottanti; a pannello nascosto recupera il gutter */
.editor-screen .canvas {
  padding-left: calc(var(--lp-w, 240px) + var(--sp-4) * 2);
  padding-right: calc(var(--rp-w, 340px) + var(--sp-4) * 2);
  transition: padding-left .2s ease, padding-right .2s ease;
}
.editor-screen.left-hidden .canvas { padding-left: var(--sp-6); }
.editor-screen.right-hidden .canvas { padding-right: var(--sp-6); }

@media (prefers-reduced-motion: reduce) {
  .editor-screen .panel-left,
  .editor-screen .panel-right,
  .editor-screen .canvas,
  .editor-screen .lp-resize::before,
  .editor-screen .rp-resize::before { transition: none; }
}

.editor-screen .panel-right h4 {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--ink-3);
  letter-spacing: 0.8px;
  margin-bottom: var(--sp-3);
  display: flex;
  justify-content: space-between;
}

.editor-screen .panel-right h4 span { color: var(--coop-red); }

.editor-screen .scorta-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  margin-bottom: var(--sp-3);
  background: white;
}

.editor-screen .scorta-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.editor-screen .scorta-item {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3);
  background: white;
  border-radius: var(--r-md);
  border: 1px solid var(--border-soft);
  font-size: var(--fs-sm);
  cursor: grab;
  align-items: center;
}

.editor-screen .scorta-item:hover { border-color: var(--coop-red); }
.editor-screen .scorta-item.dragging { opacity: 0.5; }

.editor-screen .scorta-thumb {
  width: 36px;
  height: 36px;
  background: #ddd;
  border-radius: var(--r-sm);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--ink-4);
}

.editor-screen .scorta-info { flex: 1; min-width: 0; }
.editor-screen .scorta-info .name { font-weight: 600; font-size: var(--fs-sm); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-screen .scorta-info .meta { color: var(--ink-4); font-size: 9px; }

/* Pannello destro a tab */
.editor-screen #panel-right-body { display: flex; flex-direction: column; height: 100%; }
.editor-screen .rp-tabs { display: flex; gap: 2px; padding: 6px; background: var(--bg-soft); border-bottom: 1px solid var(--border-soft); flex: none; }
.editor-screen .rp-tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 6px 8px; font-family: inherit; font-size: var(--fs-sm); font-weight: 600;
  color: var(--ink-3); cursor: pointer;
}
.editor-screen .rp-tab:hover { background: #ececea; }
.editor-screen .rp-tab.on { background: #fff; color: var(--ink-1); border-color: var(--border-mid); box-shadow: var(--shadow-sm); }
.editor-screen .rp-tab:focus-visible { outline: 2px solid var(--coop-red); outline-offset: 1px; }
.editor-screen .rp-badge {
  background: var(--coop-red); color: #fff; font-size: 9px; font-weight: 800;
  min-width: 14px; height: 14px; padding: 0 3px; border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
}
.editor-screen .rp-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--sp-4); }
.editor-screen .rp-empty { padding: 20px 4px; color: var(--ink-4); font-size: var(--fs-md); line-height: 1.5; }

/* Inspector */
/* Header inspector: titolo a sinistra, icona commenti in alto a destra */
.editor-screen .inspector .ins-head {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
}
.editor-screen .inspector .ins-title { font-size: var(--fs-lg); font-weight: 700; cursor: text; flex: 1; min-width: 0; }
.editor-screen .inspector .ins-title:hover { background: var(--bg-soft); border-radius: var(--r-sm); }
.editor-screen .inspector .ins-title[contenteditable="true"] {
  outline: 2px solid var(--coop-red);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.editor-screen .ins-cmt-btn {
  flex: none; position: relative;
  width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--border-mid); background: var(--bg-card);
  font-size: 14px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.editor-screen .ins-cmt-btn:hover { border-color: var(--coop-red); }
.editor-screen .ins-cmt-btn.has { border-color: var(--coop-red); }
.editor-screen .ins-cmt-btn .cc-badge {
  position: absolute; top: -5px; right: -5px;
}
.editor-screen .inspector .ins-sub { font-size: var(--fs-sm); color: var(--ink-4); margin-bottom: var(--sp-4); }

.editor-screen .ins-field { margin-bottom: var(--sp-4); }

.editor-screen .ins-field label,
.editor-screen .ins-field .ins-flabel,
.editor-screen .ins-section-label {
  display: block;
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-3);
  font-weight: 700;
  margin-bottom: var(--sp-2);
}

.editor-screen .ins-field input,
.editor-screen .ins-field select,
.editor-screen .ins-field textarea {
  width: 100%;
  padding: var(--sp-3);
  border: 1px solid var(--border-mid);
  border-radius: var(--r-sm);
  font-size: var(--fs-md);
  background: white;
  font-family: var(--font-sans);
  line-height: 1.4;
  color: var(--ink-1);
}
.editor-screen .ins-field input:hover,
.editor-screen .ins-field textarea:hover { border-color: var(--ink-5); }
.editor-screen .ins-field textarea { resize: vertical; }

/* Focus accessibile su tutti i controlli dell'inspector */
.editor-screen .inspector input:focus-visible,
.editor-screen .inspector textarea:focus-visible,
.editor-screen .inspector button:focus-visible,
.editor-screen .inspector .ins-title:focus-visible {
  outline: 2px solid var(--coop-red);
  outline-offset: 1px;
}

/* Canali */
.editor-screen .ins-canali { display: flex; gap: var(--sp-5); }
.editor-screen .ins-check { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-md); color: var(--ink-2); cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; }
.editor-screen .ins-check input { width: auto; }

.editor-screen .ins-section {
  border-top: 1px solid var(--border-soft);
  padding-top: var(--sp-4);
  margin-top: var(--sp-4);
}

.editor-screen .ins-remove-btn {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  color: var(--coop-red);
  border: 1px solid var(--coop-red);
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 600;
  cursor: pointer;
}
.editor-screen .ins-remove-btn:hover { background: var(--coop-red); color: #fff; }

.editor-screen .ins-area-row { font-size: var(--fs-sm); line-height: 1.8; }
.editor-screen .ins-area-row.override { color: var(--ai); font-weight: 600; }

/* Pulsante rimozione slot */
.slot-remove { position:absolute; top:2px; left:2px; width:18px; height:18px; line-height:16px;
  border:none; border-radius:50%; background:rgba(0,0,0,.55); color:#fff; font-size:13px; cursor:pointer;
  opacity:0; transition:opacity .12s ease; z-index:3; }
.slot.filled:hover .slot-remove, .slot.filled.selected .slot-remove { opacity:1; }
@media (prefers-reduced-motion: reduce){ .slot-remove{ transition:none; } }


/* Contenitore canvas: serve position per ancorare il canvas-msg */
#canvas-content { position:relative; }

/* Badge "2 spazi" per referenze a doppia cella */
.slot-spazi { position:absolute; bottom:2px; left:2px; font-size:8px; font-weight:800; letter-spacing:.3px;
  background:#1a1a1a; color:#fff; padding:1px 4px; border-radius:var(--r-sm); }

/* Messaggio non bloccante di avviso piazzamento */
.canvas-msg { position:absolute; top:8px; left:50%; transform:translateX(-50%); z-index:20;
  background:var(--coop-red); color:#fff; font-size:12px; font-weight:600; padding:6px 12px; border-radius:var(--r-md);
  opacity:0; pointer-events:none; transition:opacity .15s ease; }
.canvas-msg.show { opacity:1; }
@media (prefers-reduced-motion: reduce){ .canvas-msg{ transition:none; } }

.ins-fp { display:flex; align-items:center; gap:6px; }
.ins-fp span { font-size:11px; color:#666; font-weight:700; }
.ins-fp button { width:34px; padding:6px 0; border:1px solid #ddd; background:#fff; border-radius:4px; cursor:pointer; font-size:12px; }
.ins-fp button.active { background:var(--coop-red); color:#fff; border-color:var(--coop-red); }

/* Chip tag editabili nell'Inspector */
.editor-screen .ins-tags { display:flex; flex-wrap:wrap; gap:5px; }
.editor-screen .ins-tag { font-family:inherit; font-size:11px; font-weight:600; padding:3px 9px; border:1px solid var(--border-mid); border-radius:11px; cursor:pointer; color:var(--ink-2); background:#fff; text-transform:uppercase; letter-spacing:.3px; user-select:none; }
.editor-screen .ins-tag:hover { border-color:var(--ink-3); }
.editor-screen .ins-tag.on { background:#3a3a3a; color:#fff; border-color:#3a3a3a; font-weight:700; }
.editor-screen .ins-tag.on.cat-soci { background:var(--tag-soci-strong); color:#fff; border-color:var(--tag-soci-strong); }
.editor-screen .ins-tag.on.cat-infanzia { background:var(--tag-infanzia-strong); color:#fff; border-color:var(--tag-infanzia-strong); }
.editor-screen .ins-tag.on.cat-cani-gatti { background:var(--tag-cani-gatti-strong); color:#fff; border-color:var(--tag-cani-gatti-strong); }

/* Cruscotto capacità */
.editor-screen .page-row .pg-num { font-weight: 800; flex: none; }
.editor-screen .page-row .pg-name { font-size: var(--fs-xs); color: var(--ink-3); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-occ { margin-left:auto; flex:none; font-size:10px; font-weight:700; padding:0 5px; border-radius:8px; }
.pg-occ.full { color:#0a7d52; background:rgba(15,184,122,.12); }
.pg-occ.partial { color:#8a5500; background:#fff7e6; }
.pg-occ.empty { color:#888; background:#ececea; }
.pg-occ.over { color:#fff; background:var(--coop-red); }
/* Riepilogo capacità nel pannello Pagine (sinistra) */
.editor-screen .panel-left .pages-cap {
  font-size: 11px; line-height: 1.5; color: var(--panel-muted);
  background: var(--panel-field); border: 1px solid var(--panel-border);
  border-radius: var(--r-sm); padding: 6px 8px; margin-bottom: var(--sp-3);
}
.editor-screen .panel-left .pages-cap b { color: var(--panel-ink); }
.editor-screen .panel-left .pages-cap.deficit { border-color: var(--coop-red); }
.editor-screen .panel-left .pages-cap-warn { color: #ff6a72; font-weight: 700; margin-top: 2px; }

/* Maniglie di resize ingombro 2D (e/w/s) */
.slot-resize {
  position: absolute; opacity: 0; transition: opacity .12s ease; z-index: 4;
  touch-action: none;
}
.slot-resize.e {
  top: 0; right: 0; width: 10px; height: 100%; cursor: col-resize;
}
.slot-resize.w {
  top: 0; left: 0; width: 10px; height: 100%; cursor: col-resize;
}
.slot-resize.s {
  bottom: 0; left: 0; width: 100%; height: 10px; cursor: row-resize;
}
.slot-resize.n {
  top: 0; left: 0; width: 100%; height: 10px; cursor: ns-resize;
}
.slot-resize.e::after {
  content: ''; position: absolute; right: 2px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 26px; border-radius: 2px; background: var(--coop-red);
}
.slot-resize.w::after {
  content: ''; position: absolute; left: 2px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 26px; border-radius: 2px; background: var(--coop-red);
}
.slot-resize.s::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 2px; background: var(--coop-red);
}
.slot-resize.n::after {
  content: ''; position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 3px; border-radius: 2px; background: var(--coop-red);
}
.slot.filled:hover .slot-resize, .slot.filled.selected .slot-resize { opacity: 1; }
.slot--resize-target { outline: 2px dashed var(--coop-red); outline-offset: -2px; background: rgba(227,6,19,.06); }
@media (prefers-reduced-motion: reduce) { .slot-resize { transition: none; } }

.scorta-filters { display:flex; gap:6px; margin:6px 0 8px; }
.scorta-filters select { flex:1; min-width:0; padding:5px 6px; font-size:11px; border:1px solid #ddd; border-radius:4px; background:#fff; }

.editor-screen .slot .slot-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 100%;
  color: var(--ink-4);
  cursor: pointer;
}
.editor-screen .slot .slot-add .plus { font-size: 20px; font-weight: 700; line-height: 1; }
.editor-screen .slot .slot-add .hint { font-size: 10px; }
.editor-screen .slot.empty:hover .slot-add { color: var(--coop-red); }

/* Indicatore categoria sullo slot: barra accento satura in alto (colpo d'occhio) */
.editor-screen .slot-cats {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; height: 7px;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
  overflow: hidden; pointer-events: none; z-index: 2;
}
.editor-screen .slot-cats .cat-chip {
  flex: 1; height: 100%; width: auto; border: none; border-radius: 0;
  box-shadow: inset 0 -1px 0 rgba(0,0,0,.12);
}
/* Indicatori categoria (barra colore sugli slot del canvas) */
.editor-screen .cat-soci { background: var(--tag-soci-strong); }
.editor-screen .cat-infanzia { background: var(--tag-infanzia-strong); }
.editor-screen .cat-cani-gatti { background: var(--tag-cani-gatti-strong); }

/* Toggle 'solo iper' in testata */
.editor-screen .pg-soloiper {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 9px; text-transform: uppercase; letter-spacing: .5px;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 3px; padding: 1px 6px; cursor: pointer;
  color: #fff; background: rgba(255,255,255,.12);
  transition: background .12s ease, box-shadow .12s ease, transform .12s ease;
}
.editor-screen .pg-soloiper .ico-svg { opacity: .85; }
.editor-screen .pg-soloiper:hover { background: rgba(255,255,255,.22); }
.editor-screen .pg-soloiper.on {
  background: #fff; color: var(--coop-red); border-color: #fff; font-weight: 800;
  box-shadow: 0 0 0 2px rgba(255,255,255,.45), 0 1px 5px rgba(0,0,0,.28);
}
.editor-screen .pg-soloiper.on .ico-svg { opacity: 1; }

/* Pagina marcata 'solo iper': solo bordo dorato superiore */
.editor-screen .page.solo-iper {
  border-top: 3px solid #d98e25;
}

/* ===== Pannello destro: tema scuro stile Stripo (override additivi) ===== */
.editor-screen .panel-right {
  background: transparent;       /* il colore lo danno le due card interne (tab + contenuto) */
  color: var(--panel-ink);
  border: none;
  box-shadow: none;
}
.editor-screen .panel-right h4 { color: var(--panel-muted); }
.editor-screen .panel-right h4 span { color: #ff6a72; }

/* Tabs scuri a sole icone — card/pillola distinta dal contenuto */
.editor-screen .panel-right .rp-tabs {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-panel);
  padding: 8px; gap: 4px; align-items: center;
  flex: none;
}
.editor-screen .panel-right .rp-tab {
  color: var(--panel-muted);
  border-color: transparent;
}
.editor-screen .panel-right .rp-tab:hover { background: var(--panel-card); color: var(--panel-ink); }
.editor-screen .panel-right .rp-tab.on {
  background: var(--panel-field); color: var(--panel-ink);
  border-color: var(--panel-border); box-shadow: none;
}
.editor-screen .panel-right .rp-tab:focus-visible { outline: 2px solid #ff6a72; outline-offset: 1px; }

/* Resize: feedback "sta per chiudersi" quando si trascina sotto la soglia */
.editor-screen.rp-will-close .panel-right { opacity: .55; }
/* Durante il drag niente transizioni: pannello e canvas si muovono insieme, senza scatti */
body.rp-resizing .editor-screen .canvas,
body.rp-resizing .editor-screen .panel-right { transition: none; }

.editor-screen.lp-will-close .panel-left { opacity: .55; }
body.lp-resizing { user-select: none; cursor: ew-resize; }
body.lp-resizing .editor-screen .canvas,
body.lp-resizing .editor-screen .panel-left { transition: none; }

.editor-screen .panel-right .rp-body { padding: var(--sp-4); }
.editor-screen .panel-right .rp-empty { color: var(--panel-muted); }

/* Scorta su scuro */
.editor-screen .panel-right .scorta-search,
.editor-screen .panel-right .scorta-filters select {
  background: var(--panel-field); color: var(--panel-ink); border-color: var(--panel-border);
}
.editor-screen .panel-right .scorta-search::placeholder { color: var(--panel-muted); }
.editor-screen .panel-right .scorta-item {
  background: var(--panel-card); border-color: var(--panel-border); color: var(--panel-ink);
}
.editor-screen .panel-right .scorta-item:hover { border-color: #ff6a72; }
.editor-screen .panel-right .scorta-info .name { color: var(--panel-ink); }
.editor-screen .panel-right .scorta-info .meta { color: var(--panel-muted); }
.editor-screen .panel-right .scorta-thumb { background: var(--panel-field); color: var(--panel-muted); }
.editor-screen .panel-right .scorta-add {
  background: var(--panel-field); color: var(--panel-ink); border: 1px solid var(--panel-border);
  border-radius: var(--r-sm); padding: 3px 8px; cursor: pointer; font-size: var(--fs-xs);
}
.editor-screen .panel-right .scorta-add:hover { border-color: #ff6a72; }


/* ===== Inspector su scuro: card per gruppo ===== */
.editor-screen .panel-right .pcard {
  background: var(--panel-card);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  margin-bottom: var(--sp-3);
}
.editor-screen .panel-right .pcard-h {
  font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .6px;
  color: var(--panel-muted); font-weight: 700; margin-bottom: var(--sp-3);
}

.editor-screen .panel-right .inspector .ins-title { color: var(--panel-ink); }
.editor-screen .panel-right .inspector .ins-title:hover { background: var(--panel-field); }
.editor-screen .panel-right .inspector .ins-sub { color: var(--panel-muted); }
.editor-screen .panel-right .ins-cmt-btn {
  background: var(--panel-field); color: var(--panel-ink); border-color: var(--panel-border);
}
.editor-screen .panel-right .ins-cmt-btn:hover,
.editor-screen .panel-right .ins-cmt-btn.has { border-color: #ff6a72; }

.editor-screen .panel-right .ins-field label,
.editor-screen .panel-right .ins-field .ins-flabel { color: var(--panel-muted); }
.editor-screen .panel-right .ins-field input,
.editor-screen .panel-right .ins-field textarea {
  background: var(--panel-field); color: var(--panel-ink); border-color: var(--panel-border);
}
.editor-screen .panel-right .ins-field input:hover,
.editor-screen .panel-right .ins-field textarea:hover { border-color: var(--panel-muted); }

/* Tag su scuro */
.editor-screen .panel-right .ins-tag {
  background: var(--panel-field); color: var(--panel-ink); border-color: var(--panel-border);
}
.editor-screen .panel-right .ins-tag:hover { border-color: var(--panel-muted); }
.editor-screen .panel-right .ins-tag.on { background: #565658; border-color: #565658; color: #fff; }
/* Tag categoria attivi: tinta satura della categoria (vince sul grigio generico) */
.editor-screen .panel-right .ins-tag.on.cat-soci { background: var(--tag-soci-strong); border-color: var(--tag-soci-strong); color: #fff; }
.editor-screen .panel-right .ins-tag.on.cat-infanzia { background: var(--tag-infanzia-strong); border-color: var(--tag-infanzia-strong); color: #fff; }
.editor-screen .panel-right .ins-tag.on.cat-cani-gatti { background: var(--tag-cani-gatti-strong); border-color: var(--tag-cani-gatti-strong); color: #fff; }

/* Ingombro su scuro */
.editor-screen .panel-right .ins-fp span { color: var(--panel-muted); }
.editor-screen .panel-right .ins-fp button {
  background: var(--panel-field); color: var(--panel-ink); border-color: var(--panel-border);
}
.editor-screen .panel-right .ins-fp button.active {
  background: var(--coop-red); color: #fff; border-color: var(--coop-red);
}

/* Note: la textarea sta nella pcard, niente margine extra */
.editor-screen .panel-right .pcard > textarea#ins-note { margin-bottom: 0; }

/* Campi multi-riga (Note prodotto, Testo banner): aspetto da textarea, non da input */
.editor-screen .panel-right .pcard textarea,
.editor-screen .panel-right .ins-field textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 68px;                 /* chiaramente multi-riga, non un input */
  padding: var(--sp-3);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-sm);
  background: var(--panel-field);
  color: var(--panel-ink);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  resize: vertical;                 /* maniglia di ridimensionamento visibile in basso a destra */
}
.editor-screen .panel-right .pcard textarea:hover,
.editor-screen .panel-right .ins-field textarea:hover { border-color: var(--panel-muted); }

/* Canali su scuro */
.editor-screen .panel-right .ins-check { color: var(--panel-ink); }

/* Varianti area / Rimuovi su scuro */
.editor-screen .panel-right .ins-section { border-top-color: var(--panel-border); }
.editor-screen .panel-right .ins-section-label { color: var(--panel-muted); }
.editor-screen .panel-right .ins-area-row { color: var(--panel-ink); }
.editor-screen .panel-right .ins-area-row.override { color: #f2b25b; }
.editor-screen .panel-right .ins-remove-btn { color: #ff6a72; border-color: #ff6a72; }
.editor-screen .panel-right .ins-remove-btn:hover { background: var(--coop-red); color: #fff; border-color: var(--coop-red); }

/* Focus accessibile su scuro per i controlli dell'inspector */
.editor-screen .panel-right .inspector input:focus-visible,
.editor-screen .panel-right .inspector textarea:focus-visible,
.editor-screen .panel-right .inspector button:focus-visible,
.editor-screen .panel-right .inspector .ins-title:focus-visible {
  outline: 2px solid #ff6a72; outline-offset: 1px;
}

/* ===== Rifinitura pannello destro: più respiro + bottoni allineati ===== */
/* Contenuto come card distinta sotto la pillola dei tab (stile Stripo) */
.editor-screen .panel-right .rp-body {
  padding: var(--sp-5);
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-panel);
}

/* Scorta: titolo su una riga, due bottoni azione affiancati a larghezza uguale */
.editor-screen .panel-right .scorta-title { justify-content: flex-start; gap: 6px; margin-bottom: var(--sp-3); }
.editor-screen .panel-right .scorta-actions { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.editor-screen .panel-right .scorta-actions .scorta-add {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 8px 10px; font-size: var(--fs-sm); font-weight: 600;
}
.editor-screen .panel-right .scorta-search { margin-bottom: var(--sp-3); }
.editor-screen .panel-right .scorta-filters { margin: 0 0 var(--sp-5); gap: var(--sp-2); }
.editor-screen .panel-right .scorta-list { gap: var(--sp-3); }
.editor-screen .panel-right .scorta-item { padding: var(--sp-4); }

/* Inspector: più aria tra le card e dentro */
.editor-screen .panel-right .inspector .ins-sub { margin-bottom: var(--sp-5); }
.editor-screen .panel-right .pcard { padding: var(--sp-5); margin-bottom: var(--sp-4); }
.editor-screen .panel-right .ins-section { padding-top: var(--sp-5); margin-top: var(--sp-5); }

/* ===== Pannello sinistro: tema scuro (override additivi) ===== */
.editor-screen .panel-left {
  background: var(--panel-bg);
  color: var(--panel-ink);
  border-color: var(--panel-border);
}
.editor-screen .panel-left .panel-section { border-bottom-color: var(--panel-border); }
.editor-screen .panel-left h4 { color: var(--panel-muted); }

/* Pagine su scuro */
.editor-screen .panel-left .page-row { color: var(--panel-ink); }
.editor-screen .panel-left .page-row:hover { background: var(--panel-card); }
.editor-screen .panel-left .page-row.active {
  background: rgba(227,6,19,0.18); color: var(--panel-ink);
  box-shadow: inset 3px 0 0 var(--coop-red);
}
.editor-screen .panel-left .page-row .pg-name { color: var(--panel-muted); }
.editor-screen .panel-left .page-row.add-page { color: var(--panel-muted); }
.editor-screen .panel-left .pg-occ.full { color: #3ddc97; background: rgba(15,184,122,.18); }

/* Blocchi su scuro */
.editor-screen .panel-left .block-tile {
  background: var(--panel-card); border-color: var(--panel-border); color: var(--panel-ink);
}
.editor-screen .panel-left .block-tile:hover { border-color: #ff6a72; }
.editor-screen .panel-left .block-tile .ico { opacity: 1; }

/* Legenda su scuro */

/* Focus visibile su scuro */
.editor-screen .panel-left .page-row:focus-visible,
.editor-screen .panel-left .block-tile:focus-visible {
  outline: 2px solid #ff6a72; outline-offset: 1px;
}

/* ===== Eliminazione spread nel navigatore Pagine ===== */
.editor-screen .panel-left .pg-del {
  position: absolute; right: var(--sp-2); top: 50%; transform: translateY(-50%);
  opacity: 0; pointer-events: none;       /* a riposo: invisibile e fuori dal flusso (niente spazio) */
  width: 22px; height: 22px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: var(--panel-card); color: var(--panel-muted);
  border-radius: var(--r-sm); cursor: pointer;
  transition: opacity .12s ease, color .12s ease, background .12s ease;
}
.editor-screen .panel-left .page-row:hover .pg-del,
.editor-screen .panel-left .page-row:focus-within .pg-del { opacity: 1; pointer-events: auto; }
/* All'hover l'icona elimina prende il posto del badge conteggio (niente sovrapposizione) */
.editor-screen .panel-left .page-row:hover .pg-occ,
.editor-screen .panel-left .page-row:focus-within .pg-occ { opacity: 0; }
.editor-screen .panel-left .pg-del:hover { color: #ff6a72; background: var(--panel-card); }
.editor-screen .panel-left .pg-del:focus-visible { opacity: 1; outline: 2px solid #ff6a72; outline-offset: 1px; }

.editor-screen .panel-left .page-row.pg-confirm { gap: 6px; cursor: default; color: var(--panel-ink); }
.editor-screen .panel-left .pg-confirm-q { flex: 1; min-width: 0; font-size: var(--fs-sm); }
.editor-screen .panel-left .pg-confirm-no,
.editor-screen .panel-left .pg-confirm-yes {
  flex: none; padding: 2px 8px; font-size: var(--fs-xs); font-weight: 600; cursor: pointer;
  border: 1px solid var(--panel-border); border-radius: var(--r-sm);
  background: var(--panel-field); color: var(--panel-ink);
}
.editor-screen .panel-left .pg-confirm-yes { background: var(--coop-red); border-color: var(--coop-red); color: #fff; }
.editor-screen .panel-left .pg-confirm-no:focus-visible,
.editor-screen .panel-left .pg-confirm-yes:focus-visible { outline: 2px solid #ff6a72; outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .editor-screen .panel-left .pg-del { transition: none; } }

/* Indicatore "nota" sullo slot (canvas): visibile quando il prodotto ha una Nota */
.editor-screen .slot-note {
  position: absolute; top: 2px; right: 2px; z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 4px; line-height: 1; cursor: pointer;
  background: rgba(255,255,255,.92); border: 1px solid var(--border-mid);
  border-radius: 10px; color: var(--ai);
}
.editor-screen .slot-note:hover { border-color: var(--ai-2); color: var(--ai-2); }
.editor-screen .slot-note:focus-visible { outline: 2px solid var(--coop-red); outline-offset: 1px; }

/* Banner pubblicitari */
.block-tile.banner { cursor: grab; }
.block-tile.banner:active { cursor: grabbing; }

.editor-screen .slot.banner {
  background: repeating-linear-gradient(45deg, rgba(227,6,19,.04) 0 8px, rgba(227,6,19,.08) 8px 16px);
  border: 1.5px dashed var(--coop-red);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.editor-screen .slot.banner .banner-tag {
  position: absolute; top: 2px; left: 22px; z-index: 2;
  font-size: 9px; font-weight: 800; letter-spacing: .06em;
  color: var(--coop-red); background: rgba(255,255,255,.9);
  padding: 1px 5px; border-radius: 8px;
}
.editor-screen .slot.banner .banner-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.editor-screen .slot.banner .banner-text {
  padding: 6px 8px; font-weight: 700; color: var(--ink-1, #1a1a1a);
  text-align: center; font-size: 13px; line-height: 1.2;
}

/* Inspector banner pubblicitario */
.inspector .ban-text {
  width: 100%; box-sizing: border-box; resize: vertical;
  border: 1px solid var(--border-mid); border-radius: 8px; padding: 8px; font: inherit;
}
.inspector .ban-preview {
  width: 100%; max-height: 120px; object-fit: cover; border-radius: 8px;
  display: block; margin-bottom: 8px; border: 1px solid var(--border-mid);
}
.inspector .ban-upload {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border-mid); border-radius: 8px; padding: 6px 10px; font-size: 13px;
}
.inspector .ban-upload:hover { border-color: var(--ai, #5b6ee1); }
.inspector .ban-img-remove {
  display: block; margin-top: 8px; background: none; border: none; cursor: pointer;
  color: var(--coop-red); font-size: 12px; padding: 0;
}

/* Foto prodotto sullo slot: immagine sopra, titolo editabile sotto */
.editor-screen .slot.filled.has-photo { display: flex; flex-direction: column; }
.editor-screen .slot.filled.has-photo .slot-photo {
  flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #fff; display: block;
}
.editor-screen .slot.filled.has-photo .slot-img.real {
  flex: 0 0 auto; height: auto; min-height: 0; text-align: center; padding: 2px 4px; background: #fff;
}

/* Card "Foto" nell'Inspector (coerente con la card immagine del banner) */
.inspector .ins-foto-preview {
  width: 100%; max-height: 120px; object-fit: contain; background: #fff;
  border-radius: 8px; display: block; margin-bottom: 8px; border: 1px solid var(--border-mid);
}
.inspector .ins-foto-upload {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border-mid); border-radius: 8px; padding: 6px 10px; font-size: 13px;
}
.inspector .ins-foto-upload:hover { border-color: var(--ai, #5b6ee1); }
.inspector .ins-foto-remove {
  display: block; margin-top: 8px; background: none; border: none; cursor: pointer;
  color: var(--coop-red); font-size: 12px; padding: 0;
}
