/* Saggio BTMusic — interfaccia. Archivo (OFL) incluso in /static/fonts. */
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-ext-wdth-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo";
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  src: url(fonts/archivo-latin-wdth-italic.woff2) format("woff2-variations");
}

:root {
  --floor: #E9ECF0;        /* sfondo: pavimento del palco, grigio freddo */
  --surface: #FFFFFF;
  --surface-2: #F5F6F8;
  --ink: #18202D;
  --ink-2: #4D5868;
  --muted: #7A8494;
  --line: #D5DAE1;
  --line-strong: #B9C0CA;

  /* nastri colorati da palco, uno per famiglia di strumento */
  --tape-voce: #F2C230;
  --tape-chitarra: #E5533D;
  --tape-basso: #2F6FDB;
  --tape-batteria: #1F9D63;
  --tape-tastiere: #8A55D6;
  --tape-fiati: #0F8B8D;
  --tape-archi: #8B6B4A;
  --tape-ink: #18202D;
  --tape-ink-light: #FFFFFF;

  /* stato degli allievi */
  --st-band: #1C2B4A;
  --st-decidere: #F08C00;
  --st-collocare: #D6336C;
  --st-escluso: #B3BAC5;

  --load-warn: #F08C00;
  --load-high: #D6336C;
  --focus: #2F6FDB;
  --hilite: #FFF3C4;
  --hilite-line: #E8B400;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow-pop: 0 10px 30px rgba(24, 32, 45, .18), 0 2px 6px rgba(24, 32, 45, .08);
  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --floor: #11151B;
    --surface: #1A2029;
    --surface-2: #212833;
    --ink: #E8ECF2;
    --ink-2: #B4BDCA;
    --muted: #8892A1;
    --line: #2C3441;
    --line-strong: #3C4655;
    --tape-voce: #E9B92A;
    --tape-chitarra: #E5604B;
    --tape-basso: #4D86EA;
    --tape-batteria: #2AAE70;
    --tape-tastiere: #9C6BE0;
    --tape-fiati: #1FA3A5;
    --tape-archi: #A8865F;
    --st-band: #8FB4FF;
    --st-decidere: #FFA62B;
    --st-collocare: #F0609A;
    --st-escluso: #4A5361;
    --hilite: #3A3418;
    --hilite-line: #C9A21E;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
    --floor: #11151B;
    --surface: #1A2029;
    --surface-2: #212833;
    --ink: #E8ECF2;
    --ink-2: #B4BDCA;
    --muted: #8892A1;
    --line: #2C3441;
    --line-strong: #3C4655;
    --tape-voce: #E9B92A;
    --tape-chitarra: #E5604B;
    --tape-basso: #4D86EA;
    --tape-batteria: #2AAE70;
    --tape-tastiere: #9C6BE0;
    --tape-fiati: #1FA3A5;
    --tape-archi: #A8865F;
    --st-band: #8FB4FF;
    --st-decidere: #FFA62B;
    --st-collocare: #F0609A;
    --st-escluso: #4A5361;
    --hilite: #3A3418;
    --hilite-line: #C9A21E;
    --shadow-pop: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--floor);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  font-stretch: 100%;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- controlli di base */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 7px 12px;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  min-height: 36px;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.btn.danger { color: var(--load-high); border-color: color-mix(in srgb, var(--load-high) 40%, var(--line)); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { min-height: 30px; padding: 4px 9px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.icon-btn {
  border: 0; background: transparent; width: 34px; height: 34px; border-radius: var(--radius);
  display: inline-grid; place-items: center; color: var(--ink-2);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

input[type="text"], input[type="search"], input[type="number"], input[type="email"], input[type="password"], input[type="date"], select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 8px 10px;
  min-height: 38px;
}
textarea { min-height: 70px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error { color: var(--load-high); font-weight: 600; margin: 6px 0 0; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(360px, 100%); display: grid; gap: 24px; }
.login-form { display: grid; gap: 10px; background: var(--surface); padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--line); }
.login-form label { font-weight: 600; }

.login-alt { margin: 0; font-size: 14px; color: var(--ink-2); text-align: center; }
.login-alt a { font-weight: 700; color: var(--ink); }
.login-admin { margin: 8px 0 0; text-align: center; }
.login-admin a {
  display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--muted); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 12px;
}
.login-admin a:hover { color: var(--ink); border-color: var(--ink-2); }

/* ---------- campi bloccati */
.lock-ico { display: inline-block; width: 13px; height: 13px; vertical-align: -1px; margin-left: 4px; color: var(--ink-2); }
.tape .lock-ico { color: inherit; width: 11px; height: 11px; margin-left: 5px; }
.song-title .lock-ico { width: 15px; height: 15px; vertical-align: 1px; }
.slot.locked { border-style: dotted; cursor: default; }
.slot.locked:hover { border-style: dotted; }
div.field { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.field-head label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
div.field .hint { font-weight: 500; }
.lock-btn {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); height: 28px; padding: 0 8px;
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--muted);
}
.lock-btn svg { width: 14px; height: 14px; }
.lock-btn[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.lock-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.lock-tag svg { width: 13px; height: 13px; }
.field input:disabled, .field textarea:disabled { background: var(--surface-2); color: var(--ink-2); }
.stepper button:disabled { opacity: .35; cursor: not-allowed; }
.login-form .field input { font-weight: 500; color: var(--ink); }
ul.form-error { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.kind-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kind-pick legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.kind { display: block; cursor: pointer; }
.kind input { position: absolute; opacity: 0; pointer-events: none; }
.kind span { display: block; border: 1.5px solid var(--line-strong); border-radius: var(--radius); padding: 10px 12px; font-weight: 750; line-height: 1.25; }
.kind span small { display: block; font-weight: 500; color: var(--muted); margin-top: 2px; }
.kind input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; background: var(--surface-2); }
.kind input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.login:has(.kind-pick) { width: min(460px, 100%); }
.kind-pick-3 { grid-template-columns: repeat(3, 1fr); }
.kind-pick-3 .kind span { text-align: center; padding: 10px 6px; }
.rec-msg { font-size: 13.5px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 8px 10px; white-space: pre-wrap; user-select: all; }
.rec-contact { font-weight: 700; user-select: all; }

/* ---------- pagina dell'allievo */
.student-turn { display: flex; gap: 10px; align-items: center; margin: 0 0 12px; font-size: 17px; }
.student-h3 { font-stretch: 80%; font-weight: 800; font-size: 18px; margin: 18px 0 6px; }
.student-order { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 2px; }
.student-order .me { font-weight: 800; }
.student-main { padding: 16px 16px 48px; max-width: 1100px; margin: 0 auto; display: grid; gap: 12px; }
.student-hello { margin: 0; font-stretch: 70%; font-weight: 850; font-size: 30px; line-height: 1.05; }
.student-h { margin: 6px 0 0; font-stretch: 75%; font-weight: 800; font-size: 20px; }
.student-teachers { margin: 0; color: var(--ink-2); }
.student-empty { margin: 0; color: var(--ink-2); max-width: 60ch; }
.student-account { margin-top: 12px; }

/* ---------- account */
.acc-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 10px 12px; display: grid; gap: 8px; }
.acc-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.acc-head b { font-size: 15px; }
.acc-kind { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 8px; background: var(--surface-2); border: 1px solid var(--line); }
.acc-match { font-size: 13px; font-weight: 700; }
.acc-match.certo { color: var(--st-band); }
.acc-match.dubbio { color: var(--load-warn); }
.acc-match.nessuno { color: var(--load-high); }
.cand { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; background: var(--surface-2); border-radius: var(--radius); font-size: 13.5px; }
.cand .person-sub { margin: 0; }
.acc-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.acc-card.new { border-color: var(--hilite-line); background: color-mix(in srgb, var(--hilite) 45%, var(--surface)); }
.acc-next { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; font-weight: 700; margin-top: 4px; }
.acc-ok { color: var(--st-band); }
.acc-todo { color: var(--load-warn); }
.acc-list li { flex-wrap: wrap; }
.pw-show { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; font-weight: 700; letter-spacing: .04em; padding: 10px 12px; background: var(--hilite); border-radius: var(--radius); user-select: all; }
.badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--st-collocare); color: #fff; font-size: 11px; font-weight: 800; margin-left: 6px; }
.icon-btn.has-dot { position: relative; }
.icon-btn.has-dot::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--st-collocare); }

