

body.page-newslist .form-container {
  max-width: 1120px;
  padding: 0 12px;
  margin: 12px auto 36px auto;
}

body {
  font-family: var(--font-primary);
  background: #fff;
  color: #222;
  margin: 0;
  padding: 0;
}

.container-newslist {
  max-width: 1180px;
  margin: 20px auto 48px auto;
  background: transparent;
  padding: 0 12px;
}

/* Page-specific header tweaks (merged) */
.header-newslist {
  padding-bottom: 12px;
  margin-bottom: 18px;
}
.header-newslist h1 {
  --fs-h1: clamp(2rem, 3.4vw, 3rem);
  font-size: var(--fs-h1);
  font-weight: 700;
  margin: 8px 0 6px;
  color: #121212;
}
.header-newslist .form-intro {
  color: #444;
  margin: 0 0 10px 8px;
}
.form-required-note {
  margin-left: 8px;
  color: var(--muted);
  font-size: var(--fs-small);
}

.section-newslist {
  /* removed border-top: markers will replace the divider */
  padding: 24px 0 0 0;
  margin-top: 28px;
  position: relative;
}
.section-newslist:first-of-type {
  margin-top: 6px;
}
.page-newslist .section-title {
  color: #121212;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: var(--fs-h2);
  margin-left: 8px;
}

/* Form subsection headings: semantic h3 with the blue page accent. */
body.page-newslist .section-newslist > .section-title {
  color: var(--blue-1, #214ecd);
  font-size: var(--fs-h3) !important;
  line-height: var(--lh-h3) !important;
  font-weight: 600 !important;
}

.custom-select {
  position: relative;
  display: inline-block;
  width: 340px;
  font-size: var(--fs-small);
}
.section-newslist > .custom-select {
  width: calc((100% - 256px) / 2);
  margin-left: 120px;
  box-sizing: border-box;
}
.custom-select__control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border: 1.5px solid var(--blue-500);
  background: #fff;
  cursor: pointer;
  height: var(--field-height);
  box-sizing: border-box;
}
.custom-select__value {
  color: #9aa5b3;
}
/* Valore scelto in nero: gli script delle tendine mettono data-i18n-skip sullo span quando
   scrivono la voce selezionata e lo tolgono quando torna il segnaposto. */
