:root {
  --ink: #2c3e50;
  --muted: #7f8c8d;
  --paper: #ffffff;
  --surface: #ffffff;
  --accent: #0280af;
  --accent-dark: #0678a3;
  --line: #e5e9ec;
  --max: 1170px;
  --font: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html {
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}

main {
  flex: 1 0 auto;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

/* Header — blu come il sito attuale */
.site-header {
  background: #0678a3;
  border-bottom: 0;
  position: relative;
  z-index: 50;
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 0;
  min-height: 100px;
}

.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo {
  display: block;
  height: 34px;
  width: auto;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
  align-items: center;
}

.site-nav a {
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.site-nav a:hover {
  color: #dff3fb;
  text-decoration: none;
  border-bottom-color: rgba(255, 255, 255, 0.55);
}

.site-nav a.is-active,
.site-nav a[aria-current] {
  color: #ffffff;
  border-bottom-color: #ffffff;
}

.site-nav a.nav-login {
  margin-left: 0.5rem;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  border-bottom-width: 1px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: rgba(255, 255, 255, 0.12);
}

.site-nav a.nav-login:hover,
.site-nav a.nav-login.is-active {
  color: #0678a3;
  background: #ffffff;
  border-color: #ffffff;
  border-bottom-color: #ffffff;
  text-decoration: none;
}

.nav-account {
  position: relative;
  margin-left: 0.5rem;
}
.nav-account__toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.35rem 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.85);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}
.nav-account__toggle:hover,
.nav-account.is-open .nav-account__toggle {
  color: #0678a3;
  background: #ffffff;
  border-color: #ffffff;
}
.nav-account__caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
}
.nav-account__menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 12rem;
  padding: 0.4rem 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(15, 40, 55, 0.14);
  z-index: 60;
}
.nav-account__menu a {
  display: block;
  padding: 0.55rem 0.95rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  border-bottom: 0;
}
.nav-account__menu a:hover {
  background: #f3f7f9;
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 0;
}

.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 0.4rem;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #ffffff;
  margin: 5px 0;
}

@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-bottom: 0.75rem;
  }
  .site-nav.is-open { display: flex; }
  .nav-account {
    margin-left: 0;
    width: 100%;
  }
  .nav-account__toggle { width: 100%; justify-content: space-between; }
  .nav-account__menu {
    position: static;
    margin-top: 0.4rem;
    box-shadow: none;
    width: 100%;
  }
}

/* Carousel */
.home-carousel {
  position: relative;
  height: min(62vw, 400px);
  min-height: 260px;
  overflow: hidden;
  background: #0b4f68;
}

.carousel-slides {
  position: absolute;
  inset: 0;
}

.carousel-slide {
  position: absolute;
  inset: 0;
  background-position: 50% 30%;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 0;
  transition: opacity 1s ease;
}

.carousel-slide.is-active { opacity: 1; }

.carousel-caption {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding-bottom: 3.5rem;
  background: linear-gradient(180deg, rgba(0,0,0,0.15) 20%, rgba(0,0,0,0.45) 100%);
  z-index: 2;
}

.carousel-caption h1 {
  margin: 0 0 0.4rem;
  color: #fff;
  font-size: clamp(1.45rem, 3.4vw, 2.1rem);
  font-weight: 700;
  line-height: 1.25;
  max-width: 18ch;
  text-shadow: 2px 2px 2px #000;
}

.carousel-caption .lead {
  margin: 0 0 1rem;
  color: #fff;
  font-size: clamp(1rem, 2vw, 1.25rem);
  text-shadow: 2px 2px 2px #000;
}

.carousel-pager {
  display: flex;
  gap: 0.5rem;
}

.carousel-pager button {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: #c7dcea;
  cursor: pointer;
}

.carousel-pager button.is-active {
  background: #0678a3;
}

/* Sections */
.section {
  padding: 3rem 0;
}

.features-section {
  background: #fff;
  text-align: center;
}

.features-section h2 {
  margin: 0 0 2rem;
  font-size: 1.75rem;
  font-weight: 700;
  color: #34495e;
}

.feature-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center center;
  background-size: contain;
  border-radius: 0;
  opacity: 1;
}

.feature-icon-formazione {
  background-image: url("../img/icons/formazione.c5858a589ece.png");
}
.feature-icon-eventi {
  background-image: url("../img/icons/eventi.7d533cba7878.png");
}
.feature-icon-gruppi {
  background-image: url("../img/icons/gruppi.e9ba96f00c33.png");
}
.feature-icon-library {
  background-image: url("../img/icons/library.ea4c6a802020.png");
}

.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2.5rem 4rem;
  max-width: 820px;
  margin: 0 auto;
  text-align: left;
}

.feature {
  position: relative;
  padding-left: 3.5rem;
}

.feature .feature-icon {
  position: absolute;
  left: 0;
  top: 0.15rem;
  margin: 0;
  width: 40px;
  height: 40px;
}

.feature h3 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
  color: #34495e;
}

.feature p {
  margin: 0;
  color: #7f8c8d;
  font-size: 0.95rem;
}

