* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f5f5f7;
  color: #222;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* LOGIN */
#login-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.login-card h1 {
  margin-bottom: 16px;
  font-size: 1.4rem;
  text-align: center;
}

form label {
  display: block;
  margin-top: 12px;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

form input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

form button {
  width: 100%;
  margin-top: 16px;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

form button:hover {
  background: #2563eb;
}

.error {
  margin-top: 8px;
  color: #b91c1c;
  font-size: 0.85rem;
  text-align: center;
}

/* LAYOUT PRINCIPALE */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  width: 220px;
  gap: 16px;
  padding: 16px;
  background: #111827;
  color: #fff;
}

.sidebar h2 {
  font-size: 1.1rem;
}

.add-section-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #3b82f6;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.add-section-btn:hover {
  background: #2563eb;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.section-wrapper {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.section-item {
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: var(--section-bg, #1f2937);
  color: #fff;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.section-item:hover {
  filter: brightness(0.9);
}

.section-item.active {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.main-content {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.content-view {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

/* INTESTAZIONI */
.dashboard-header,
.section-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  background: #1f2937;
  color: #fff;
}

.dashboard-header h2,
.section-view-header h2 {
  font-size: 1.1rem;
}

.section-navigation {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
}

.section-navigation h2 {
  overflow: hidden;
  font-size: 1.1rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}

#logout-btn,
#logout-btn-section {
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
  background: #ef4444;
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

#logout-btn:hover,
#logout-btn-section:hover {
  background: #dc2626;
}

.back-btn {
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 0.9rem;
  white-space: nowrap;
  cursor: pointer;
}

.back-btn:hover {
  background: #374151;
}

.delete-open-section-btn {
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: #ef4444;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.delete-open-section-btn:hover {
  background: #dc2626;
}

/* CALENDARIO */
.calendar-wrapper {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-header h3 {
  font-size: 1.2rem;
}

.calendar-nav-btn {
  display: flex;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  background: #e5e7eb;
  font-size: 1.2rem;
  cursor: pointer;
}

.calendar-nav-btn:hover {
  background: #d1d5db;
}

.calendar-grid {
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid #e5e7eb;
  background: #f3f4f6;
}

.calendar-weekdays div {
  padding: 8px;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.calendar-days {
  display: grid;
  flex: 1;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 1fr;
}

.calendar-day {
  position: relative;
  min-height: 80px;
  padding: 6px;
  border-right: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.calendar-day:nth-child(7n) {
  border-right: none;
}

.calendar-day.empty {
  background: #fafafa;
}

.calendar-day .day-number {
  color: #111827;
  font-weight: 600;
}

.calendar-day.has-match {
  color: #fff;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.calendar-day.has-match:hover {
  filter: brightness(0.92);
  transform: scale(0.99);
}

.calendar-day.has-match .day-number {
  color: #fff;
}

.calendar-day.has-match::after {
  position: absolute;
  top: 6px;
  right: 7px;
  content: "●";
  color: #fff;
  font-size: 0.75rem;
}

/* VISTA SEZIONE */
.section-subsections {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.subsection-btn {
  min-width: 110px;
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: #e5e7eb;
  color: #1f2937;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.subsection-btn:hover {
  background: #d1d5db;
}

.subsection-btn.active {
  background: #3b82f6;
  color: #fff;
}

.section-view-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.section-view-content h3 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.placeholder-text {
  color: #6b7280;
  font-size: 0.9rem;
}

.subsection-content-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subsection-content-header h3 {
  margin-bottom: 0;
}

.add-match-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #10b981;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.add-match-btn:hover {
  background: #059669;
}

/* MODULI */
.match-form-container {
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.match-form-container h4 {
  margin-bottom: 16px;
  color: #111827;
  font-size: 1rem;
}

.match-form-grid,
.calendar-match-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field label {
  color: #374151;
  font-size: 0.85rem;
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 0.9rem;
}

.form-field textarea {
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: #3b82f6;
  outline: 3px solid rgba(59, 130, 246, 0.15);
}

.form-field-wide {
  grid-column: span 2;
}

.form-field-full {
  grid-column: 1 / -1;
}

.match-form-actions,
.calendar-match-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.cancel-match-btn,
.save-match-btn {
  padding: 9px 13px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.cancel-match-btn {
  background: #e5e7eb;
  color: #374151;
}

.cancel-match-btn:hover {
  background: #d1d5db;
}

.save-match-btn {
  background: #2563eb;
  color: #fff;
}

.save-match-btn:hover {
  background: #1d4ed8;
}

.match-form-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.match-form-title-row h4,
.calendar-match-title-row h2 {
  margin: 0;
}

.event-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #374151;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.event-toggle-label input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #2563eb;
  cursor: pointer;
}

.match-form-container.is-event-mode .match-event-hidden-field,
.calendar-match-modal.is-event-mode .calendar-event-hidden-field {
  display: none;
}

.calendar-match-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

/* TABELLE */
.matches-table-container,
.reimbursements-table-container,
.payments-table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
}

.matches-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

.payments-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

.matches-table th,
.matches-table td,
.payments-table th,
.payments-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.85rem;
  text-align: left;
  vertical-align: middle;
}

.matches-table th,
.payments-table th {
  background: #f3f4f6;
  color: #374151;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.matches-table tbody tr:last-child td,
.payments-table tbody tr:last-child td {
  border-bottom: none;
}

.matches-table tbody tr:hover,
.payments-table tbody tr:hover {
  background: #f9fafb;
}

.payments-table th:nth-child(n + 3),
.payments-table td:nth-child(n + 3) {
  text-align: right;
}

.match-actions-cell {
  text-align: center;
  white-space: nowrap;
}

.match-actions-cell button + button {
  margin-left: 6px;
}

.edit-match-btn,
.calendar-edit-match-btn {
  padding: 8px 13px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.edit-match-btn:hover,
.calendar-edit-match-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

.delete-match-btn,
.calendar-delete-match-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 13px;
  border: none;
  border-radius: 6px;
  background: #dc2626;
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.delete-match-btn:hover,
.calendar-delete-match-btn:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

.calendar-delete-match-btn:focus-visible {
  outline: 3px solid rgba(220, 38, 38, 0.3);
  outline-offset: 2px;
}

/* MODALE DETTAGLI IMPEGNI */
.match-details-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.match-details-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.58);
}

.match-details-dialog {
  position: relative;
  z-index: 1;
  width: max-content;
  min-width: min(680px, calc(100vw - 40px));
  max-width: calc(100vw - 40px);
  max-height: min(700px, 90vh);
  overflow: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.match-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.match-details-header h2 {
  color: #111827;
  font-size: 1.1rem;
}

.close-match-details-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: #f3f4f6;
  color: #374151;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.close-match-details-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.match-details-content {
  width: 100%;
  overflow: visible;
}

.match-detail-row {
  display: flex;
  width: max-content;
  min-width: 100%;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 16px;
  border-left: 15px solid var(--match-section-color, #3b82f6);
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
}

.match-detail-row:last-child {
  border-bottom: none;
}

.match-detail-row-main {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 24px;
  flex: 0 0 auto;
}

.match-detail-section-name {
  flex: 0 0 auto;
  min-width: 150px;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.match-detail-row-info {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 18px;
  flex: 0 0 auto;
  color: #374151;
  font-size: 14px;
  white-space: nowrap;
}

.match-detail-row-info .match-detail-value {
  flex: 0 0 auto;
  white-space: nowrap;
}

.match-detail-row .calendar-match-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  white-space: nowrap;
}

/* MODALE INSERIMENTO DAL CALENDARIO */
.calendar-match-modal {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.calendar-match-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.58);
}

.calendar-match-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.calendar-match-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.calendar-match-header h2 {
  color: #111827;
  font-size: 1.1rem;
}

.close-calendar-match-modal-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: #f3f4f6;
  color: #374151;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.close-calendar-match-modal-btn:hover {
  background: #e5e7eb;
}

#calendar-match-form {
  padding: 18px;
}

/* RIMBORSI */
.reimbursement-input {
  width: 92px;
  padding: 7px 8px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 0.85rem;
  text-align: right;
}

.reimbursement-input:focus,
.payment-date-input:focus {
  border-color: #3b82f6;
  outline: 3px solid rgba(59, 130, 246, 0.15);
}

.reimbursement-input:disabled,
.payment-date-input:disabled {
  border-color: #e5e7eb;
  background: #f3f4f6;
  color: #6b7280;
  opacity: 0.9;
  cursor: not-allowed;
}

.reimbursement-total,
.payment-row-total {
  color: #15803d;
  font-weight: 800;
  white-space: nowrap;
}

.payment-status-cell {
  text-align: center;
}

.payment-status-checkbox {
  width: 18px;
  height: 18px;
  accent-color: #16a34a;
  cursor: pointer;
}

.payment-date-input {
  min-width: 135px;
  padding: 7px 8px;
  border: 1px solid #d1d5db;
  border-radius: 5px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 0.85rem;
}

.reimbursements-summary-row {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
}

.compensation-summary-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #dc2626;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.compensation-summary-btn:hover {
  background: #b91c1c;
}

/* RIEPILOGO COMPENSI */
.compensation-summary-container {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff;
}

.compensation-summary-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #fecaca;
  background: #fef2f2;
}