.custom-select__value[data-i18n-skip] {
  color: #111;
}
.custom-select__arrow {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 6 L18 18 M11 18 L18 18 L18 11' stroke='%23133378' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.custom-select.open .custom-select__arrow {
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' stroke='%23133378' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* Keep the open list above later fields and form sections. */
.section-newslist:has(.custom-select.open) {
  z-index: 50;
}
.form-field:has(.custom-select.open),
.custom-select.open {
  z-index: 40;
}
.custom-select__list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  background: white;
  border: 1px solid #e6eefc;
  box-shadow: 0 8px 30px rgba(19, 51, 120, 0.06);
  max-height: 0;
  overflow: hidden;
  padding: 8px 8px;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: max-height 300ms ease-out, opacity 300ms ease-out,
    transform 300ms ease-out;
  z-index: 40;
}
.custom-select.open .custom-select__list {
  max-height: 220px;
  overflow: auto;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.custom-select__list li {
  list-style: none;
  padding: 12px 10px;
  color: #222;
  cursor: pointer;
}
/* Separate choices only inside forms, leaving site navigation unchanged. */
form .custom-select__list li + li {
  border-top: 1px solid #e6eefc;
}
.custom-select__list li:hover,
.custom-select__list li[aria-selected="true"] {
  background: #f3f7ff;
}
.custom-select:focus .custom-select__control {
  box-shadow: 0 0 0 3px rgba(19, 51, 120, 0.08);
}



.form-grid .custom-select {
  margin-left: 0;
  width: 100%;
}
.form-grid .custom-select .custom-select__control {
  padding-left: 12px;
  padding-right: 12px;
}

button.custom-chip{
  border: none;
  background: #e6eefc;
  color: var(--blue-600);
  padding: 6px 12px;
  cursor: pointer;
  font-size: var(--fs-button);
  margin-top: 3px;
  margin-right: 3px;
}

label.toggle-button-label{
  border: none;
  background: #e6eefc;
  color: var(--blue-600);
  padding: 6px 12px;
  cursor: pointer;
  font-size: var(--fs-button);
  margin-top: 3px;
  margin-right: 3px;
}

.form-panel {
  background: #ffffff;
  border: 1px solid #eef3fb;
  padding: 18px 20px;
  max-width: none;
  width: calc(100% - 240px);
  margin-left: 120px;
  box-sizing: border-box;
}
.form-panel-1 {
  background: #ffffff;
  border: 1px solid #eef3fb;
  padding: 18px 20px;
  margin-left: 120px;
  box-sizing: border-box;
  width: 36%;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.form-field {
  position: relative;
}
.form-field input {
  width: 100%;
  border: 1.5px solid var(--blue-500);
  padding: 12px;
  font-size: var(--fs-body);
  box-sizing: border-box;
  background: #fff;
  height: var(--field-height);
}
.form-field select {
  width: 100%;
  border: 1.5px solid var(--blue-500);
  padding: 12px;
  font-size: var(--fs-body);
  box-sizing: border-box;
  background: #fff;
  height: var(--field-height);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' stroke='%23133378' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  background-size: 12px;
  padding-right: 36px;
}

/* Label sempre sollevate per select, data e gruppi radio. */
.form-field > select + label,
.form-field > input[type="date"] + label,
.form-field > .radio-input-container + label {
  position: absolute;
  top: 50%;
  transform: translateY(-160%);
  font-size: var(--fs-small);
  color: var(--blue-500);
  background: #fff;
  left: 10px;
  padding: 0 6px;
  pointer-events: none;
  z-index: 2;
}

/* Boxed container for Radios to match Input style */
.radio-input-container {
  display: flex;
  align-items: center;
  height: var(--field-height);
  border: 1.5px solid var(--blue-500);
  padding: 0 12px;
  box-sizing: border-box;
  background: #fff;
  width: 100%;
}

.form-field--full {
  grid-column: 1 / 3;
}
.form-field > input:not([type="radio"]):not([type="checkbox"]):not([type="date"]) + label {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa5b3;
  transition: all 300ms ease-out;
  background: transparent;
  padding: 0 6px;
  pointer-events: none;
  font-size: var(--fs-body);
}
.form-field.filled > input:not([type="radio"]):not([type="checkbox"]):not([type="date"]) + label,
.form-field > input:not([type="radio"]):not([type="checkbox"]):not([type="date"]):focus + label {
  transform: translateY(-160%);
  font-size: var(--fs-small);
  color: var(--blue-500);
  background: #fff;
  left: 10px;
}
.form-grid .form-field input:focus {
  outline: none;
  border-color: var(--blue-600);
}
.form-grid input,
.form-grid select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--blue-500);
  font-size: var(--fs-body);
  background: #fff;
  box-sizing: border-box;
  height: var(--field-height);
  min-height: var(--field-height);
}
.form-grid select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolyline points='6 9 12 15 18 9' stroke='%23133378' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: calc(100% - 12px) center;
  background-size: 12px;
  padding-right: 36px;
}
.form-grid input:focus,
.form-grid select:focus {
  outline: none;
  border-color: var(--blue-600);
}
.form-grid input[type="email"] {
  grid-column: 1 / 3;
}
.form-grid select[name="professione"] {
  grid-column: 2 / 3;
}

.consensi-section {
  margin-top: 22px;
}
.consenso-block {
  background: var(--panel-bg);
  padding: 14px 16px;
  margin-bottom: 14px;
  border: 1px solid #eef3fb;
  max-width: none;
  width: calc(100% - 240px);
  margin-left: 120px;
  box-sizing: border-box;
}
.consenso-block label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #222;
  cursor: pointer;
}
.consenso-block input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--blue-600);
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.consenso-title {
  color: var(--blue-500);
  font-weight: 600;
  margin-bottom: 6px;
}
.consenso-desc {
  color: #666;
}
.form-actions {
  margin-top: 18px;
  margin-left: 0 !important;
}
  .custom-select__control,
  .custom-select__value {
    width: 100% !important;
  }
  .section-newslist > .custom-select .custom-select__control {
    border: 1.5px solid var(--blue-500) !important;
    background: #fff !important;
    padding: 8px 12px !important;
    height: var(--field-height) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    box-sizing: border-box !important;
  }
