/* ---------- Editor del segnalino ---------- */
#cropDialog {
  width: min(1020px, 96vw); max-width: none; max-height: 94vh; max-height: 94dvh;
  padding: 0; border: 0; border-radius: 16px; overflow: hidden;
  background: var(--panel); color: var(--text);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}
#cropDialog::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(3px); }
#cropForm { display: flex; flex-direction: column; max-height: 94vh; max-height: 94dvh; }

.cHead { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.cHead h3 { margin: 0 0 4px; font-size: 1.1rem; }
.cHead p { margin: 0; font-size: .82rem; opacity: .7; line-height: 1.4; }

.cMain { display: flex; gap: 0; min-height: 0; flex: 1; }
@media (max-width: 820px) { .cMain { flex-direction: column; overflow: auto; } }

/* --- area di lavoro --- */
.cStageWrap {
  flex: 1 1 auto; min-width: 0; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; align-items: center;
  background: radial-gradient(120% 100% at 50% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 70%);
}
.cStage { position: relative; width: min(440px, 100%); aspect-ratio: 1; }
#cropCanvas {
  width: 100%; height: 100%; display: block; border-radius: 14px;
  background: #11141b; box-shadow: inset 0 0 0 1px var(--line);
  touch-action: none; cursor: grab;
}
#cropGuide { position: absolute; inset: 0; pointer-events: none; border-radius: 14px; }
#cropGuide[data-tool="wand"] ~ #cropCanvas, #cropCanvas:active { cursor: crosshair; }

.cTools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: min(440px, 100%); }
.cTools .cSpacer { flex: 1; }
.cTools button {
  border: 1px solid var(--line); background: var(--panel-2);
  color: inherit; font: inherit; font-size: .8rem; padding: 6px 10px;
  border-radius: 9px; cursor: pointer;
}
.cTools button:hover { background: var(--panel-3); }
.cTools button.on { background: var(--accent); border-color: transparent; color: #fff; }

/* --- colonna dei comandi --- */
.cSide {
  flex: 0 0 330px; min-width: 0; overflow: auto;
  padding: 16px 18px 20px; border-left: 1px solid var(--line);
  background: var(--panel-2);
  display: flex; flex-direction: column; gap: 14px;
}
@media (max-width: 820px) { .cSide { flex: none; border-left: 0; border-top: 1px solid var(--line); } }

.cGroup { display: flex; flex-direction: column; gap: 8px; }
.cGroup h4 {
  margin: 0; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent);
}
.cRow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: .85rem; }
.cRow > input[type=text] {
  flex: 1; min-width: 0; padding: 6px 9px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel-2); color: inherit; font: inherit;
}
.cHint { margin: 0; font-size: .75rem; opacity: .62; line-height: 1.35; overflow-wrap: anywhere; }

.cSeg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cSeg button {
  border: 1px solid var(--line); background: var(--panel-2);
  color: inherit; font: inherit; font-size: .8rem; padding: 7px 8px; border-radius: 9px; cursor: pointer;
}
.cSeg button:hover { background: var(--panel-3); }
.cSeg button.on { background: var(--accent); border-color: transparent; color: #fff; }

.cRange { display: grid; grid-template-columns: 1fr 120px auto; gap: 8px; align-items: center; font-size: .82rem; }
.cRange input[type=range] { width: 100%; accent-color: var(--accent); }
.cRange output { font-variant-numeric: tabular-nums; opacity: .8; min-width: 48px; text-align: right; }
.cCheck { display: flex; align-items: center; gap: 8px; font-size: .82rem; }
.cCheck input[type=color] { margin-left: auto; }

.cSwRow .sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.cSwRow .sw.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(0, 0, 0, .35) inset; }
.cSwRow input[type=color] { width: 26px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; }

.cPrev { display: flex; gap: 10px; }
.cPrev canvas { width: 84px; height: 84px; border-radius: 10px; border: 1px solid var(--line); }

#cropDialog .dialogBtns {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2);
}