.compensation-summary-header h3 {
  color: #991b1b;
  font-size: 1rem;
}

.close-compensation-summary-btn {
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.close-compensation-summary-btn:hover {
  background: #d1d5db;
}

.compensation-summary-table {
  width: 100%;
  border-collapse: collapse;
}

.compensation-summary-table th,
.compensation-summary-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
  vertical-align: middle;
}

.compensation-summary-table th:first-child,
.compensation-summary-table td:first-child {
  text-align: left;
}

.compensation-summary-table thead th:not(:first-child),
.compensation-summary-table tbody td,
.compensation-summary-table tfoot td {
  text-align: center;
}

.compensation-summary-table th {
  border-bottom: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.compensation-summary-table tbody th {
  background: #f9fafb;
  color: #374151;
  font-size: 0.86rem;
  font-weight: 700;
}

.compensation-summary-table td {
  color: #111827;
  font-size: 1.15rem;
  font-weight: 800;
}

.compensation-summary-table tfoot th,
.compensation-summary-table tfoot td {
  border-bottom: none;
  background: #fef2f2;
  font-weight: 800;
}

.compensation-summary-table tfoot th {
  color: #991b1b;
}

.compensation-summary-table tfoot td {
  color: #111827;
  font-size: 1.05rem;
}

#total-compensation-value {
  color: #1d4ed8;
}