@media (max-width: 700px) {
  .features { grid-template-columns: 1fr; }
}

.contacts-section {
  background: #f7f9fa;
  border-top: 1px solid var(--line);
}

.contacts-section h2 {
  margin-top: 0;
  color: #34495e;
}

.contacts-section h3 {
  font-size: 1rem;
  margin: 1.25rem 0 0.4rem;
  color: var(--accent);
}

.contact-links a,
.contact-links span {
  display: inline-block;
  margin: 0.15rem 0;
  font-weight: 600;
  color: var(--accent);
}

/* Inner pages */
.page-header {
  background: #f7f9fa;
  border-bottom: 1px solid var(--line);
  padding: 2rem 0 1.25rem;
}

.page-header h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: #34495e;
}

.layout-with-sidebar {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
  padding: 2rem 0 3rem;
}

@media (max-width: 800px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
}

.sidebar {
  background: #fff;
  border: 1px solid var(--line);
  padding: 1rem;
  height: fit-content;
}

.sidebar a {
  display: block;
  padding: 0.35rem 0;
  color: #34495e;
}

.sidebar a.active {
  color: var(--accent);
  font-weight: 700;
}

.page-index {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
}

.page-index__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.1rem;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid #0678a3;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.page-index__link:hover {
  border-color: #9ec6d8;
  border-left-color: #045f82;
  background: #f7fbfd;
  box-shadow: 0 4px 12px rgba(6, 120, 163, 0.06);
  text-decoration: none;
  color: var(--ink);
}

.page-index__title {
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.35;
}

.page-index__arrow {
  flex-shrink: 0;
  color: #0678a3;
  font-weight: 700;
  transition: transform 0.15s ease;
}

.page-index__link:hover .page-index__arrow {
  transform: translateX(3px);
}

.prose .page-index {
  margin-top: 1.25rem;
}

.prose :is(p, ul, ol) { margin-top: 0; }
.prose h2, .prose h3 { margin-top: 1.4rem; }

.event-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.event-grid__empty {
  grid-column: 1 / -1;
  padding: 1rem 0;
}

.event-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 11.5rem;
  padding: 1.1rem 1.15rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-top: 3px solid #0678a3;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.event-card:hover {
  border-color: #9ec6d8;
  border-top-color: #045f82;
  box-shadow: 0 6px 18px rgba(6, 120, 163, 0.08);
  text-decoration: none;
  color: inherit;
}

.event-card__date {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.45rem;
  margin-bottom: 0.85rem;
  color: #0678a3;
  line-height: 1;
}

.event-card__day {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.event-card__month {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  align-self: center;
}

.event-card__until {
  flex-basis: 100%;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #3d6f84;
  letter-spacing: 0.01em;
}

.event-card__date--empty {
  color: var(--muted);
}

.event-card__title {
  display: block;
  margin-top: auto;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
}

.event-card:hover .event-card__title {
  color: #045f82;
}

@media (max-width: 960px) {
  .event-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .event-grid { grid-template-columns: 1fr; }
  .event-card { min-height: 0; }
}

.event-back {
  margin: 2.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.event-back a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: #0678a3;
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 0.15s ease, gap 0.15s ease;
}

.event-back a:hover {
  color: #045f82;
  text-decoration: none;
  gap: 0.65rem;
}

.event-back__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border: 1px solid #9ec6d8;
  border-radius: 999px;
  font-size: 0.85rem;
  line-height: 1;
  background: #f0f7fb;
}

.event-back a:hover .event-back__arrow {
  border-color: #0678a3;
  background: #e5f3f9;
}

/* legacy class kept if referenced elsewhere */
.event-list { list-style: none; margin: 0; padding: 0; }
.event-list li {
  background: #fff;
  border: 1px solid var(--line);
  margin-bottom: 0.75rem;
  padding: 1rem 1.1rem;
}
.event-list .meta { color: var(--muted); font-size: 0.9rem; }

.document-list,
.doc-panel {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.doc-panel__title {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.doc-panel__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}

.doc-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.doc-item:hover {
  border-color: #b7ceda;
  background: #f0f7fb;
  text-decoration: none;
  color: inherit;
}

.doc-item__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  height: 1.85rem;
  padding: 0 0.35rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  background: #5d6d7e;
}