/* ---------- testata */
.wordmark {
  font-stretch: 62%; font-weight: 900; font-size: 30px; line-height: 1; letter-spacing: .005em;
  display: flex; align-items: baseline; gap: 8px;
}
.wordmark span { font-stretch: 100%; font-weight: 500; font-size: 13px; color: var(--muted); letter-spacing: 0; }

.top {
  position: relative; z-index: 20;
  background: color-mix(in srgb, var(--floor) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.top-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px 6px; flex-wrap: wrap; }
.top-row .grow { flex: 1; }
.top select { width: auto; min-height: 34px; padding: 4px 8px; font-weight: 600; max-width: 46vw; }
.me-select { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.me-btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: 6px 10px; font-size: 13px; color: var(--ink-2); min-height: 34px; }
.me-btn b { color: var(--ink); }
.demo-flag {
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  border: 1px dashed var(--line-strong); border-radius: 999px; padding: 2px 8px;
}

/* ---------- il misuratore: una luce per allievo */
.census { padding: 2px 16px 10px; }
.meter {
  display: flex; gap: 2px; height: 16px; align-items: stretch; cursor: default;
}
.meter i {
  flex: 1 1 0; min-width: 1px; border-radius: 1.5px; display: block;
  background: var(--st-escluso);
}
.meter i.band { background: var(--st-band); }
.meter i.decidere { background: var(--st-decidere); }
.meter i.inserire { background: color-mix(in srgb, var(--st-band) 45%, var(--surface)); }
.meter i.collocare { background: var(--st-collocare); }
.meter i.escluso { background: var(--st-escluso); }
.meter i.dim { opacity: .25; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 7px; font-size: 13px; }
.legend button {
  border: 0; background: none; padding: 2px 0; display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2);
}
.legend button b { font-weight: 800; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend button[aria-pressed="true"] { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.band { background: var(--st-band); }
.dot.decidere { background: var(--st-decidere); }
.dot.inserire { background: transparent; border: 2px solid var(--st-band); }
.dot.collocare { background: var(--st-collocare); }
.dot.escluso { background: var(--st-escluso); }
.dot.docente { background: transparent; border: 2px solid var(--ink-2); }
.dot.fuori { background: transparent; border: 1px dashed var(--muted); }
.dot.inattivo { background: transparent; border: 1px dotted var(--line-strong); }

/* ---------- invito a installare */
.install-bar {
  display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding: 6px 4px 6px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); font-size: 13.5px; line-height: 1.3;
}
.install-bar span { flex: 1; }
.steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

/* ---------- schede */
.tabs { display: flex; gap: 4px; padding: 0 12px; }
.tabs button {
  border: 0; background: none; padding: 9px 10px 8px; font-weight: 700; color: var(--muted);
  border-bottom: 3px solid transparent; font-stretch: 85%; font-size: 16px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs .count { font-weight: 500; font-size: 13px; margin-left: 3px; color: var(--muted); }

/* ---------- impaginazione */
.layout { display: block; }
.panel { min-width: 0; }
.panel-people { display: none; }
.panel-main { padding: 12px 12px calc(96px + var(--safe-b)); }
.layout[data-view="allievi"] .panel-people { display: block; }
.layout[data-view="allievi"] .panel-main { display: none; }

@media (min-width: 980px) {
  .tabs .tab-allievi { display: none; }
  .layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); align-items: start; }
  .layout .panel-people, .layout[data-view="allievi"] .panel-people { display: block; position: sticky; top: var(--top-h, 120px); height: calc(100vh - var(--top-h, 120px)); overflow: auto; border-right: 1px solid var(--line); }
  .layout .panel-main, .layout[data-view="allievi"] .panel-main { display: block; padding: 16px 20px 96px; }
}