#received-compensation-value {
  color: #15803d;
}

#pending-compensation-value {
  color: #dc2626;
}

/* FILTRI */
.season-filter-container,
.payments-year-filter-container {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.payments-year-filter-container {
  gap: 12px;
  margin: 16px 0;
}

.season-filter-container label,
.payments-year-filter-container label {
  color: #374151;
  font-size: 0.9rem;
  font-weight: 700;
}

#season-filter,
#payments-year-filter {
  min-width: 145px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

#payments-year-filter {
  width: 145px;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
}

#season-filter:focus,
#payments-year-filter:focus {
  border-color: #3b82f6;
  outline: 3px solid rgba(59, 130, 246, 0.15);
}

/* CONTRIBUTI */
.payments-btn,
.statistics-btn {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: #374151;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.statistics-btn {
  margin-top: auto;
}

.payments-btn:hover,
.statistics-btn:hover {
  background: #4b5563;
}

.payments-btn:hover {
  background: #4b5563;
}

.payment-section-label {
  display: inline-block;
  padding: 5px 8px;
  border-left: 5px solid var(--payment-section-color, #3b82f6);
  border-radius: 4px;
  background: #f9fafb;
  color: #111827;
  font-size: 0.84rem;
  font-weight: 700;
}

/* RESPONSIVE */
@media (max-width: 720px) {
  .match-form-grid,
  .calendar-match-form-grid {
    grid-template-columns: 1fr;
  }

  .form-field-wide,
  .form-field-full {
    grid-column: span 1;
  }

  .match-details-modal,
  .calendar-match-modal {
    padding: 10px;
  }

  .match-details-dialog {
    min-width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
  }

  .match-detail-row {
    gap: 18px;
  }

  .match-detail-row-main {
    gap: 18px;
  }

  .match-detail-row-info {
    gap: 14px;
  }
}

@media (max-width: 650px) {
  .compensation-summary-table th,
  .compensation-summary-table td {
    padding: 10px 6px;
    font-size: 0.75rem;
  }

  .compensation-summary-table td {
    font-size: 0.95rem;
  }
}

.payments-total-row th,
.payments-total-row td {
  padding: 13px 12px;
  border-top: 2px solid #cbd5e1;
  border-bottom: none;
  background: #eff6ff;
  font-weight: 800;
}

.payments-total-row th {
  color: #1e3a8a;
  text-align: right;
}

.payments-total-row td {
  color: #1d4ed8;
  font-size: 0.95rem;
  text-align: right;
  white-space: nowrap;
}

.payments-table {
  table-layout: fixed;
}

.payments-table th,
.payments-table td {
  width: auto;
}

/* Data e sezione più ampie */
.payments-table th:nth-child(1),
.payments-table td:nth-child(1) {
  width: 15%;
}

.payments-table th:nth-child(2),
.payments-table td:nth-child(2) {
  width: 20%;
}

/* Le tre colonne degli importi hanno la stessa larghezza */
.payments-table th:nth-child(3),
.payments-table td:nth-child(3),
.payments-table th:nth-child(4),
.payments-table td:nth-child(4),
.payments-table th:nth-child(5),
.payments-table td:nth-child(5) {
  width: 15%;
}

/* Totale */
.payments-table th:nth-child(6),
.payments-table td:nth-child(6) {
  width: 12%;
}

/* Contributo */
.payments-table th:nth-child(7),
.payments-table td:nth-child(7) {
  width: 8%;
}

.payments-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.payments-page-header h3 {
  margin-bottom: 0;
}

.open-contributions-btn {
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: #7c3aed;
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.open-contributions-btn:hover {
  background: #6d28d9;
}

.contributions-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.contributions-page-header h3 {
  margin-bottom: 0;
}

.contributions-year-filter-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.contributions-year-filter-container label {
  color: #374151;
  font-size: 0.9rem;
  font-weight: 700;
}

#contributions-year-filter {
  min-width: 145px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #111827;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

#contributions-year-filter:focus {
  border-color: #3b82f6;
  outline: 3px solid rgba(59, 130, 246, 0.15);
}

.contributions-table-container {
  overflow-x: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
}

.contributions-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
}