.doc-item__badge--pdf { background: #c0392b; }
.doc-item__badge--doc { background: #2980b9; }
.doc-item__badge--sheet { background: #1e8449; }
.doc-item__badge--slides { background: #d68910; }
.doc-item__badge--zip { background: #7d3c98; }
.doc-item__badge--video { background: #1a5276; }
.doc-item__badge--image { background: #117a65; }
.doc-item__badge--file { background: #5d6d7e; }

.doc-item__body {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.doc-item__name {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.doc-item__meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.doc-item__action {
  color: #0678a3;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.doc-video {
  margin: 0;
  padding: 0.85rem 0.9rem 0.75rem;
  background: #f7fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.doc-video__title {
  margin: 0 0 0.65rem;
  font-weight: 700;
  font-size: 0.98rem;
  color: var(--ink);
}

.doc-video__player {
  display: block;
  width: 100%;
  max-height: 28rem;
  background: #0b1c24;
  border-radius: 4px;
}

.doc-video__download {
  margin: 0.55rem 0 0;
  font-size: 0.85rem;
}

.doc-panel__members {
  margin-top: 1.15rem;
}

.doc-panel__members-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.doc-panel__locked {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .doc-item {
    grid-template-columns: auto 1fr;
  }
  .doc-item__action {
    grid-column: 2;
    justify-self: start;
  }
}

/* Footer — blu, solo contatti */
.site-footer {
  background: #0280af;
  color: #fff;
  padding: 2.25rem 0 1.5rem;
  margin-top: 0;
  font-size: 0.92rem;
}

.site-footer a { color: #fff; text-decoration: underline; }
.site-footer a:hover { color: #e8f6fc; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
  padding-bottom: 1.5rem;
}

@media (max-width: 700px) {
  .footer-grid { grid-template-columns: 1fr; }
}

.footer-col :is(p, h1, h2, h3, h4, h5, h6) {
  color: #fff;
  margin-top: 0;
}

.footer-col a { color: #fff; }

.footer-legal {
  border-top: 1px solid rgba(255,255,255,0.25);
  padding-top: 1rem;
  font-size: 0.85rem;
  opacity: 0.95;
}

/* Forms / tables (member area) */
.narrow { max-width: 640px; }
.stack-form label { display: block; margin: 0.85rem 0 0.3rem; font-weight: 600; }
.stack-form label.form-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}
.form-control, .stack-form input, .stack-form select, .stack-form textarea {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
}
.stack-form input[type="checkbox"],
.stack-form .form-check {
  width: auto;
  padding: 0;
  border: 0;
  background: transparent;
}
.member-edit-form { max-width: 820px; }
.form-row {
  display: grid;
  gap: 0 1rem;
  margin: 0;
}
.form-field { min-width: 0; }
.form-field .errorlist { margin: 0.25rem 0 0; }
@media (min-width: 720px) {
  .form-row--2 { grid-template-columns: 1fr 1fr; }
  .form-row--3 { grid-template-columns: minmax(5rem, 0.7fr) 1.4fr 1fr; }
}
.btn, button.btn {
  display: inline-block;
  margin-top: 1rem;
  padding: 0.55rem 1rem;
  background: var(--accent);
  color: #fff !important;
  border: 0;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none !important;
}
.btn:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--muted); }
.btn-with-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.btn-with-icon svg {
  flex-shrink: 0;
}
.flash-ok {
  background: #e7f6ec;
  border: 1px solid #b7dfc4;
  padding: 0.7rem 0.9rem;
}
.profile-section {
  border: 1px solid #d7e1e7;
  background: #f3f7f9;
  border-radius: 6px;
  padding: 1rem 1.1rem 1.2rem;
  margin: 1.2rem 0;
}
.profile-section legend {
  font-weight: 700;
  padding: 0 0.45rem;
  color: var(--ink);
  background: #f3f7f9;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1.25rem;
}
.filter-row > div { min-width: 160px; }
.filter-check label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
.filter-actions { display: flex; gap: 0.6rem; align-items: center; }
.table-scroll { overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  font-size: 0.92rem;
}
.data-table th, .data-table td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.55rem;
  vertical-align: middle;
}
.data-table th { background: #eef3f5; text-align: left; }
.data-table tfoot td,
.data-table tr.fee-totals th {
  background: #eef3f5;
  font-weight: 700;
  border-top: 2px solid var(--line);
}
.text-center { text-align: center; }
.badge {
  display: inline-block;
  background: #dff3ea;
  color: #1f6b45;
  padding: 0.15rem 0.45rem;
  font-weight: 700;
  font-size: 0.85rem;
}
.fee-cell { white-space: nowrap; }
.inline-form { display: inline; }
.link-danger {
  background: none;
  border: 0;
  color: #b42318;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.2rem;
}
.errorlist {
  color: #b42318;
  list-style: none;
  padding-left: 0;
  margin: 0.75rem 0;
}
.helptext {
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}
.helptext ul {
  margin: 0.35rem 0 0;
  padding-left: 1.2rem;
}
.muted { color: var(--muted); }

.fee-member-link {
  color: #0678a3;
  font-weight: 700;
  text-decoration: none;
}
.fee-member-link:hover {
  text-decoration: underline;
  color: #045f82;
}

.member-detail {
  margin: 1.75rem 0;
  padding-top: 0.25rem;
}
.member-detail h2 {
  margin: 0 0 0.85rem;
  font-size: 1.15rem;
  color: #34495e;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--line);
}
.member-detail__actions {
  margin-top: 1rem;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1.5rem;
  margin: 0;
}
.detail-grid > div {
  margin: 0;
}
.detail-grid__wide {
  grid-column: 1 / -1;
}
.detail-grid dt {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.2rem;
}
.detail-grid dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.4;
}
@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
}
