@font-face {
  font-family: Montserrat;
  src: url("assets/montserrat-regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: Montserrat, "Avenir Next", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  scroll-padding-block-start: var(--masthead-offset, 88px);
  scroll-padding-block-end: var(--workflow-footer-size, 0px);
  color: #fff;
  background: #0a1020;
  --accent: #bd0a0a;
  --muted: #c6cede;
  --line: rgb(255 255 255 / 20%);
  --glass: rgb(255 255 255 / 5%);
  --glass-active: rgb(255 255 255 / 12%);
  --field: rgb(6 13 29 / 54%);
  --error: #ffaaaa;
  --success: #a7e4c2;
  --radius-pill: 1000px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 52rem 36rem at 24% 40px, rgb(41 97 195 / 40%), transparent 75%),
    radial-gradient(ellipse 45rem 34rem at 87% 84%, rgb(100 49 136 / 25%), transparent 76%);
}
.shell { width: min(1180px, calc(100% - clamp(24px, 8vw, 100px))); margin-inline: auto; }
.masthead { position: sticky; top: 0; z-index: 3; background: rgb(10 16 32 / 94%); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 65px; display: flex; align-items: start; gap: 16px; padding-block: 10px; }
.masthead-brand { min-height: 44px; display: flex; align-items: center; gap: 12px; }
.masthead-logo { display: block; flex: none; width: clamp(88px, 16vw, 112px); height: auto; }
.masthead-label { border-left: 1px solid var(--line); padding-left: 12px; }
.masthead-nav { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; border: 1px solid var(--line); border-radius: 22px; padding: 3px; }
.masthead-nav button {
  color: var(--muted); background: transparent; border: 0; border-radius: var(--radius-pill);
  min-height: 36px; padding: 7px 12px;
}
.masthead-nav button:disabled { opacity: .46; }
.masthead-nav button:not(:disabled):hover, .masthead-nav [aria-current=page] {
  color: #fff; background: var(--glass-active);
}
.masthead-nav [aria-current=page] { box-shadow: inset 0 -2px var(--accent); }
.masthead-nav :focus-visible { outline-offset: -2px; }
main { padding-block: clamp(24px, 4vw, 46px) 48px; }
.intro { margin-bottom: clamp(20px, 3vw, 32px); }
h1, h2, h3, p { margin: 0; }
:where(h1, h2, h3, p, label, button, summary) { overflow-wrap: anywhere; }
h1 {
  width: fit-content; padding: 0 3px 8px 0; border-bottom: 2px solid var(--accent);
  font-size: clamp(28px, 3.6vw, 44px); font-weight: 400; line-height: 1.23;
}
.intro p { color: var(--muted); margin-top: 12px; }
.workspace, .result-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.22fr); gap: 20px; align-items: start; }
.panel { min-width: 0; background: var(--glass); border: 1px solid var(--line); border-radius: 24px; padding: clamp(16px, 3vw, 28px); backdrop-filter: blur(5px); }
h2 { font-size: 24px; line-height: 1.25; font-weight: 400; }
.panel > h2 + p { margin-top: 8px; color: var(--muted); }
.panel > p + form { margin-top: 20px; }
label { display: block; min-width: 0; font-size: 14px; font-weight: 600; }
.upload-group { margin-bottom: 18px; }
input, select, button { font: inherit; }
input:not([type=checkbox]), select {
  display: block; width: 100%; min-width: 0; min-height: 46px; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 14px; padding: 11px 14px;
  line-height: 1.4; background: var(--field); color: inherit;
}
select {
  appearance: none; padding-inline-end: 36px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-size: 5px 5px; background-position: right 18px center, right 13px center; background-repeat: no-repeat;
}
select:enabled { cursor: pointer; }
select option { background: #182239; color: #fff; }
@media (forced-colors: active) {
  select { appearance: auto; background-image: none; padding-inline-end: 14px; }
}
input[type=file] { padding: 5px; overflow: hidden; font-size: 13px; }
input[type=file]::file-selector-button {
  border: 1px solid var(--line); padding: 7px 10px; margin-right: 8px; border-radius: 10px;
  background: var(--glass-active); color: #fff; font: inherit; cursor: pointer;
}
input::placeholder { color: var(--muted); opacity: 1; }
.field-status { display: block; color: var(--muted); font-size: 12px; font-weight: 400; line-height: 1.45; margin-top: 6px; overflow-wrap: anywhere; }
.field-status:empty { display: none; }
.loading-status { margin-block: 0; padding-block-end: 8px; }
[data-state=caricamento]::before, button[aria-busy=true]::after {
  content: ""; display: inline-block; flex: none; width: .9em; height: .9em; margin-inline-end: .5em;
  border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%;
  vertical-align: -.1em; animation: loading .75s linear infinite;
}
button[aria-busy=true]::after { margin-inline: .5em 0; }
@keyframes loading { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
  [data-state=caricamento]::before, button[aria-busy=true]::after { animation: none; }
}
.field-status[data-state=errore] { color: var(--error); }
.field-status[data-state=ok] { color: var(--success); }
.relations { border-top: 1px solid var(--line); padding-top: 18px; }
.inline-heading { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.text-button { color: #fff; background: transparent; padding: 0; border: none; text-decoration: underline; text-underline-offset: 4px; font-size: 12px; }
.text-button:hover:not(:disabled) { text-decoration-color: #ff8b8b; }
#rimuovi-parentele { margin-top: 7px; }
.checkbox { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; font-size: 13px; line-height: 1.4; font-weight: 500; }
.checkbox input { flex: 0 0 16px; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.event-disciplines { margin-top: 20px; }
.event-summary { margin: 16px 0 0; }
.event-summary dt { color: var(--muted); font-size: 13px; }
.event-summary dd { margin: 3px 0 0; overflow-wrap: anywhere; }
#avviso-numero-giudici[data-state=errore] {
  width: fit-content; margin-top: 10px; padding: 8px 12px; border: 1px solid rgb(255 170 170 / 38%);
  border-radius: 12px; background: rgb(189 10 10 / 13%); font-size: 13px;
}
#numero-giudici[aria-invalid=true] { border-color: var(--error); }
.staff-quantities { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.staff-quantities label { font-size: 12px; display: flex; flex-direction: column; justify-content: flex-end; }
.staff-quantities input { min-height: 40px; padding: 8px 10px; }
.rules { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; padding: 13px 15px; margin-block: 20px; }
.rules h3 { font-size: 13px; }
.rules ul { margin: 5px 0 0; padding-left: 17px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.rules li + li { margin-top: 3px; }
.relations .rules { margin-block: 0 16px; }
#vai-estrazione { margin-top: 20px; }
.primary, .secondary {
  border: 1px solid var(--line); border-radius: var(--radius-pill); color: #fff;
  padding: 11px 18px; min-width: 0; max-width: 100%; min-height: 44px; font-size: 14px;
}
.primary { width: 100%; display: flex; justify-content: space-between; align-items: center; text-align: start; background: var(--glass-active); }
.primary span { margin-left: 5px; font-family: system-ui, sans-serif; font-size: 18px; line-height: 1; }
.primary:hover:not(:disabled) { background: rgb(255 255 255 / 19%); border-color: rgb(255 255 255 / 40%); }
.primary:disabled { background: var(--glass); color: var(--muted); }
.secondary { background: rgb(0 0 0 / 14%); }
.secondary:hover:not(:disabled) { background: var(--glass-active); }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 2px solid #a6c9ff; outline-offset: 3px; }
h1[tabindex="-1"]:focus { outline: none; }
#evento, .step-actions { margin-top: 16px; }
.results-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 16px; }
.result-picker { max-width: 490px; margin-bottom: 16px; }
.result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-event { margin-bottom: 14px; }
#copertura-staff[data-state=incompleto] { color: #ffc889; }
.result-card { padding: 19px 21px; min-width: 0; }
.result-card h3 { font-size: 18px; font-weight: 400; }
.result-card ol { margin: 6px 0 0; padding: 0; list-style: none; counter-reset: pos; }
.result-card li { counter-increment: pos; display: grid; grid-template-columns: 25px minmax(0, 1fr); gap: 3px 4px; align-items: baseline; padding-block: 10px; overflow-wrap: anywhere; }
.result-card li::before { content: counter(pos) "."; grid-column: 1; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.result-card li + li { border-top: 1px solid var(--line); }
.result-card li span { grid-column: 2; color: var(--muted); font-size: 13px; }
.confirmation-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-block: 16px; }
.confirmation-bar .primary { width: auto; }
.convocation-panel {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  color: inherit;
  background: #141d31;
}
.convocation-panel[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.convocation-panel::backdrop { background: rgb(5 10 24 / 78%); }
body:has(.convocation-panel[open]) { overflow: hidden; }
.convocation-header, .convocation-body { padding: clamp(16px, 3vw, 24px); }
.convocation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.convocation-header h2 { margin: 0; font-size: clamp(18px, 5vw, 24px); }
.convocation-header .secondary { flex: none; white-space: nowrap; }
.convocation-body { display: grid; gap: 12px; overflow: auto; overscroll-behavior: contain; }
.convocation-body .field-status, .convocation-body .button-group { margin: 0; }
.convocation-body .primary { width: auto; }
.convocation-panel summary { cursor: pointer; }
#indirizzi-convocazioni { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 12px; margin-top: 12px; }
#indirizzi-convocazioni input[aria-invalid=true] { border-color: var(--error); }
.audit-panel { margin-top: 24px; padding-block: 16px; }
.audit-panel > summary { cursor: pointer; font-size: 16px; }
.audit-panel > summary .field-status { display: inline; margin-left: 5px; }
.audit-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-block: 16px; }
.audit-list { max-height: 270px; overflow: auto; margin: 0; padding: 0; list-style: none; }
.audit-list li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.audit-list summary { cursor: pointer; }
.audit-list pre { color: var(--muted); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }

.workflow-footer { margin-top: 24px; }
.workflow-steps {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px;
  padding: 0; margin-block: 0; list-style: none;
}
.workflow-steps button {
  display: flex; align-items: center; gap: 7px; padding: 6px; border-radius: 12px;
  width: 100%; height: 100%; min-height: 36px; border: 0; background: transparent;
  text-align: start; font-size: 12px; color: var(--muted);
}
.workflow-steps button:disabled { opacity: .6; }
.workflow-steps button:enabled:hover { background: var(--glass-active); color: #fff; }
.workflow-steps .workflow-number {
  flex: 0 0 24px; display: grid; place-items: center; height: 24px;
  border: 1px solid var(--line); border-radius: 50%;
}
.workflow-steps [aria-current] { background: var(--glass-active); color: #fff; }
.workflow-steps [aria-current] .workflow-number { background: var(--accent); }
body:not([data-online]) .workflow-steps { width: 100%; }
.source-setup { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 17px 22px; }
.discipline-label { font-weight: 600; }
.discipline-picker { margin-top: 8px; border: 1px solid var(--line); border-radius: 14px; background: var(--field); }
.discipline-picker summary { padding: 11px 14px; min-height: 44px; cursor: pointer; }
.discipline-menu { border-top: 1px solid var(--line); padding: 12px; }
.discipline-menu .filter-values { margin-top: 8px; max-height: 230px; }
.discipline-tags:not(:empty) { margin-top: 8px; }
.eligibility { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; margin-top: 12px; font-size: 13px; }
.eligibility strong {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--glass-active); color: #fff; font-size: 12px; font-weight: 400;
}
.judge-source { margin: 19px 0 16px; padding: 12px 14px; background: var(--glass-active); border-radius: 16px; font-size: 14px; }
.judge-source button { margin-top: 6px; }
.data-panel { margin-top: 22px; }
.data-heading, .table-pagination, .filter-panel-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.button-group, .filter-toolbar, .filter-tags, .filter-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.button-group .primary { width: auto; gap: 10px; }
.filter-toolbar { margin-block: 18px 14px; align-items: end; gap: 10px 14px; }
.filter-toolbar label { flex: 0 1 300px; }
.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.active-filters > button { min-height: 42px; }
.filter-tag {
  border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 4px 10px;
  color: #fff; background: var(--glass-active); font-size: 12px;
}
.filter-tag::after { content: "×"; margin-left: 6px; }
.filter-panel { max-width: 580px; margin-bottom: 16px; border: 1px solid var(--line); padding: 16px; border-radius: 18px; background: var(--field); }
.filter-panel-heading { margin-bottom: 14px; }
.filter-panel h3 { font-size: 16px; font-weight: 400; }
.filter-actions { margin-block: 10px; gap: 4px 14px; }
.filter-actions button { min-height: 32px; }
.filter-actions button:disabled { opacity: .6; }
.filter-values { max-height: 175px; overflow: auto; }
.value-choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 8px; padding: 8px 6px;
  border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 500;
}
.value-choice input { margin: 3px 0 0; accent-color: var(--accent); }
.value-count { color: var(--muted); font-size: 12px; }
@media (pointer: coarse) {
  .value-choice { min-height: 44px; align-items: center; touch-action: manipulation; }
  .value-choice input { margin-block-start: 0; }
}
.table-wrap { overflow: auto; max-height: 390px; border: 1px solid var(--line); border-radius: 16px; background: var(--field); }
#tabella-giudici { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
#tabella-giudici th { position: sticky; top: 0; z-index: 1; background: #202c44; text-align: left; }
.table-filter {
  border: none; padding: 9px 11px; color: #fff; background: transparent;
  white-space: nowrap; text-align: left; width: 100%;
}
.table-filter::after { content: "▾"; margin-left: 6px; }
.table-filter:hover, .table-filter.is-filtered { background: var(--glass-active); }
.table-filter.is-filtered { box-shadow: inset 0 -2px var(--accent); }
#tabella-giudici td {
  padding: 8px 11px; border-top: 1px solid rgb(255 255 255 / 9%); white-space: nowrap;
  max-width: 235px; overflow: hidden; text-overflow: ellipsis;
}
#tabella-giudici tbody tr:nth-child(even) { background: var(--glass); }
.table-pagination { margin-top: 10px; }
.table-pagination button { padding: 6px 10px; min-height: 34px; font-size: 13px; }
.table-pagination button:disabled { opacity: .6; }

@media (max-width: 780px) {
  .masthead-inner { flex-wrap: wrap; gap: 8px; }
  .masthead-brand { width: 100%; min-height: 30px; }
  .masthead-nav { flex: 1 0 100%; }
  .workspace, .result-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .workflow-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .source-setup, .form-grid { grid-template-columns: 1fr; }
  .staff-quantities { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  input:not([type=checkbox], [type=file]), select { font-size: max(1em, 16px); }
  .masthead-nav button { flex: 1 1 auto; padding-inline: 8px; }
  h2 { font-size: 21px; }
}
