/* CRM ML — Editor scaletta saggio (portale maestri), mobile-first.
   Palette chiara esplicita (come la vista Saggi del portale) per restare leggibile
   anche con skin scura del portale. Hero gradiente coerente col prodotto. */

.crml-scaletta { padding: 8px 12px 28px; color: #0f172a; -webkit-tap-highlight-color: transparent; }
.crml-scaletta * { box-sizing: border-box; }

.crml-scaletta-loading { padding: 40px 16px; text-align: center; color: #94a3b8; font-size: 14px; }
.cs-back { display: inline-block; margin: 4px 2px 10px; text-decoration: none; color: #64748b; font-weight: 600; font-size: 14px; }
.cs-back:hover { color: #be185d; }

/* HERO */
.cs-hero { background: linear-gradient(135deg, #be185d 0%, #7c3aed 100%); color: #fff; border-radius: 16px; padding: 16px 16px 14px; margin-bottom: 12px; }
.cs-hero-top { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.cs-hero-top h2 { margin: 0; font-size: 19px; font-weight: 700; color: #fff; flex: 1; min-width: 60%; line-height: 1.25; }
.cs-rolechip { font-size: 11px; font-weight: 700; background: rgba(255,255,255,.92); color: #9d174d; padding: 4px 11px; border-radius: 20px; white-space: nowrap; }
.cs-hero-meta { font-size: 12.5px; color: #fce7f3; margin: 6px 0 10px; }
.cs-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.cs-chip { font-size: 11px; background: rgba(255,255,255,.18); color: #fff; padding: 3px 10px; border-radius: 20px; font-weight: 600; }

.cs-help { font-size: 12px; color: #94a3b8; margin: 0 2px 10px; }

/* LIST */
.cs-list { display: flex; flex-direction: column; gap: 8px; }
.cs-empty { padding: 28px 14px; text-align: center; color: #94a3b8; font-size: 14px; border: 1px dashed #e2e8f0; border-radius: 12px; }

/* SECTION header (Parte I / II) */
.cs-section { display: flex; align-items: center; gap: 10px; margin: 8px 2px 2px; color: #be185d; }
.cs-secline { flex: 1; height: 1px; background: #f1d6e2; }
.cs-sectitle { font-size: 12px; font-weight: 800; letter-spacing: .06em; white-space: nowrap; }
.cs-secarrows { display: inline-flex; gap: 4px; }

/* CARD */
.cs-card { display: flex; align-items: center; gap: 10px; padding: 10px 11px; background: #fff; border: 1px solid #e9edf3; border-radius: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.cs-card.is-pausa { background: #fafafa; border-style: dashed; border-color: #e2e8f0; }
.cs-card.cs-dragging { opacity: .55; border-color: #be185d; }

.cs-grip { display: none; color: #cbd5e1; cursor: grab; flex: 0 0 auto; }
.cs-pos { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; background: #eef2ff; color: #4338ca; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.cs-pos.cs-pos-na { background: #f1f5f9; color: #94a3b8; }
.cs-pauseicon { width: 28px; height: 28px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: #b45309; }

.cs-main { flex: 1; min-width: 0; }
.cs-title { font-size: 14.5px; font-weight: 600; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-sub { font-size: 12px; color: #64748b; margin-top: 1px; }
.cs-meta { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.cs-dur { font-size: 11.5px; color: #475569; font-weight: 600; }
.cs-siae { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.cs-siae.pd { background: #f0fdf4; color: #15803d; }
.cs-siae.s  { background: #fffbeb; color: #b45309; }
.cs-siae.so { background: #fef2f2; color: #b91c1c; }
.cs-ex { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; background: #f1f5f9; color: #475569; padding: 1px 8px; border-radius: 20px; }
.cs-exadd { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: #be185d; font-weight: 600; cursor: pointer; }

.cs-arrows { display: inline-flex; flex-direction: column; gap: 3px; flex: 0 0 auto; }
.cs-iconbtn { width: 30px; height: 26px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #e2e8f0; background: #fff; border-radius: 7px; color: #64748b; cursor: pointer; padding: 0; font-size: 15px; line-height: 1; }
.cs-iconbtn:active { transform: scale(.94); }
.cs-iconbtn:hover { border-color: #cbd5e1; color: #334155; }
.cs-editbtn { width: 34px; height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #f3d4e1; background: #fdf2f8; color: #be185d; border-radius: 9px; cursor: pointer; }
.cs-editbtn:active { transform: scale(.94); }

/* TOOLBAR */
.cs-toolbar { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid #eef2f6; }
.cs-tbtn { flex: 1; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 11px 4px; border: 1px solid #e2e8f0; background: #fff; border-radius: 11px; font-size: 12px; font-weight: 600; color: #334155; cursor: pointer; }
.cs-tbtn svg { color: #be185d; }
.cs-tbtn:active { transform: scale(.97); }
.cs-tbtn:hover { border-color: #f3d4e1; background: #fdf2f8; }

/* TOAST */
.cs-saved { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); background: #0f172a; color: #fff; font-size: 13px; padding: 9px 16px; border-radius: 22px; z-index: 99999; transition: opacity .25s; box-shadow: 0 6px 20px rgba(0,0,0,.2); pointer-events: none; }
.cs-saved.is-err { background: #b91c1c; }

/* BOTTOM SHEET */
.cs-sheet-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 99998; display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity .2s; }
.cs-sheet-overlay.on { opacity: 1; }
.cs-sheet { width: 100%; max-width: 560px; background: #fff; color: #0f172a; border-radius: 20px 20px 0 0; padding: 12px 16px calc(18px + env(safe-area-inset-bottom)); max-height: 90vh; overflow-y: auto; transform: translateY(100%); transition: transform .24s cubic-bezier(.2,.7,.2,1); }
.cs-sheet-overlay.on .cs-sheet { transform: translateY(0); }
.cs-grab { width: 40px; height: 4px; border-radius: 9px; background: #e2e8f0; margin: 0 auto 12px; }
.cs-sheet h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; color: #0f172a; }
.cs-sheet h3 svg { color: #be185d; }

.cs-flbl { display: block; font-size: 11.5px; color: #64748b; font-weight: 600; margin: 12px 0 5px; }
.cs-input { width: 100%; border: 1px solid #d8dee9; border-radius: 10px; padding: 10px 12px; font-size: 15px; color: #0f172a; background: #fff; font-family: inherit; }
.cs-input:focus { outline: none; border-color: #be185d; box-shadow: 0 0 0 3px rgba(190,24,93,.12); }
textarea.cs-input { resize: vertical; }
.cs-stepper { display: flex; align-items: center; gap: 10px; }
.cs-stepper .cs-iconbtn { width: 40px; height: 40px; font-size: 20px; font-weight: 700; }
.cs-durhint { font-size: 11px; color: #94a3b8; }

.cs-seg { display: flex; gap: 6px; }
.cs-seg button { flex: 1; font-size: 13px; padding: 9px 4px; border: 1px solid #d8dee9; background: #fff; border-radius: 10px; color: #64748b; cursor: pointer; font-weight: 600; }
.cs-seg button.on { border-color: #be185d; color: #be185d; background: #fdf2f8; }

.cs-allievi { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid #eef2f6; border-radius: 10px; padding: 8px; }
.cs-allievi-empty { font-size: 13px; color: #94a3b8; padding: 6px; }
.cs-allievo { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #334155; padding: 8px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; }
.cs-allievo.on { background: #fdf2f8; border-color: #f3d4e1; color: #9d174d; font-weight: 600; }
.cs-allievo input { width: 18px; height: 18px; accent-color: #be185d; }

.cs-sheet-act { display: flex; gap: 8px; margin-top: 18px; }
.cs-btn-prim { flex: 1; background: #be185d; color: #fff; border: none; border-radius: 11px; padding: 13px; font-size: 15px; font-weight: 700; cursor: pointer; }
.cs-btn-prim:disabled { opacity: .6; }
.cs-btn-prim:active { transform: scale(.98); }
.cs-btn-ghost { padding: 13px 16px; background: #fff; border: 1px solid #d8dee9; border-radius: 11px; color: #475569; font-size: 15px; font-weight: 600; cursor: pointer; }
.cs-btn-danger { width: 48px; padding: 13px 0; background: #fff; border: 1px solid #fecaca; border-radius: 11px; color: #dc2626; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }

/* DESKTOP: maniglia drag visibile + larghezza contenuta */
@media (min-width: 760px) {
  .crml-scaletta { max-width: 720px; margin: 0 auto; }
  .cs-grip { display: inline-flex; }
  .cs-card { padding: 12px 14px; }
  .cs-title { font-size: 15px; }
}

/* v3.14.700: tap target 44px su touch (riordino frecce + modifica brano) senza alterare il desktop */
@media (pointer: coarse) {
  .cs-iconbtn { width: 40px; height: 40px; }
  .cs-editbtn { width: 44px; height: 44px; }
}