/* Il breadcrumb visibile riserva già lo spazio per l'header fisso. */
.page-newslist:not(.page-careers):not(:has(> #breadcrumb:not([hidden]) ~ main form)) main {
  padding-top: 84px;
}

/* Marker HTML (numero + linea) for .section-newslist */
.marker {
  position: absolute;
  top: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  z-index: 2;
}
.marker .num {
  display: none;
  color: var(--blue-1)70;
  font-weight: 700;
  font-size: var(--fs-small);
  letter-spacing: 1px;
}
.marker .line {
  display: block;
  width: 50vw;
  height: 1px;
  background: var(--blue-1)70;
}


/* Menu-close button rule kept minimal in page file; main hide is in header file */
.menu-close-btn {
  display: none !important;
}

/* Error states for Newslist style forms */
.form-field input.error,
.form-field select.error,
.form-group input.error,
.form-group select.error {
  border-color: #dc3545;
  background-color: #fff8f8;
}

.form-field input.error + label {
  color: #dc3545;
}

.radio-option-inline.error,
.checkbox-group.error {
  border: 1px solid #dc3545;
  background-color: #fff8f8;
}

.custom-select.error .custom-select__control,
.radio-input-container.error,
.toggle-buttons-container.error,
.consenso-block.error {
  border-color: #dc3545;
  background-color: #fff8f8;
}

.radio-input-container.error,
.toggle-buttons-container.error {
  outline: 1px solid #dc3545;
  outline-offset: 4px;
}

.modal #modalMessage {
  white-space: pre-line;
}

/* Keep the native date picker and its single browser-provided icon. */
#candidaturaForm .form-field input[type="date"] {
    appearance: auto;
    -webkit-appearance: auto;
    background-image: none !important;
    padding-right: 12px;
}
#candidaturaForm .form-field input[type="date"]::-webkit-calendar-picker-indicator {
    position: static;
    width: 20px;
    height: 20px;
    opacity: 1;
}

/* Keep the title, sections and controls on the same grid for public forms. */
.page-newslist:not(.page-careers, .page-contatto-evento) .container-newslist:has(> .newslist-form) {
  max-width: 856px;
}

.page-newslist:not(.page-careers, .page-contatto-evento) .container-newslist:has(> .newslist-form) > .header-newslist {
  margin-bottom: 1.25rem;
  padding-bottom: 0;
}

.page-newslist:not(.page-careers) .header-newslist :is(.form-intro, .form-required-note),
.page-newslist:not(.page-careers) .newslist-form .section-title {
  margin-inline-start: 0;
}

.page-newslist:not(.page-careers) .newslist-form .section-newslist {
  margin-block: 0;
  padding-block: clamp(1rem, 3vw, 1.5rem);
  border-top: 1px solid #d8e0ef;
}

.page-newslist:not(.page-careers) .newslist-form .marker {
  display: none;
}

.page-newslist:not(.page-careers) .newslist-form :is(.form-panel, .form-panel-1, .consenso-block) {
  width: 100%;
  margin-inline: 0;
  padding: clamp(0.875rem, 3vw, 1.25rem);
  border-color: #d8e0ef;
}

.page-newslist:not(.page-careers) .newslist-form .consenso-block {
  background: #f4f7fd;
}

.page-newslist:not(.page-careers) .newslist-form .section-newslist > .custom-select {
  width: min(100%, 26rem);
  margin-inline: 0;
}

.newslist-form .form-grid > * {
  min-width: 0;
}

.newslist-form .form-field > input:not([type="radio"]):not([type="checkbox"]):not([type="date"]) + label {
  color: #526176;
}

.newslist-form .form-field.filled > input + label,
.newslist-form .form-field > input:focus + label {
  color: var(--blue-500);
}

.newslist-form :is(input:not([type="hidden"]), select, textarea, .custom-select, button):focus-visible {
  outline: 2px solid var(--blue-600);
  outline-offset: 2px;
}

.page-newslist:not(.page-careers, .page-contatto-evento) .newslist-form .form-actions {
  margin-top: 1rem;
  text-align: start;
}

@media (max-width: 700px) {
  .newslist-form .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .newslist-form .form-actions .btn {
    width: 100%;
  }

  .newslist-form .section-newslist > .custom-select {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .newslist-form .form-field > input + label {
    transition: none;
  }
}