.contributions-table th,
.contributions-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
  text-align: left;
  vertical-align: middle;
}

.contributions-table th {
  background: #f3f4f6;
  color: #374151;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.contributions-table th:last-child,
.contributions-table td:last-child {
  text-align: right;
}

.contributions-table tbody tr:last-child td {
  border-bottom: none;
}

.contributions-table tbody tr:hover {
  background: #f9fafb;
}

.contributions-section-label {
  display: inline-block;
  padding: 5px 8px;
  border-left: 5px solid var(--contributions-section-color, #3b82f6);
  border-radius: 4px;
  background: #f9fafb;
  color: #111827;
  font-size: 0.86rem;
  font-weight: 700;
}

.contributions-daily-allowance {
  color: #15803d;
  font-weight: 800;
  white-space: nowrap;
}

.contributions-total-row th,
.contributions-total-row td {
  border-top: 2px solid #cbd5e1;
  border-bottom: none;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 800;
}

.contributions-total-row td {
  text-align: right;
}

.contributions-credited {
  color: #7c3aed;
  font-weight: 800;
  white-space: nowrap;
}

.contributions-net {
  color: #15803d;
  font-weight: 800;
  white-space: nowrap;
}

.contributions-table th:nth-child(n + 2),
.contributions-table td:nth-child(n + 2) {
  text-align: right;
}

.contributions-table {
  table-layout: fixed;
}

.contributions-table th:nth-child(1),
.contributions-table td:nth-child(1) {
  width: 26%;
}

.contributions-table th:nth-child(2),
.contributions-table td:nth-child(2) {
  width: 18%;
}

.contributions-table th:nth-child(3),
.contributions-table td:nth-child(3),
.contributions-table th:nth-child(4),
.contributions-table td:nth-child(4),
.contributions-table th:nth-child(5),
.contributions-table td:nth-child(5) {
  width: 18.66%;
}

.contributions-table th:nth-child(n + 3),
.contributions-table td:nth-child(n + 3) {
  text-align: right;
}

.contributions-gross {
  color: #111827;
  font-weight: 800;
  white-space: nowrap;
}

.contributions-credited {
  color: #7c3aed;
  font-weight: 800;
  white-space: nowrap;
}

.contributions-net {
  color: #15803d;
  font-weight: 800;
  white-space: nowrap;
}

.season-matches-counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: 4px;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.season-matches-counter::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3b82f6;
}

.season-commitments-counters {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: 4px;
}

.season-matches-counter,
.season-events-counter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #374151;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.season-matches-counter::before,
.season-events-counter::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.season-matches-counter::before {
  background: #3b82f6;
}

.season-events-counter::before {
  background: #7c3aed;
}

@media (max-width: 720px) {
  .season-filter-container {
    flex-wrap: wrap;
  }

  .season-commitments-counters {
    width: 100%;
    margin-left: 0;
  }
}

.statistics-btn:hover {
  background: #4b5563;
}

.reimbursement-details-cell {
  text-align: center;
  white-space: nowrap;
}

.open-reimbursement-details-btn {
  padding: 7px 10px;
  border: none;
  border-radius: 6px;
  background: #7c3aed;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.open-reimbursement-details-btn:hover {
  background: #6d28d9;
  transform: translateY(-1px);
}

.reimbursement-details-modal {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.reimbursement-details-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.58);
}