/* ---------- elenco allievi */
.people-tools { padding: 12px 12px 8px; display: grid; gap: 8px; background: var(--floor); }
@media (min-width: 980px) {
  .top { position: sticky; top: env(safe-area-inset-top, 0px); }
  .tabs { padding-left: 352px; }
  .people-tools { position: sticky; top: 0; z-index: 2; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-filter {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: 4px 10px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-height: 30px;
}
.chip-filter[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chip-filter[aria-pressed="true"] .dot.docente { border-color: var(--surface); }
.people-list { list-style: none; margin: 0; padding: 0 0 12px; }
.person-row {
  display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center;
  padding: 9px 14px; border-bottom: 1px solid var(--line); background: transparent;
  width: 100%; text-align: left; border-left: 0; border-right: 0; border-top: 0;
}
.person-row:hover { background: var(--surface); }
.person-row[draggable="true"] { cursor: grab; }
.person-row.selected { background: var(--hilite); }
.person-name { font-weight: 650; line-height: 1.25; }
.person-name small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.person-sub { display: block; font-size: 12.5px; color: var(--muted); line-height: 1.3; margin-top: 1px; }
.person-right { font-size: 12.5px; color: var(--ink-2); text-align: right; white-space: nowrap; }
.load { font-weight: 800; font-variant-numeric: tabular-nums; }
.load.warn { color: var(--load-warn); }
.load.high { color: var(--load-high); }
.people-empty { padding: 24px 16px; color: var(--muted); }
.people-foot { padding: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.notice {
  margin: 4px 12px 8px; padding: 9px 12px; border-radius: var(--radius); font-size: 13.5px;
  background: var(--surface); border: 1px solid var(--line); display: flex; gap: 10px; align-items: center; justify-content: space-between;
}

/* ---------- barra brani */
.main-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.main-tools input[type="search"] { flex: 1 1 100%; }
@media (min-width: 640px) { .main-tools input[type="search"] { flex: 1 1 200px; max-width: 360px; } }

/* ---------- il foglio di scaletta: un brano */
.songs { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; align-items: start; }
.song {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px 12px 10px; position: relative; scroll-margin-top: 12px;
}
.song.hit { border-color: var(--hilite-line); box-shadow: 0 0 0 2px var(--hilite-line) inset; }
.song.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--hilite); } to { background: var(--surface); } }
.song-head { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; }
.song-pos {
  font-stretch: 62%; font-weight: 900; font-size: 26px; line-height: .95; color: var(--muted);
  font-variant-numeric: tabular-nums; min-width: 22px;
}
.song-title { font-stretch: 70%; font-weight: 800; font-size: 22px; line-height: 1.05; margin: 0; overflow-wrap: anywhere; }
.song-meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.song-meta a { color: var(--ink-2); }
.song-warn { font-size: 12.5px; font-weight: 700; color: var(--load-high); margin-top: 3px; }
.song-notes { font-size: 12.5px; color: var(--ink-2); margin: 8px 0 0; padding-left: 8px; border-left: 2px solid var(--line-strong); }

.roles { margin-top: 10px; display: grid; gap: 6px; }
.role {
  display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: start;
  border-radius: var(--radius); padding: 2px; margin: -2px;
}
.role.drop-over { background: var(--hilite); outline: 2px dashed var(--hilite-line); }
.role.inactive { opacity: .55; }
.role.suggest .tape { box-shadow: 0 0 0 2px var(--ink); }
.tape {
  font-stretch: 78%; font-weight: 750; font-size: 12.5px; line-height: 1;
  padding: 6px 7px 5px; border-radius: 2px; color: var(--tape-ink);
  transform: rotate(-.6deg); align-self: start; text-align: left; white-space: nowrap;
}
.role:nth-child(even) .tape { transform: rotate(.5deg); }
.tape.voce { background: var(--tape-voce); }
.tape.chitarra { background: var(--tape-chitarra); color: var(--tape-ink-light); }
.tape.basso { background: var(--tape-basso); color: var(--tape-ink-light); }
.tape.batteria { background: var(--tape-batteria); color: var(--tape-ink-light); }
.tape.tastiere { background: var(--tape-tastiere); color: var(--tape-ink-light); }
.tape.fiati { background: var(--tape-fiati); color: var(--tape-ink-light); }
.tape.archi { background: var(--tape-archi); color: var(--tape-ink-light); }
.role-people { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; min-height: 26px; }
.pchip {
  display: inline-flex; align-items: center; gap: 0; border: 1px solid var(--line-strong);
  background: var(--surface-2); border-radius: 999px; font-size: 13px; line-height: 1.2; max-width: 100%;
}
.pchip .pchip-name { border: 0; background: none; padding: 3px 4px 3px 9px; font-weight: 600; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip .pchip-x { border: 0; background: none; padding: 3px 8px 3px 3px; color: var(--muted); font-size: 15px; line-height: 1; }
.pchip .pchip-x:hover { color: var(--load-high); }
.pchip.warn { border-color: var(--load-warn); }
.pchip.high { border-color: var(--load-high); border-width: 1.5px; }
.pchip.teacher { border-style: dashed; background: transparent; }
.pchip.hit { background: var(--hilite); border-color: var(--hilite-line); }
.pchip sup { font-size: 10px; font-weight: 800; margin-left: 2px; }
.pchip.warn sup { color: var(--load-warn); }
.pchip.high sup { color: var(--load-high); }
.add-btn {
  border: 1px dashed var(--line-strong); background: transparent; border-radius: 999px;
  min-width: 28px; height: 26px; padding: 0 8px; color: var(--muted); font-size: 13px; font-weight: 700;
}
.add-btn:hover { color: var(--ink); border-color: var(--ink-2); }
.add-btn.assign { border-style: solid; border-color: var(--ink); color: var(--ink); background: var(--hilite); }
/* posti liberi della formazione */
.slot {
  border: 1.5px dashed var(--line-strong); background: transparent; border-radius: 999px;
  height: 26px; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--muted);
}
.slot.req { border-color: var(--load-high); color: var(--load-high); }
.slot:hover { border-style: solid; }
.slot.assign { border-style: solid; border-color: var(--ink); color: var(--ink); background: var(--hilite); font-weight: 750; }
.role-over { font-size: 12px; font-weight: 700; color: var(--load-warn); }
.lineup-note { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }
.lineup-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.lineup-table th, .lineup-table td { padding: 5px 4px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 600; }
.lineup-table thead th { font-size: 12.5px; color: var(--muted); }
.lineup-table tbody th { font-weight: 600; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.stepper button { border: 0; background: var(--surface-2); width: 34px; height: 34px; font-size: 18px; line-height: 1; color: var(--ink); }
.stepper button:hover { background: var(--line); }
.stepper output { min-width: 30px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.demo-flag select { width: auto; min-height: 26px; padding: 0 4px; border: 0; background: transparent; font-weight: 700; }

/* ---------- barra di assegnazione */
.assign-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-b)); z-index: 40;
  background: var(--ink); color: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 16px; max-width: 760px; margin: 0 auto;
}
.assign-bar .grow { flex: 1; font-size: 14px; line-height: 1.3; }
.assign-bar b { font-weight: 800; }
.assign-bar .btn { background: var(--surface); color: var(--ink); border-color: var(--surface); }