.reimbursement-details-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
}

.reimbursement-details-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid #e5e7eb;
}

.reimbursement-details-header h2 {
  color: #111827;
  font-size: 1.1rem;
}

.close-reimbursement-details-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: #f3f4f6;
  color: #374151;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.close-reimbursement-details-btn:hover {
  background: #e5e7eb;
  color: #111827;
}

.reimbursement-details-content {
  padding: 18px;
}

.reimbursement-details-placeholder {
  color: #6b7280;
  font-size: 0.9rem;
}

.reimbursement-details-commitment {
  margin: 6px 0 16px;
  color: #111827;
  font-weight: 700;
}

.reimbursement-details-commitment {
  margin-bottom: 18px;
  color: #111827;
  font-size: 0.95rem;
  font-weight: 700;
}

.reimbursement-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.reimbursement-calculations {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.reimbursement-calculation {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 7px;
  background: #eff6ff;
}

.reimbursement-calculation span {
  color: #475569;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.reimbursement-calculation strong {
  color: #1d4ed8;
  font-size: 1rem;
}

.reimbursement-details-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.reimbursement-details-actions .save-match-btn,
.reimbursement-details-actions .cancel-match-btn {
  width: auto;
  margin-top: 0;
}

@media (max-width: 600px) {
  .reimbursement-details-grid,
  .reimbursement-calculations {
    grid-template-columns: 1fr;
  }
}

.statistics-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 18px 0 22px;
}

.statistics-filters .form-field {
  min-width: 220px;
}

.statistics-cards {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
}

.statistics-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.statistics-card-label {
  color: #475569;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

.statistics-card strong {
  color: #15803d;
  font-size: 2rem;
  line-height: 1;
}

.statistics-card-net {
  border-left: 5px solid #16a34a;
}

@media (max-width: 600px) {
  .statistics-filters .form-field {
    width: 100%;
    min-width: 0;
  }

  .statistics-card strong {
    font-size: 1.7rem;
  }
}

.statistics-card-daily-allowance {
  border-left: 5px solid #2563eb;
}

.statistics-card-daily-allowance strong {
  color: #1d4ed8;
}

.statistics-card-mileage {
  border-left: 5px solid #d97706;
}

.statistics-card-mileage strong {
  color: #b45309;
}

.statistics-card-net {
  border-left: 5px solid #16a34a;
}

.statistics-card-net strong {
  color: #15803d;
}

.statistics-card-work-hours {
  border-left: 5px solid #7c3aed;
}

.statistics-card-work-hours strong {
  color: #6d28d9;
}

.statistics-card-commitments {
  border-left: 5px solid #0f766e;
}

.statistics-card-commitments strong {
  color: #0f766e;
}

.statistics-averages {
  margin-top: 28px;
}

.statistics-averages-title {
  margin: 0 0 14px;
  color: #334155;
  font-size: 1rem;
}

.statistics-average-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.statistics-card-average-daily {
  border-left: 5px solid #60a5fa;
}

.statistics-card-average-daily strong {
  color: #2563eb;
}

.statistics-card-average-mileage {
  border-left: 5px solid #fbbf24;
}

.statistics-card-average-mileage strong {
  color: #b45309;
}

.statistics-card-average-net {
  border-left: 5px solid #4ade80;
}

.statistics-card-average-net strong {
  color: #15803d;
}

.statistics-card-average-work-hours {
  border-left: 5px solid #a78bfa;
}

.statistics-card-average-work-hours strong {
  color: #6d28d9;
}

@media (max-width: 1100px) {
  .statistics-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .statistics-average-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .statistics-cards,
  .statistics-average-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .statistics-cards,
  .statistics-average-cards {
    grid-template-columns: 1fr;
  }
}

.statistics-hourly-averages {
  margin-top: 28px;
}

.statistics-hourly-average-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.statistics-card-hourly-daily {
  border-left: 5px solid #93c5fd;
}

.statistics-card-hourly-daily strong {
  color: #1d4ed8;
}

.statistics-card-hourly-mileage {
  border-left: 5px solid #fcd34d;
}

.statistics-card-hourly-mileage strong {
  color: #b45309;
}

.statistics-card-hourly-net {
  border-left: 5px solid #86efac;
}

.statistics-card-hourly-net strong {
  color: #15803d;
}

@media (max-width: 700px) {
  .statistics-hourly-average-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .statistics-hourly-average-cards {
    grid-template-columns: 1fr;
  }
}