/* ---------- toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + var(--safe-b)); z-index: 60;
  background: var(--ink); color: var(--surface); border-radius: var(--radius); padding: 10px 12px 10px 14px;
  display: flex; gap: 12px; align-items: center; box-shadow: var(--shadow-pop); font-size: 14px; max-width: calc(100vw - 24px);
}
.toast button { background: none; border: 0; color: var(--tape-voce); font-weight: 800; padding: 2px 4px; }
.toast.error { background: var(--load-high); }

/* ---------- finestre */
dialog {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink);
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: rgba(17, 21, 27, .45); }
.dlg { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.dlg-head { display: flex; align-items: start; gap: 10px; padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { margin: 0; font-stretch: 72%; font-weight: 850; font-size: 24px; line-height: 1.05; flex: 1; }
.dlg-head .sub { font-size: 13px; color: var(--muted); margin-top: 3px; font-stretch: 100%; font-weight: 500; }
.dlg-body { padding: 14px 16px; overflow: auto; display: grid; gap: 14px; }
.dlg-foot { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dlg-foot .grow { flex: 1; }
@media (max-width: 640px) {
  dialog { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; }
  .dlg { max-height: 92vh; }
}
.section-title { font-stretch: 80%; font-weight: 800; font-size: 16px; margin: 0 0 6px; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice button {
  border: 1.5px solid var(--line-strong); background: var(--surface); border-radius: var(--radius);
  padding: 12px; text-align: left; font-weight: 700; line-height: 1.25;
}
.choice button small { display: block; font-weight: 500; color: var(--muted); margin-top: 3px; }
.choice button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink) inset; }
.reasons { display: grid; gap: 6px; }
.reason {
  display: flex; gap: 10px; align-items: center; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer;
}
.reason:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }
.reason input { width: 18px; height: 18px; margin: 0; accent-color: var(--ink); }
.status-line { display: flex; gap: 8px; align-items: center; font-weight: 700; }
.mysongs { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mysongs li { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 7px 10px; background: var(--surface-2); border-radius: var(--radius); }
button.link { border: 0; background: none; padding: 0; font: inherit; color: inherit; font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 0; }
.also-in { margin: 0; color: var(--ink-2); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 10px 0 0; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.tape-mini { font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 2px; font-stretch: 80%; }
details.more summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
details.more[open] summary { margin-bottom: 10px; }
.link-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.link-form select, .link-form input[type="text"] { flex: 1 1 150px; width: auto; }
.group-title { margin: 10px 0 4px; font-weight: 800; font-size: 14px; }
.group-title .hint { font-weight: 600; margin-left: 4px; }
.pick-row { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-row input { width: 18px; height: 18px; accent-color: var(--ink); margin: 0; }
.pick-row.done { opacity: .6; cursor: default; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.check input { width: 18px; height: 18px; accent-color: var(--ink); }
.teacher-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.teacher-picks label { border: 1px solid var(--line-strong); border-radius: 999px; padding: 4px 10px; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.teacher-picks label:has(input:checked) { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.teacher-picks input { display: none; }
.role-checks { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }

.picker-list { list-style: none; margin: 0; padding: 0; }
.picker-list li button {
  width: 100%; display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; text-align: left;
  padding: 9px 4px; border: 0; border-bottom: 1px solid var(--line); background: none;
}
.picker-list li button:hover { background: var(--surface-2); }
.picker-group { font-size: 12.5px; font-weight: 700; color: var(--muted); padding: 10px 4px 4px; }

.menu-list { display: grid; gap: 2px; }
.menu-list button { border: 0; background: none; text-align: left; padding: 11px 6px; border-radius: var(--radius); font-weight: 600; }
.menu-list button:hover { background: var(--surface-2); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; width: 100%; }

.map-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.map-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.map-table td:first-child { font-weight: 700; width: 42%; }
.preview { font-size: 12.5px; color: var(--muted); }

/* ---------- legami */
.links { display: grid; gap: 16px; max-width: 1100px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; }
.card h3 { margin: 0 0 4px; font-stretch: 72%; font-weight: 850; font-size: 22px; line-height: 1.1; }
.card .lead { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.big-figure { display: flex; gap: 18px; flex-wrap: wrap; margin: 6px 0 12px; }
.big-figure div { display: grid; }
.big-figure strong { font-stretch: 62%; font-weight: 900; font-size: 44px; line-height: 1; font-variant-numeric: tabular-nums; }
.big-figure span { font-size: 13px; color: var(--muted); }
.graph-wrap { position: relative; }
.graph { width: 100%; height: auto; display: block; touch-action: manipulation; }
.graph line { stroke: var(--line-strong); }
.graph line.on { stroke: var(--ink); }
.graph circle { stroke: var(--surface); stroke-width: 2; cursor: pointer; }
.graph circle.on { stroke: var(--ink); stroke-width: 3; }
.graph circle.off, .graph line.off { opacity: .2; }
.graph text { font-size: 11px; font-weight: 650; fill: var(--ink-2); pointer-events: none; font-stretch: 80%; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.graph text.off { opacity: .25; }
.graph-info { margin-top: 10px; font-size: 14px; min-height: 22px; }
.families { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.family { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; border-top-width: 4px; }
.family h4 { margin: 0 0 6px; font-size: 14px; font-weight: 800; }
.family ul { margin: 0; padding-left: 18px; font-size: 13.5px; }
.family .core { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }
.rhythm { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rhythm li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); font-size: 13.5px; }
.rhythm .pair { font-weight: 700; }
.rhythm .pair .tape-mini { margin-right: 4px; }
.rhythm .songs-of { color: var(--muted); font-size: 12.5px; }
.rhythm .n { font-stretch: 62%; font-weight: 900; font-size: 22px; line-height: 1; }
.top-people { columns: 2 220px; font-size: 13.5px; margin: 0; padding-left: 18px; }

.empty-state { padding: 40px 16px; text-align: center; color: var(--ink-2); display: grid; gap: 12px; justify-items: center; }

/* ---------- classica: programma dell'allievo */
.pieces { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; counter-reset: pc; }
.piece { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius); counter-increment: pc; }
.piece-main { min-width: 0; }
.piece-main::before { content: counter(pc) "."; font-weight: 800; color: var(--muted); margin-right: 6px; font-variant-numeric: tabular-nums; }
.piece-title { font-weight: 700; overflow-wrap: anywhere; }
.piece-by { color: var(--ink-2); margin-left: 6px; }
.piece-by::before { content: "· "; color: var(--muted); }
.piece-dur { color: var(--muted); margin-left: 6px; font-variant-numeric: tabular-nums; font-size: 13px; }
.piece-sub { margin-top: 4px; font-size: 13px; color: var(--ink-2); }
.acc-line { display: inline-flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 13px; color: var(--ink-2); }
.acc-line .btn.small { margin-left: 2px; }
.acc-chip { display: inline-block; font-size: 12px; font-weight: 650; padding: 1px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); margin-left: 4px; white-space: nowrap; }
.acc-chip.todo { color: var(--st-collocare); border-color: color-mix(in srgb, var(--st-collocare) 45%, transparent); background: transparent; }

/* ---------- classica: turni */
.turns-summary { margin: 0; color: var(--ink-2); font-size: 14px; }
.turns { display: grid; gap: 14px; }
.turn { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px 14px; }
.turn.unplaced { margin-top: 14px; background: transparent; border-style: dashed; border-color: var(--line-strong); }
.turn-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.turn-head h3 { margin: 0; font-stretch: 70%; font-weight: 850; font-size: 24px; line-height: 1.05; }
.turn-time { font-weight: 800; font-variant-numeric: tabular-nums; background: var(--ink); color: var(--surface); border-radius: 3px; padding: 2px 7px; font-size: 14px; transform: rotate(-.6deg); }
.turn-meta { color: var(--muted); font-size: 13px; flex: 1; }
.turn-head .icon-btn { align-self: center; }
.turn-list { list-style: none; margin: 8px 0 0; padding: 0; }
.turn-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: start; padding: 9px 0; border-top: 1px solid var(--line); }
.turn-row:first-child { border-top: 0; }
.turn-row.hit { background: var(--hilite); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: var(--radius); }
.turn-n { font-stretch: 62%; font-weight: 900; font-size: 24px; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.turn-who > .link { font-size: 16px; }
.turn-pieces { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; }
.turn-pieces .piece-title { font-weight: 600; }
.turn-dur { font-size: 13px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; padding-top: 2px; }
.turn-ctl { display: flex; gap: 2px; }
.turn-ctl .icon-btn { width: 34px; height: 34px; }
.turn-ctl .icon-btn:disabled { opacity: .3; }
@media (max-width: 560px) {
  .turn-row { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .turn-ctl { grid-column: 2 / -1; justify-content: flex-end; }
}

/* ---------- classica: accompagnamenti */
.req-group { margin-bottom: 16px; }
.req-group .group-title { font-size: 16px; margin: 0 0 6px; }
.req-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.req-item { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--st-band); border-radius: var(--radius); padding: 9px 12px; }
.req-item.todo { border-left-color: var(--st-collocare); }
.req-item .person-sub { margin: 2px 0 4px; }
.dlg-body .req-item { background: var(--surface-2); }
.badge-soft { font-size: 11.5px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-left: 4px; vertical-align: 1px; }
.picker-list button[aria-current="true"] { background: var(--hilite); }
.check-list { list-style: none; margin: 0; padding: 0; display: grid; }
.check-list li { border-bottom: 1px solid var(--line); }
.check-list .check { display: flex; gap: 10px; align-items: center; padding: 9px 2px; cursor: pointer; }

/* ---------- strumenti di studio */
.instr-list { list-style: none; margin: 0; padding: 0; display: grid; }
.instr-row { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; text-align: left; padding: 9px 4px; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.instr-row:hover { background: var(--surface-2); }
.instr-name { font-weight: 700; }
.instr-fam .tape-mini { transform: rotate(-.6deg); display: inline-block; }
.instr-new { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-strong); }
.instr-del { margin-top: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
@media (max-width: 520px) { .instr-row { grid-template-columns: minmax(0, 1fr) auto; } .instr-row .person-right { grid-column: 1 / -1; text-align: left; } }

/* ---------- stampa */
@media (min-width: 980px) { .song { scroll-margin-top: calc(var(--top-h, 120px) + 12px); } }
@media print {
  body { background: #fff; color: #000; font-size: 11px; }
  .top, .panel-people, .main-tools, .assign-bar, .toast, .add-btn, .pchip-x, .icon-btn, .tabs { display: none !important; }
  .turn-ctl, .turn .btn, .acc-line .btn, .turn.unplaced { display: none !important; }
  .turns { gap: 8px; }
  .turn { break-inside: avoid; border: 1px solid #999; padding: 6px 8px; }
  .turn-time { background: none; color: #000; border: 1px solid #000; }
  .acc-chip { border: 0; padding: 0; }
  .layout { display: block !important; }
  .panel-main { padding: 0 !important; display: block !important; }
  .songs { grid-template-columns: 1fr 1fr; gap: 6px; }
  .song { break-inside: avoid; border: 1px solid #999; padding: 6px 8px; }
  .song.hit { box-shadow: none; }
  .tape { transform: none !important; border: 1px solid #000; background: #fff !important; color: #000 !important; }
  .pchip { border: 0; background: none; }
  .print-title { display: block !important; font-size: 18px; font-weight: 800; margin-bottom: 8px; }
}
.print-title { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
.acc-line .acc-todo { color: var(--st-collocare); font-weight: 700; }
.add-tools { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 8px; }
/* ---------- abbina per corso */
.mc-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mc-tools select, .mc-tools input[type="search"] { flex: 1 1 180px; width: auto; }
.mc-group { margin-top: 6px; }
.mc-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; padding: 8px 0 4px; border-bottom: 2px solid var(--ink); position: sticky; top: -1px; background: var(--surface); z-index: 1; }
.mc-head h3 { margin: 0; font-stretch: 75%; font-weight: 850; font-size: 19px; }
.mc-all { margin-left: auto; display: flex; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; }
.mc-all select { width: auto; max-width: 200px; padding-top: 4px; padding-bottom: 4px; }
.mc-list { list-style: none; margin: 0; padding: 0; }
.mc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 170px) minmax(140px, 200px); gap: 8px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mc-row.done { grid-template-columns: minmax(0, 1fr) auto auto; }
.mc-row select { width: 100%; padding-top: 5px; padding-bottom: 5px; }
.mc-ok { font-size: 13.5px; color: var(--st-band); }
@media (max-width: 560px) {
  .mc-row { grid-template-columns: 1fr 1fr; }
  .mc-row .mc-who { grid-column: 1 / -1; }
  .mc-row.done { grid-template-columns: 1fr auto; }
  .mc-all { margin-left: 0; width: 100%; }
  .mc-all select { flex: 1; max-width: none; }
}
.imp-summary { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; }
.imp-summary ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 4px; }
@media (min-width: 641px) { dialog.wide { width: min(880px, calc(100vw - 40px)); max-width: none; } }
.ro-banner { margin: 0; padding: 9px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ro-banner::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--muted); }
.played { display: block; font-size: 12.5px; color: var(--load-warn); font-weight: 650; margin-top: 3px; }

/* avviso ai docenti: chi partecipa al saggio */
.pend-head h2 { font-size: 28px; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--st-decidere); }
.pend-bulk { display: flex; gap: 8px; flex-wrap: wrap; }
.pend-list { list-style: none; margin: 0; padding: 0; display: grid; }
.pend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pend-row.err .pend-why select, .pend-row.err .pend-why input { border-color: var(--load-high); box-shadow: 0 0 0 1px var(--load-high) inset; }
.pend-why { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }
.pend-why select { flex: 1 1 200px; width: auto; }
.pend-why input { flex: 2 1 200px; width: auto; }
.seg { display: inline-flex; border: 1px solid var(--line-2, var(--line)); border-radius: 999px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 700; padding: 7px 12px; cursor: pointer; min-height: 36px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[data-v="in"][aria-pressed="true"] { background: var(--st-band); color: var(--surface); }
.seg button[data-v="out"][aria-pressed="true"] { background: var(--ink-2); color: var(--surface); }
.pend-count { font-size: 13px; color: var(--muted); align-self: center; }
@media (max-width: 480px) {
  .pend-row { grid-template-columns: 1fr; }
  .seg { justify-self: start; }
}
