/* =====================================================================
   SPORT CENTER CMS — Stylesheet
   Tipografia: Plus Jakarta Sans (display) + Inter (body)
   Palette: emerald accent + neutri slate, sfondo chiaro
   ===================================================================== */

:root {
  --font-display: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;

  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;

  --emerald-50:  #ecfdf5;
  --emerald-100: #d1fae5;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --emerald-700: #047857;

  --rose-500: #f43f5e;
  --rose-600: #e11d48;
  --rose-700: #be123c;

  --amber-50:  #fffbeb;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;

  --shadow-sm: 0 1px 2px 0 rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.05);

  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--slate-50);
  color: var(--slate-900);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font: inherit; color: inherit; }

.icon { width: 18px; height: 18px; flex-shrink: 0; }

/* ===== Layout ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  width: 256px;
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  z-index: 50;
  flex-shrink: 0;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--slate-200);
}
.brand__logo {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--emerald-500), var(--emerald-600));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm);
}
.brand__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--slate-900);
  line-height: 1.2;
}
.brand__sub {
  font-size: 11px;
  color: var(--slate-500);
  line-height: 1.2;
}

.nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}
.nav__section {
  margin: 14px 0 4px;
  padding: 0 12px;
  font-size: 10px;
  font-weight: 700;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.nav__section:first-child { margin-top: 0; }
.nav__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-600);
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.nav__item:hover { background: var(--slate-50); color: var(--slate-900); }
.nav__item.is-active {
  background: var(--emerald-50);
  color: var(--emerald-700);
}
.nav__item.is-active::after {
  content: '';
  position: absolute;
  right: 12px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald-500);
}
.nav__item.is-active .icon { stroke-width: 2.3; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--slate-200);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--slate-200);
  color: var(--slate-700);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 11px;
}
.user__info { flex: 1; min-width: 0; }
.user__name {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user__role { font-size: 11px; color: var(--slate-500); }
.user__logout {
  color: var(--slate-400);
  padding: 4px;
  border-radius: 4px;
  display: flex;
}
.user__logout:hover { color: var(--slate-700); }

/* ===== Topbar (mobile) ===== */
.topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  padding: 12px 16px;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.topbar__toggle {
  background: none;
  border: none;
  padding: 6px;
  border-radius: 6px;
  color: var(--slate-600);
}
.topbar__toggle:hover { background: var(--slate-100); }
.topbar__toggle svg { width: 20px; height: 20px; }
.topbar__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--slate-900);
  font-size: 14px;
}

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(2px);
  z-index: 40;
}
.overlay.is-visible { display: block; }

/* ===== Main ===== */
.main {
  flex: 1;
  padding: 32px;
  min-width: 0;
  max-width: 1600px;
}

/* ===== Page header ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.page-header__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 22px;
  color: var(--slate-900);
  letter-spacing: -0.01em;
  margin: 0;
}
.page-header__sub {
  font-size: 13px;
  color: var(--slate-500);
  margin-top: 2px;
}
.page-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.page-header__title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--slate-200);
  background: #fff;
  color: var(--slate-700);
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { background: var(--slate-50); }
.btn--sm {
  padding: 4px 10px;
  font-size: 12px;
  gap: 4px;
}
.btn--sm svg { width: 14px; height: 14px; }
.btn--primary {
  background: var(--slate-900);
  border-color: var(--slate-900);
  color: #fff;
}
.btn--primary:hover { background: var(--slate-800); }
.btn--danger {
  background: var(--rose-600);
  border-color: var(--rose-600);
  color: #fff;
}
.btn--danger:hover { background: var(--rose-700); }
.btn--icon {
  padding: 8px;
  width: 34px;
  height: 34px;
  justify-content: center;
}
.btn--icon svg { width: 16px; height: 16px; }
.btn .icon { width: 16px; height: 16px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.btn-divider { width: 1px; height: 22px; background: var(--slate-200); margin: 0 4px; }

/* ===== Cards / Panels ===== */
.card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: 13px;
  font-weight: 500;
}
.alert--success { background: var(--emerald-50); color: var(--emerald-700); border: 1px solid var(--emerald-100); }
.alert--error { background: #fef2f2; color: var(--rose-700); border: 1px solid #fecaca; }

/* ===== Month Calendar ===== */
.month-grid { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-sm); }
.month-grid__head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: rgba(248, 250, 252, 0.6);
  border-bottom: 1px solid var(--slate-200);
}
.month-grid__head > div {
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-500);
  text-align: center;
}
.month-grid__head > div.is-weekend { color: var(--rose-600); }
.month-grid__body { display: grid; grid-template-columns: repeat(7, 1fr); }
.day-cell {
  min-height: 110px;
  padding: 10px;
  border-right: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-100);
  background: #fff;
  text-align: left;
  border-left: none;
  border-top: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: background 0.15s;
  position: relative;
}
.day-cell:hover { background: rgba(236, 253, 245, 0.6); }
.day-cell.is-weekend { background: rgba(248, 250, 252, 0.4); }
.day-cell.is-weekend:hover { background: rgba(236, 253, 245, 0.6); }
.day-cell.is-empty { background: rgba(248, 250, 252, 0.4); cursor: default; }
.day-cell.is-empty:hover { background: rgba(248, 250, 252, 0.4); }
.day-cell.is-today { box-shadow: inset 0 0 0 2px var(--emerald-500); z-index: 2; }
.day-cell__top { display: flex; justify-content: space-between; align-items: flex-start; }
.day-cell__num {
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-700);
}
.day-cell.is-weekend .day-cell__num { color: var(--rose-600); }
.day-cell.is-today .day-cell__num {
  display: inline-flex;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--emerald-500);
  color: #fff;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}
.day-cell__count {
  font-size: 10px;
  font-weight: 600;
}
.day-cell__indicator {
  margin-top: auto;
  padding-top: 10px;
}
.day-cell__bar {
  height: 4px;
  background: var(--slate-100);
  border-radius: 999px;
  overflow: hidden;
}
.day-cell__bar > div { height: 100%; transition: width 0.3s; }
.day-cell__caption {
  font-size: 10px;
  color: var(--slate-500);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.load-low { background: #047857; }
.load-med { background: #1e40af; }
.load-high { background: var(--amber-500); }
.load-full { background: var(--rose-500); }
.load-low-text { color: #047857; }
.load-med-text { color: #1e40af; }
.load-high-text { color: #b45309; }
.load-full-text { color: var(--rose-700); }

.legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--slate-600);
  margin-top: 16px;
}
.legend__title { color: var(--slate-500); font-weight: 500; }
.legend__dot { display: inline-flex; align-items: center; gap: 6px; }
.legend__dot::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.legend__dot.dot-low::before { background: #047857; }
.legend__dot.dot-med::before { background: #1e40af; }
.legend__dot.dot-high::before { background: var(--amber-500); }
.legend__dot.dot-full::before { background: var(--rose-500); }

/* ===== Day View (grid prenotazioni) ===== */
.day-view {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  /* Niente overflow: il sticky deve risalire al viewport */
}
.day-view__scroll {
  /* Niente overflow-x qui: bloccherebbe lo sticky.
     Su desktop la pagina e' larga abbastanza; su mobile facciamo overflow al .day-view__inner. */
}
.day-view__inner {
  min-width: 900px;
}
.day-grid {
  position: relative;
  display: grid;
}
.day-grid__head {
  display: grid;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.day-grid__head > div:first-child {
  padding: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.field-head {
  padding: 12px;
  text-align: center;
  border-left: 1px solid var(--slate-200);
}
.field-head.is-beach { background: rgba(254, 243, 199, 0.4); }
.field-head__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-900);
}
.field-head__type {
  font-size: 10px;
  color: var(--slate-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}
.day-grid__body {
  position: relative;
  display: grid;
}
.time-cell {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--slate-400);
  border-top: 1px solid var(--slate-100);
  grid-column: 1;
}
.time-cell.is-hour {
  color: var(--slate-700);
  border-top: 1px solid var(--slate-200);
}
.slot-cell {
  border-left: 1px solid var(--slate-200);
  border-top: 1px solid var(--slate-100);
  cursor: pointer;
  position: relative;
  background: transparent;
  border-right: none;
  border-bottom: none;
  padding: 0;
  transition: background 0.15s;
}
.slot-cell.is-hour { border-top: 1px solid var(--slate-200); }
.slot-cell.is-beach { background: rgba(254, 243, 199, 0.15); }
.slot-cell:hover:not([disabled]) { background: rgba(236, 253, 245, 0.6); }
.slot-cell[disabled] { cursor: default; }
.slot-cell__plus {
  opacity: 0;
  color: var(--slate-300);
  transition: opacity 0.15s;
  width: 14px; height: 14px;
}
.slot-cell:hover .slot-cell__plus { opacity: 1; }

.booking {
  padding: 4px;
  z-index: 5;
  position: relative;
}
.booking__inner {
  width: 100%;
  height: 100%;
  border-radius: 6px;
  padding: 8px;
  text-align: left;
  border: none;
  border-left: 3px solid var(--b-color);
  background: var(--b-bg);
  color: var(--b-text);
  cursor: pointer;
  overflow: hidden;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* DIFENSIVO: vincola tutte le SVG dentro le card a dimensioni piccole
   per evitare che si espandano riempiendo la card */
.booking__inner svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  max-width: 11px;
  max-height: 11px;
}
.booking__inner:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.booking__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}
.booking__client {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.booking__badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  background: var(--b-color);
  color: #fff;
}
.booking__time,
.booking__price {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  line-height: 1.15;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
}
.booking__price { font-weight: 700; }
.booking__time svg,
.booking__price svg {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}
.booking__time span,
.booking__price span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.booking__note-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 4px;
  cursor: help;
  transition: background 0.15s;
}
.booking__note-icon:hover { background: #fff; }
.booking__note-icon svg { color: var(--b-text); }
.booking__actions {
  position: absolute;
  bottom: 6px; right: 6px;
  display: flex;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.booking__inner:hover .booking__actions { opacity: 1; }
.booking__action {
  padding: 4px;
  border-radius: 4px;
  background: rgba(255,255,255,0.9);
  border: none;
  display: flex;
  align-items: center;
  cursor: pointer;
}
.booking__action:hover { background: #fff; }
.booking__action svg { width: 12px; height: 12px; color: var(--b-text); }

/* Drag & Drop */
.booking {
  cursor: grab;
}
.booking:active {
  cursor: grabbing;
}
.booking.is-dragging {
  opacity: 0.4;
}
.booking.is-dragging .booking__inner {
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
}
.slot-cell.is-drop-target {
  background: rgba(16, 185, 129, 0.2) !important;
  box-shadow: inset 0 0 0 2px var(--emerald-500);
}

/* ===== Tables ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--slate-100);
  font-size: 13px;
}
.data-table th {
  background: var(--slate-50);
  font-weight: 600;
  color: var(--slate-600);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tbody tr:hover { background: var(--slate-50); }
.data-table .sort-link {
  color: inherit;
  text-decoration: none;
  display: inline-block;
}
.data-table .sort-link:hover { color: var(--slate-900); }
.data-table .row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
}
.row-action {
  padding: 6px;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--slate-500);
  display: inline-flex;
}
.row-action:hover { background: var(--slate-100); color: var(--slate-900); border-color: var(--slate-200); }
.row-action svg { width: 14px; height: 14px; }
.row-action.is-danger:hover { color: var(--rose-600); }

/* La colonna azioni (modifica/elimina) resta sempre stretta sul contenuto. */
.data-table th.col-actions,
.data-table td.col-actions { width: 1%; white-space: nowrap; }

/* Liste semplici (.is-list): la tabella si adatta al contenuto invece di
   stirarsi a tutta larghezza, e le celle non vanno a capo (un nome lungo
   allarga la sua colonna). La colonna azioni e' la prima a sinistra. */
.data-table.is-list { width: auto; max-width: 100%; }
.data-table.is-list th,
.data-table.is-list td { white-space: nowrap; }
.data-table.is-list .row-actions { justify-content: flex-start; flex-wrap: nowrap; }

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--slate-500);
}
.empty__icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  background: var(--emerald-50);
  color: var(--emerald-600);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.empty__title { font-size: 15px; font-weight: 600; color: var(--slate-900); margin: 0 0 4px; }
.empty p { font-size: 13px; margin: 0; max-width: 420px; margin-inline: auto; }

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
/* Versione a 2 colonne fisse - per form lunghi dove serve un layout prevedibile */
.form-grid--2cols {
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 640px) {
  .form-grid--2cols { grid-template-columns: 1fr; }
}
/* Barra azioni del form: sempre visibile in fondo al box */
.form-actions-bar {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.form-actions-bar .btn { min-width: 120px; justify-content: center; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.span-2 { grid-column: span 2; }
.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-700);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
  color: var(--slate-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--emerald-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}
.form-textarea { min-height: 80px; resize: vertical; }
.form-help { font-size: 11px; color: var(--slate-500); }

.field-checkboxes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 6px;
  padding: 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
  border: 1px solid var(--slate-200);
}
.field-checkbox {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--slate-200);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s;
  user-select: none;
}
.field-checkbox:hover { border-color: var(--slate-300); }
.field-checkbox input { margin: 0; accent-color: var(--emerald-500); }
.field-checkbox.is-checked {
  background: var(--emerald-50);
  border-color: var(--emerald-500);
  color: var(--emerald-700);
  font-weight: 600;
}

/* ===== Combobox (cliente ricercabile) ===== */
.combobox {
  position: relative;
}
.combobox__menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 240px;
  overflow-y: auto;
  z-index: 200;
  padding: 4px;
}
.combobox__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--slate-700);
}
.combobox__item:hover,
.combobox__item.is-active {
  background: var(--emerald-50);
  color: var(--emerald-700);
}
.combobox__item-name { font-weight: 500; }
.combobox__item-meta {
  font-size: 11px;
  color: var(--slate-500);
  font-variant-numeric: tabular-nums;
}
.combobox__empty {
  padding: 12px;
  font-size: 13px;
  color: var(--slate-500);
  text-align: center;
}

/* ===== Client contacts box (nel modal prenotazione) ===== */
.client-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
}
.client-contacts--empty {
  font-size: 12px;
  color: var(--slate-500);
  font-style: italic;
}
.contact-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.contact-row__icon {
  flex-shrink: 0;
  color: var(--slate-500);
}
.contact-row__value {
  font-size: 13px;
  font-weight: 500;
  color: var(--slate-900);
  flex: 1;
  min-width: 0;
  word-break: break-all;
}
.contact-row__action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--slate-200);
  color: var(--emerald-700);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}
.contact-row__action:hover {
  background: var(--emerald-50);
  border-color: var(--emerald-500);
}
.contact-row__action svg {
  color: var(--emerald-600);
}

/* ===== Ricorrenza box (form nuova prenotazione) ===== */
.recurring-box {
  padding: 12px 14px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
}
.recurring-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-700);
  cursor: pointer;
  user-select: none;
}
.recurring-toggle input {
  margin: 0;
  width: 16px;
  height: 16px;
  accent-color: var(--emerald-500);
  cursor: pointer;
}
.recurring-options {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--slate-200);
  font-size: 13px;
  color: var(--slate-700);
}
.recurring-options[hidden] { display: none; }
.recurring-weeks {
  width: auto;
  min-width: 140px;
  padding: 6px 10px;
  font-size: 13px;
}
.recurring-hint {
  font-size: 11px;
  color: var(--slate-500);
  font-style: italic;
  flex-basis: 100%;
}

/* Tag "ricorrente" nel titolo modal */
.series-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--emerald-50);
  color: var(--emerald-700);
  border-radius: 10px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Avviso ricorrenza nel modal */
.series-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: var(--emerald-50);
  border: 1px solid var(--emerald-100);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--emerald-700);
  margin-bottom: 16px;
}
.series-notice svg { flex-shrink: 0; color: var(--emerald-600); margin-top: 1px; }

/* Dialog scope (Solo questa / Future / Tutte) */
.scope-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.scope-option {
  text-align: left;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scope-option:hover {
  border-color: var(--emerald-500);
  background: var(--emerald-50);
}
.scope-option strong {
  font-size: 13px;
  color: var(--slate-900);
}
.scope-option span {
  font-size: 12px;
  color: var(--slate-500);
}
.scope-option:hover strong { color: var(--emerald-700); }

/* Lista conflitti */
.conflicts-list {
  margin: 0;
  padding: 8px 12px 8px 28px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--slate-700);
  max-height: 200px;
  overflow-y: auto;
}
.conflicts-list li {
  margin-bottom: 4px;
}

/* Icona ricorrenza nella card prenotazione */
.booking__recurring-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--b-color);
  opacity: 0.85;
}

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: auto;
}
.modal__header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--slate-900);
}
.modal__close {
  background: none;
  border: none;
  color: var(--slate-400);
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.modal__close:hover { background: var(--slate-100); color: var(--slate-900); }
.modal__body { padding: 24px; }
.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--slate-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--slate-50);
  flex-wrap: wrap;
}
.modal__footer > div[style*="flex:1"] {
  /* Su mobile lo spacer non occupa spazio per non rompere il wrap */
}
@media (max-width: 640px) {
  .modal__footer {
    padding: 12px 16px;
    flex-wrap: wrap;
    justify-content: stretch;
  }
  .modal__footer .btn {
    flex: 1 1 calc(50% - 4px);
    justify-content: center;
    min-width: 0;
    padding: 10px 8px;
  }
  /* I divider invisibili (spacer) si annullano */
  .modal__footer > div[style*="flex:1"] { display: none; }
}

/* ===== Login page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #ecfdf5 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 32px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.login-brand .brand__logo { width: 40px; height: 40px; }
.login-brand .brand__name { font-size: 17px; }
.login-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--slate-900);
}
.login-subtitle {
  font-size: 13px;
  color: var(--slate-500);
  margin: 0 0 24px;
}
.login-form .form-group { margin-bottom: 14px; }
.login-form .btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--slate-700);
  margin: 4px 0 18px;
  cursor: pointer;
  user-select: none;
}
.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--emerald-500);
  cursor: pointer;
}

/* Chips suggerimenti prezzo */
.price-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.price-suggestions:empty { display: none; }
.price-chip {
  padding: 3px 9px;
  border-radius: 12px;
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  color: var(--slate-700);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.price-chip:hover {
  background: var(--emerald-50);
  border-color: var(--emerald-500);
  color: var(--emerald-700);
}

/* ===== Pagina config campionato ===== */
.config-section {
  padding: 20px 24px;
  margin-bottom: 16px;
}
.config-section__head { margin-bottom: 16px; }
.config-section__head h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  color: var(--slate-900);
}
.config-section__head p {
  margin: 0;
  font-size: 12px;
  color: var(--slate-500);
}
.config-teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.config-team-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.config-team-card:hover { border-color: var(--slate-400); }
.config-team-card.is-enrolled {
  border-color: var(--emerald-500);
  background: var(--emerald-50);
}
.config-team-card input { margin: 0; accent-color: var(--emerald-500); cursor: pointer; }
.config-team-color {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--slate-200);
  overflow: hidden;
}
.config-team-color > div {
  width: 100%;
  height: 100%;
}
.config-team-name { font-size: 13px; font-weight: 500; color: var(--slate-900); }

.slot-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.slot-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
  font-size: 13px;
}
.slot-row__field { font-weight: 600; color: var(--slate-900); }
.slot-row__day { font-weight: 600; color: var(--slate-700); }
.slot-row__time { font-family: 'Inter', monospace; color: var(--slate-600); }
.slot-empty {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--slate-400);
  font-style: italic;
}
.slot-add-form {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  padding: 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
}
.slot-add-form .form-select,
.slot-add-form .form-input { padding: 6px 10px; font-size: 13px; }
.team-prefs {
  padding: 14px;
  margin-bottom: 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
}
.team-prefs__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--slate-900);
}
.team-prefs .slot-row { background: #fff; }
.team-prefs .slot-add-form {
  grid-template-columns: 1fr 1fr 1fr auto;
  background: #fff;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ===== Calendario partite campionato ===== */
.matchday-card { padding: 16px 20px; margin-bottom: 12px; }
.matchday-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--slate-200);
  padding-bottom: 10px;
}
.matchday-card__title { font-size: 14px; font-weight: 700; margin: 0; color: var(--slate-900); }
.matchday-card__date { margin: 2px 0 0; font-size: 12px; color: var(--slate-500); }
.matchday-list { display: flex; flex-direction: column; gap: 4px; }
/* ===== Match row (calendario campionato) =====
   Layout: [G#] [meta=data/ora/campo] [teams flex 3col] [risultato] [badge] [azioni]
   I "teams" internamente sono 3 colonne: home (a destra) | vs | away (a sinistra)
   in modo che il "vs" sia sempre in colonna e i nomi non saltino. */
.match-row {
  display: grid;
  grid-template-columns: 28px minmax(180px, 230px) minmax(280px, 1fr) 60px auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
  font-size: 13px;
}
.match-row--rest {
  grid-template-columns: 28px 1fr;
  background: #fafbfc;
}
.match-row.has-warning { background: #fffbeb; border-left: 3px solid #f59e0b; }
.match-row.is-published { background: #f0fdf4; }

.match-row__round-no {
  font-weight: 700;
  color: var(--slate-400);
  font-size: 11px;
}

.match-row__meta {
  display: flex;
  gap: 10px;
  align-items: center;
  white-space: nowrap;
}
.match-row__date,
.match-row__time {
  font-weight: 600;
  font-family: 'Inter', monospace;
  color: var(--slate-700);
}
.match-row__field {
  color: var(--slate-600);
  font-size: 12px;
}

/* Teams: griglia simmetrica con vs sempre al centro.
   1fr | auto | 1fr → home a destra, vs centrato, away a sinistra */
.match-row__teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.match-row__home {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}
.match-row__away {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-width: 0;
}
.match-row__team-name {
  font-weight: 500;
  color: var(--slate-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.match-row__vs {
  color: var(--slate-400);
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}

.team-pill {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--slate-200);
}

.match-row__result {
  text-align: center;
  min-width: 56px;
}
.match-row__score {
  display: inline-block;
  font-weight: 700;
  color: var(--slate-900);
  padding: 2px 8px;
  background: #fff;
  border-radius: 6px;
}
.match-row__badges {
  display: flex;
  gap: 4px;
  align-items: center;
}
.match-row__actions {
  display: flex;
  gap: 2px;
  align-items: center;
}
.match-warning {
  color: #b45309;
  font-size: 16px;
  cursor: help;
}
.match-published-badge {
  color: #15803d;
  font-weight: 700;
  font-size: 14px;
}

/* Responsive: sotto i 900px la riga va su 2 livelli */
@media (max-width: 900px) {
  .match-row {
    grid-template-columns: auto 1fr auto auto auto;
    grid-template-areas:
      "round meta result badges actions"
      "teams teams teams teams teams";
    gap: 6px 8px;
  }
  .match-row__round-no { grid-area: round; }
  .match-row__meta { grid-area: meta; flex-wrap: wrap; gap: 6px; font-size: 12px; }
  .match-row__teams { grid-area: teams; padding-top: 4px; }
  .match-row__result { grid-area: result; }
  .match-row__badges { grid-area: badges; }
  .match-row__actions { grid-area: actions; }
}

/* ===== Classifica ===== */
.standings-table th { text-align: center; }
.standings-table td { text-align: center; }
.standings-table td:nth-child(2) { text-align: left; }
.standings-table td:last-child {
  font-size: 15px;
}

/* Stats grid 3 colonne */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}
.stats-card { padding: 16px 20px; }
.stats-card h3 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 700;
  color: var(--slate-900);
}
.stats-empty {
  margin: 0;
  font-size: 12px;
  color: var(--slate-400);
  font-style: italic;
  text-align: center;
  padding: 12px;
}
.stats-table th, .stats-table td {
  padding: 6px 8px;
  font-size: 12px;
}
.stats-table th { font-size: 10px; }

/* ===== Modal risultato partita ===== */
.result-score-box {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
  background: var(--slate-50);
  border-radius: var(--radius);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.score-side {
  display: flex;
  align-items: center;
  gap: 8px;
}
.score-side__name {
  font-weight: 700;
  color: var(--slate-900);
  font-size: 14px;
}
.score-input {
  width: 64px;
  height: 44px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius);
  background: #fff;
  color: var(--slate-900);
}
.score-vs {
  font-size: 20px;
  font-weight: 700;
  color: var(--slate-400);
}

.result-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--slate-200);
  margin-bottom: 14px;
}
.result-tab {
  background: none;
  border: none;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.result-tab:hover { color: var(--slate-900); }
.result-tab.is-active {
  color: var(--emerald-700);
  border-bottom-color: var(--emerald-500);
}

.event-list {
  margin-bottom: 14px;
  max-height: 240px;
  overflow-y: auto;
}
.event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
  margin-bottom: 4px;
  font-size: 13px;
}
.event-row__main { flex: 1; }
.event-row__team {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-400);
  padding: 2px 6px;
  background: #fff;
  border-radius: 4px;
}
.event-empty {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--slate-400);
  font-style: italic;
}

.event-add-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  flex-wrap: wrap;
}
.event-add-form .form-select,
.event-add-form .form-input { padding: 6px 10px; font-size: 13px; }
.event-add-form .form-select { flex: 1; min-width: 140px; }

@media (max-width: 640px) {
  .event-add-form { flex-direction: column; align-items: stretch; }
  .event-add-form .form-input { width: auto !important; }
  .result-score-box { gap: 10px; }
  .score-side__name { font-size: 12px; }
}
@media (max-width: 768px) {
  .slot-add-form,
  .team-prefs .slot-add-form { grid-template-columns: 1fr 1fr; }
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .app {
    display: block;  /* annullo il flex per non allocare spazio alla sidebar */
  }
  .sidebar {
    position: fixed !important;
    top: 0; left: 0;
    width: 256px;
    height: 100vh;
    height: 100dvh; /* dynamic viewport: tiene conto della barra browser mobile */
    transform: translateX(-100%);
    transition: transform 0.3s;
    z-index: 50;
    box-shadow: 2px 0 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
  .sidebar__user {
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 1;
  }
  .topbar { display: flex !important; }
  .main {
    padding: 72px 16px 20px;
    max-width: none;
    width: 100%;
  }
  .day-cell { min-height: 80px; padding: 6px; }
  /* Su mobile riabilito scroll orizzontale e ricalcolo sticky col top della topbar */
  .day-view__scroll { overflow-x: auto; }
  .day-grid__head { top: 56px; }

  /* Page header su mobile: titolo a tutta larghezza, bottoni sotto */
  .page-header {
    flex-direction: column;
    align-items: stretch;
  }
  .page-header__actions {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }
  .page-header__title-row {
    flex: 1;
  }
  /* Nuova prenotazione bottone su mobile: ben visibile e leggibile */
  #newBookingBtn {
    padding: 10px 16px;
  }
}
@media (max-width: 640px) {
  .month-grid__head > div { padding: 8px 4px; font-size: 10px; }
  .day-cell { min-height: 60px; padding: 4px; }
  .day-cell__indicator { display: none; }
  .day-cell__count { display: none; }
  .day-cell__dot {
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px; height: 5px;
    border-radius: 50%;
  }
  .page-header__title { font-size: 18px; }
  .main { padding: 64px 12px 20px; }
}

/* ============================================================
   SEZIONE CALENDARI (championship_browse.php)
   ============================================================ */
.browse-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.browse-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-xl);
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
  box-shadow: var(--shadow-sm);
}
.browse-card:hover {
  border-color: var(--emerald-500);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.browse-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--emerald-50);
  color: var(--emerald-700);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.browse-card__color {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--slate-200);
  overflow: hidden;
  flex-shrink: 0;
}
.browse-card__color > div { width: 100%; height: 100%; }
.browse-card__body { flex: 1; min-width: 0; }
.browse-card__body h3 {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-900);
}
.browse-card__meta {
  font-size: 12px;
  color: var(--slate-500);
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.browse-card__arrow {
  color: var(--slate-300);
  flex-shrink: 0;
}

/* Barra statistiche squadra */
.team-stats-bar {
  display: flex;
  gap: 24px;
  padding: 14px 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.team-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.team-stat__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--slate-400);
  font-weight: 600;
}
.team-stat strong {
  font-size: 16px;
  color: var(--slate-700);
}

/* Lista partite della squadra */
.team-match-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.team-match {
  display: grid;
  grid-template-columns: 32px 70px 50px 80px 1fr 100px 80px 14px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--slate-50);
  border-radius: var(--radius);
  font-size: 13px;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
}
.team-match:hover { background: var(--slate-100); }
.team-match__round {
  font-weight: 700;
  color: var(--slate-400);
  font-size: 11px;
}
.team-match__date,
.team-match__time { font-family: 'Inter', monospace; color: var(--slate-700); }
.team-match__loc { font-size: 11px; color: var(--slate-500); }
.team-match__opp { color: var(--slate-900); }
.team-match__field { font-size: 11px; color: var(--slate-500); }
.team-match__result {
  padding: 4px 10px;
  border-radius: 6px;
  background: #fff;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  min-width: 70px;
}
.team-match__result--w { background: #dcfce7; color: #15803d; }
.team-match__result--l { background: #fee2e2; color: #dc2626; }
.team-match__result--d { background: #fef3c7; color: #b45309; }
.team-match__result--pending {
  background: #f1f5f9;
  color: var(--slate-500);
  font-weight: 500;
  font-size: 11px;
}
.team-match__arrow { color: var(--slate-300); }

@media (max-width: 900px) {
  .team-match {
    grid-template-columns: auto auto auto 1fr auto;
    gap: 8px;
  }
  .team-match__time,
  .team-match__field { display: none; }
}

/* ============================================================
   DETTAGLIO PARTITA (championship_browse.php?view=detail)
   ============================================================ */
.match-detail { padding: 24px; margin-bottom: 16px; }
.match-detail__meta {
  text-align: center;
  font-size: 13px;
  color: var(--slate-500);
  margin-bottom: 14px;
}
.match-detail__teams {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 20px;
  align-items: center;
}
.match-detail__team {
  display: flex;
  align-items: center;
  gap: 12px;
}
.match-detail__team:first-child { justify-content: flex-end; }
.match-detail__team:last-child { justify-content: flex-start; }
.match-detail__team h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--slate-900);
}
.team-pill--lg {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--slate-200);
}
.match-detail__score {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 36px;
  font-weight: 800;
  color: var(--slate-900);
}
.match-detail__score .score-vs { font-size: 24px; color: var(--slate-300); }
.match-detail__pending {
  font-size: 14px;
  font-weight: 500;
  color: var(--slate-500);
  padding: 6px 16px;
  background: var(--slate-100);
  border-radius: var(--radius);
}

.match-detail-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.event-detail-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.event-detail-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--slate-50);
  border-radius: var(--radius);
  margin-bottom: 4px;
  font-size: 13px;
}
.ev-minute {
  display: inline-block;
  padding: 2px 6px;
  background: #fff;
  border-radius: 4px;
  font-size: 11px;
  font-family: 'Inter', monospace;
  color: var(--slate-600);
}
.ev-team {
  font-size: 11px;
  color: var(--slate-400);
  text-transform: lowercase;
}

@media (max-width: 640px) {
  .match-detail__teams { grid-template-columns: 1fr; gap: 10px; }
  .match-detail__team { justify-content: center !important; }
  .match-detail__score { justify-content: center; }
}

/* ============================================================
   MODAL WARNING (per modifica partita con risultato)
   ============================================================ */
.modal-warning {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #92400e;
  line-height: 1.5;
}
.modal-warning strong { color: #b45309; }

/* ============================================================
   GHOST HEADER campi (sticky mobile via JS)
   ============================================================ */
.day-head-ghost {
  position: fixed;
  top: 56px;
  z-index: 99;
  overflow: hidden;
  background: #fff;
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 4px 8px rgba(0,0,0,0.08);
  pointer-events: none;
  display: none;
}
@media (max-width: 1024px) {
  .day-head-ghost { display: block; }
}
.day-head-ghost .day-grid__head {
  position: static;
  box-shadow: none;
  border-bottom: none;
}

/* Toggle responsive tabelle: nascosto su desktop */
.row-toggle { display: none; }

/* ============================================================
   DATA-TABLE RESPONSIVE: card collapsibili su mobile
   Logica: il JS marca con classe .td-actions la cella che contiene
   .row-actions, e con .td-primary le prime 2 di dati. Le altre
   sono "secondary" e si espandono al click del toggle.
   ============================================================ */
@media (max-width: 640px) {
  /* Nascondo header table su mobile */
  .data-table thead { display: none; }

  /* Trasformo ogni riga in card */
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    background: #fff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    position: relative;
    display: flex;
    flex-direction: column;
  }
  .data-table tr:hover { background: #fff; }

  /* Ordine nella scheda: nome, telefono, (email espandibile), azioni in fondo */
  .data-table td.td-primary-1 { order: 1; }
  .data-table td.td-primary-2 { order: 2; }
  .data-table td.td-secondary { order: 3; }
  .data-table td.td-actions   { order: 4; }

  .data-table td {
    padding: 0;
    border: none;
    text-align: left !important;
  }

  /* PRIMA cella primary: nome principale */
  .data-table td.td-primary-1 {
    font-weight: 600;
    color: var(--slate-900);
    font-size: 15px;
    margin-bottom: 4px;
    padding-right: 38px; /* spazio per il toggle */
  }
  /* SECONDA cella primary: sotto-nome */
  .data-table td.td-primary-2 {
    color: var(--slate-500);
    font-size: 13px;
    margin-bottom: 4px;
  }

  /* Celle secondary: nascoste di default, mostrate quando .is-expanded */
  .data-table td.td-secondary {
    display: none;
    padding: 4px 0;
    font-size: 13px;
    color: var(--slate-600);
  }
  .data-table tr.is-expanded td.td-secondary {
    display: block;
  }
  .data-table tr.is-expanded td.td-secondary::before {
    content: attr(data-label);
    display: inline-block;
    min-width: 90px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slate-400);
    font-weight: 600;
    margin-right: 6px;
  }

  /* Cella azioni: SEMPRE visibile in fondo alla card */
  .data-table td.td-actions {
    display: block;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--slate-100);
  }
  .data-table td.td-actions.is-empty { display: none; }
  .data-table .row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  /* Su mobile la row-action ha un'area cliccabile piu' grande */
  .row-action {
    padding: 8px;
    background: var(--slate-50);
  }
  .row-action svg { width: 16px; height: 16px; }

  /* Toggle expand */
  .data-table tr .row-toggle {
    display: flex;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    border: none;
    background: var(--slate-100);
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--slate-600);
    transition: transform 0.2s;
    padding: 0;
    z-index: 2;
  }
  .data-table tr.is-expanded .row-toggle {
    transform: rotate(180deg);
  }
  /* Riga senza colonne secondarie da espandere: niente toggle */
  .data-table tr.no-secondary .row-toggle { display: none; }
  .data-table tr.no-secondary td.td-primary-1 { padding-right: 0; }
}

/* ============================================================
   CESTINO - tabs
   ============================================================ */
.trash-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 2px solid var(--slate-200);
  overflow-x: auto;
}
.trash-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-500);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: all 0.15s;
}
.trash-tab:hover { color: var(--slate-900); }
.trash-tab.is-active {
  color: var(--emerald-700);
  border-bottom-color: var(--emerald-500);
}
.trash-tab__count {
  background: var(--slate-200);
  color: var(--slate-700);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}
.trash-tab.is-active .trash-tab__count {
  background: var(--emerald-100);
  color: var(--emerald-700);
}
@media (max-width: 640px) {
  .trash-tab { padding: 8px 10px; font-size: 12px; }
  .trash-tab svg { width: 14px; height: 14px; }
}

/* ============================================================
   LOG - filtri e paginazione
   ============================================================ */
.log-filters {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.log-filters .form-select,
.log-filters .form-input {
  min-width: 160px;
  padding: 6px 10px;
  font-size: 13px;
}
.log-filters .form-input { flex: 1; min-width: 200px; }
.pagination {
  margin-top: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
}
.pagination__info { font-size: 13px; color: var(--slate-500); }
.pagination__btn.is-disabled { opacity: 0.45; pointer-events: none; }

/* ============================================================
   PREFERENZE SQUADRE nel modal modifica partita
   ============================================================ */
.team-prefs-box {
  margin: 12px 0;
  padding: 12px 14px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius);
  font-size: 12px;
}
.team-prefs-box__title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #0369a1;
  margin-bottom: 8px;
}
.team-prefs-box__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 6px;
}
.team-prefs-box__row:last-child { margin-bottom: 0; }
.team-prefs-box__team {
  font-weight: 600;
  color: var(--slate-900);
  flex-shrink: 0;
  min-width: 130px;
}
.team-prefs-box__slots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.team-prefs-box__slot {
  background: #fff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--slate-700);
}
.team-prefs-box__slot strong { color: #0369a1; }
.team-prefs-box__none {
  font-style: italic;
  color: var(--slate-400);
  font-size: 11px;
}
@media (max-width: 640px) {
  .team-prefs-box__row { flex-direction: column; gap: 4px; }
  .team-prefs-box__team { min-width: 0; }
}

/* ============================================================
   Preferenze non rispettate: warning nel calendario squadra
   ============================================================ */

/* Banner sopra la lista partite */
.team-pref-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  color: #92400e;
  font-size: 13px;
}
.team-pref-banner__icon {
  font-size: 20px;
  flex-shrink: 0;
}
.team-pref-banner strong { color: #b45309; }
.team-pref-banner__hint {
  display: block;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
  margin-top: 2px;
}

/* Riga partita con preferenza non rispettata */
.team-match.has-pref-warning {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.team-match.has-pref-warning:hover { background: #fef3c7; }
.team-match__warn {
  color: #b45309;
  font-size: 16px;
  font-weight: 700;
  cursor: help;
  margin: 0 4px;
}

/* Badge warning sulla card squadra (vista teams) */
.browse-card__warn {
  display: inline-block;
  padding: 2px 8px;
  background: #fef3c7;
  color: #b45309;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* Calendario header: mobile - tutto su una riga compatta */
@media (max-width: 768px) {
  .calendar-actions {
    gap: 4px !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    width: 100%;
  }
  .calendar-actions .btn { padding: 6px 10px; font-size: 12px; }
  .calendar-actions .nav-arrow { padding: 6px; }
  .calendar-actions .nav-arrow svg { width: 14px; height: 14px; }
  .calendar-actions .btn-today { padding: 6px 10px; }
  .calendar-actions .btn-new-booking { padding: 6px 10px; }
  .calendar-actions .btn-new-booking svg { width: 14px; height: 14px; }
  .calendar-actions .btn-new-booking__label { display: none; }
  .calendar-actions .btn-new-booking::after {
    content: 'Nuova';
    margin-left: 4px;
  }
  .calendar-actions .btn-divider { display: none; }
}
@media (max-width: 480px) {
  .calendar-actions .btn-today { padding: 6px 8px; font-size: 11px; }
}

/* ============================================================
   Dropdown stampa (calendario campionato)
   ============================================================ */
.dropdown-print { position: relative; display: inline-block; }
.dropdown-print__menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 220px;
  z-index: 30;
  padding: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.dropdown-print.is-open .dropdown-print__menu { display: block; }
.dropdown-print__menu a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--slate-700);
  text-decoration: none;
  border-radius: 4px;
}
.dropdown-print__menu a:hover {
  background: var(--slate-50);
  color: var(--slate-900);
}
.dropdown-print__divider {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-400);
  border-top: 1px solid var(--slate-100);
  margin-top: 4px;
}

/* ============================================================
   Stat cards (pagina sicurezza)
   ============================================================ */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate-500);
  font-weight: 600;
}
.stat-card__value {
  font-size: 24px;
  font-weight: 700;
  color: var(--slate-900);
  margin-top: 4px;
}
.stat-card--good { border-left: 3px solid #15803d; }
.stat-card--good .stat-card__value { color: #15803d; }
.stat-card--bad { border-left: 3px solid #dc2626; }
.stat-card--bad .stat-card__value { color: #dc2626; }

/* Nota criteri di parità sotto la classifica */
.tie-break-hint {
  margin: 10px 4px 0;
  font-size: 11px;
  color: var(--slate-500);
  line-height: 1.5;
}
.tie-break-hint strong { color: var(--slate-700); }

/* Righe in classifica con ex aequo: marker "=" accanto alla posizione */
.tied-marker {
  display: inline-block;
  margin-left: 4px;
  color: #b45309;
  font-weight: 700;
  font-size: 11px;
  vertical-align: super;
  cursor: help;
}
.is-tied-row td:first-child {
  position: relative;
}

/* ============================================================
   BULK EDIT giocatori + badge certificato medico
   ============================================================ */
.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  margin-bottom: 0;
  background: #f9fafb;
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 1px solid var(--slate-200);
  flex-wrap: wrap;
}
.bulk-toolbar__hint {
  font-size: 12px;
  color: var(--slate-500);
  font-style: italic;
}
#bulkEditToggle.is-active {
  background: var(--amber-500);
  color: #fff;
  border-color: var(--amber-500);
}
.bulk-actions {
  padding: 14px 16px;
  background: #f9fafb;
  border-top: 1px solid var(--slate-200);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.players-table .cell-editable { vertical-align: middle; }
.players-table .cell-input {
  padding: 4px 8px;
  font-size: 13px;
  width: 100%;
  min-width: 110px;
}

/* Badge certificato medico */
.badge-medical {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-medical--missing { background:#e5e7eb;color:#6b7280; }
.badge-medical--expired { background:#fee2e2;color:#b91c1c; }
.badge-medical--soon    { background:#fef3c7;color:#b45309; }
.badge-medical--ok      { background:#d1fae5;color:#047857; }

/* Righe con certificato in scadenza/scaduto */
.row-medical-expired td { background:rgba(254,226,226,0.35); }
.row-medical-soon td    { background:rgba(254,243,199,0.35); }

/* Banner riepilogo certificati */
.medical-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: var(--radius);
  color: var(--slate-800);
  font-size: 13px;
}
.medical-banner__icon { font-size: 20px; flex-shrink: 0; }
.medical-banner__link {
  color: var(--emerald-700);
  text-decoration: underline;
  font-size: 12px;
  margin-left: 4px;
}

/* Hint sotto il titolo delle stats-card (es. spiegazione formula) */
.stats-card__hint {
  margin: -4px 0 8px;
  font-size: 11px;
  color: var(--slate-500);
  font-style: italic;
}

/* ============================================================
   DESIGNAZIONI arbitri
   ============================================================ */
.assignments-table .cell-referee { min-width: 200px; }
.referee-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.assignments-table tbody tr:hover { background: #f9fafb; }

/* ============================================================
   STATISTICHE
   ============================================================ */
.stats-period-form {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.stats-kpi { margin-bottom: 18px; }
.stat-card__sub {
  font-size: 11px;
  color: var(--slate-500);
  margin-top: 4px;
  line-height: 1.4;
}

/* Sezioni */
.page-section {
  margin: 24px 0;
}
.page-section__title {
  font-size: 16px;
  margin: 0 0 12px;
  color: var(--slate-800);
}
.page-section__hint {
  font-size: 12px;
  color: var(--slate-500);
  margin: -4px 0 8px;
}

/* Comparison grid (campionati vs affittuari) */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 280px;
  gap: 12px;
}
@media (max-width: 1024px) {
  .comparison-grid { grid-template-columns: 1fr 1fr; }
  .comparison-grid > :nth-child(3) { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .comparison-grid { grid-template-columns: 1fr; }
}
.comparison-card { padding: 0; overflow: hidden; }
.comparison-card__head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--slate-200);
  border-left: 4px solid var(--slate-300);
}
.comparison-card__head h3 { margin: 0; font-size: 14px; }
.comparison-card__hint {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--slate-500);
}
.comparison-card__body { padding: 18px; }
.big-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--slate-900);
  line-height: 1.1;
}
.big-num__sub {
  font-size: 12px;
  color: var(--slate-500);
  margin-top: 2px;
  margin-bottom: 14px;
}
.kv-list { list-style: none; padding: 0; margin: 0; }
.kv-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-top: 1px solid var(--slate-100);
  font-size: 13px;
}
.kv-list li span { color: var(--slate-500); }

/* 2 colonne per i grafici */
.stats-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 900px) { .stats-row-2 { grid-template-columns: 1fr; } }

/* Heatmap */
.heatmap-wrap { overflow-x: auto; }
.heatmap {
  border-collapse: separate;
  border-spacing: 3px;
  width: 100%;
  font-size: 11px;
}
.heatmap th {
  font-weight: 600;
  color: var(--slate-500);
  font-size: 10px;
  text-align: center;
  padding: 4px;
  min-width: 32px;
}
.heatmap thead th { text-transform: uppercase; }
.heatmap tbody th {
  text-align: right;
  padding-right: 8px;
}
.heatmap td {
  text-align: center;
  padding: 6px 4px;
  border-radius: 3px;
  font-weight: 600;
  min-width: 32px;
  height: 28px;
}

/* Bar chart orizzontale */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 130px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.bar-row__label {
  font-weight: 500;
  color: var(--slate-800);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-row__track {
  background: var(--slate-100);
  border-radius: 4px;
  height: 20px;
  overflow: hidden;
}
.bar-row__fill {
  height: 100%;
  background: var(--emerald-500);
  border-radius: 4px;
  transition: width 0.3s ease;
}
.bar-row__value {
  font-weight: 600;
  color: var(--slate-900);
  text-align: right;
}
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 90px 1fr 100px; gap: 6px; font-size: 11px; }
}

/* Grafico mensile a barre verticali */
.month-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 180px;
  margin-bottom: 4px;
  padding: 0 4px;
}
.month-chart__col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: default;
  min-width: 0;
}
.month-chart__bar {
  width: 100%;
  background: #1e40af;
  border-radius: 3px 3px 0 0;
  position: relative;
  min-height: 2px;
  transition: filter 0.15s;
}
.month-chart__col:hover .month-chart__bar { filter: brightness(1.1); }
.month-chart__champ {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: #047857;
  border-radius: 3px 3px 0 0;
}
.month-chart__label {
  font-size: 10px;
  color: var(--slate-500);
  margin-top: 4px;
  text-transform: uppercase;
  font-weight: 600;
}
.month-chart__val {
  font-size: 9px;
  color: var(--slate-700);
  margin-top: 1px;
  font-weight: 600;
}

/* Insights peak slot */
.stats-insights {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
@media (max-width: 640px) { .stats-insights { grid-template-columns: 1fr; } }
.insight-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.insight-card h4 {
  margin: 0 0 8px;
  font-size: 13px;
}
.insight-card ul {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: var(--slate-700);
}
.insight-card li { padding: 4px 0; }

.stats-empty {
  font-size: 12px;
  color: var(--slate-400);
  font-style: italic;
  text-align: center;
  padding: 20px;
}

/* ============================================================
   FILTRI in linea (riutilizzabile)
   ============================================================ */
.filters-inline {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap;
}
.filters-inline .form-select { min-width: 160px; }
@media (max-width: 720px) {
  .filters-inline { flex-wrap: wrap; }
}

/* Form-card: card che contiene un form, con padding interno generoso */
.form-card {
  padding: 24px 28px;
}
.form-card .field-checkboxes {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.form-card .field-checkbox {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.3;
}

/* Bulk toolbar: actions a destra (sostituisce la barra in basso) */
.bulk-toolbar__actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ============================================================
   ADMIN MENU (dropdown nel calendario)
   ============================================================ */
.admin-menu {
  position: relative;
  display: inline-block;
}
.admin-menu__toggle {
  display: inline-flex;
  align-items: center;
}
.admin-menu__dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 280px;
  padding: 6px;
  z-index: 50;
}
.admin-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  color: var(--slate-700);
  font-size: 13px;
  transition: background 0.12s;
}
.admin-menu__item:hover { background: var(--slate-50); }
.admin-menu__item-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.admin-menu__item strong { display: block; color: var(--slate-900); font-size: 13px; }
.admin-menu__item small { display: block; color: var(--slate-500); font-size: 11px; margin-top: 2px; }

/* Banner "partite non pubblicate" */
.unpublished-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 14px;
  background: #fef3c7;
  border: 1px solid #fbbf24;
  border-left: 4px solid #b45309;
  border-radius: var(--radius);
  color: #78350f;
  font-size: 13px;
  line-height: 1.5;
}
.unpublished-banner__icon { font-size: 22px; flex-shrink: 0; }
.unpublished-banner strong { color: #78350f; }

/* Riepilogo bulk delete preview */
.bd-summary {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 16px;
}
.bd-summary__numbers {
  font-size: 13px;
  color: var(--slate-700);
}
.bd-summary__numbers > div { padding: 2px 0; }
.bd-summary__numbers strong { color: #b91c1c; font-size: 14px; }
.bd-summary__list {
  list-style: none;
  padding: 8px 0 0;
  margin: 10px 0 0;
  border-top: 1px solid #fecaca;
  font-size: 12px;
  color: var(--slate-600);
  max-height: 200px;
  overflow-y: auto;
}
.bd-summary__list li { padding: 2px 0; }

/* Bottone danger */
.btn--danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}
.btn--danger:hover:not(:disabled) {
  background: #b91c1c;
  border-color: #b91c1c;
}
.btn--danger:disabled {
  background: #fca5a5;
  border-color: #fca5a5;
  cursor: not-allowed;
}

/* Layout 2/3 + 1/3 per coppa disciplina + squalifiche */
.stats-row-2-1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.stats-row-2-1 + .stats-row-2 { margin-top: 0; }
.stats-row-2 { margin-bottom: 12px; }

@media (max-width: 900px) {
  .stats-row-2-1 { grid-template-columns: 1fr; }
}

/* ============================================================
   REFEREE WORKFLOW
   ============================================================ */

/* Badge contatore sidebar */
.nav__badge {
  margin-left: auto;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

/* Pagina link arbitri - card per token */
.referee-tokens-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}
.referee-token-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.referee-token-card.is-revoked { opacity: 0.6; }
.referee-token-card.is-complete { border-color: #10b981; background: #f0fdf4; }
.referee-token-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.referee-token-card__head h3 { margin: 0; font-size: 15px; color: var(--slate-900); }
.referee-token-card__head p { margin: 4px 0 0; font-size: 12px; color: var(--slate-500); }
.referee-token-card__url {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.referee-token-card__url .form-input {
  font-size: 11px;
  font-family: monospace;
  flex: 1;
  min-width: 0;
}
.referee-token-card__meta {
  margin: 0;
  font-size: 11px;
  color: var(--slate-500);
}
.referee-token-card__actions {
  border-top: 1px solid var(--slate-100);
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
}

/* Pagina validazioni */
.validations-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.validation-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.validation-card__head {
  border-bottom: 1px solid var(--slate-100);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.validation-card__meta {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--slate-500);
}
.validation-card__title {
  margin: 0;
  font-size: 18px;
  color: var(--slate-900);
}
.validation-card__score {
  display: inline-block;
  margin: 0 12px;
  font-weight: 800;
  color: #10b981;
}
.validation-card__sub {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--slate-600);
}
.validation-card__body {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  margin-bottom: 14px;
}
@media (max-width: 800px) {
  .validation-card__body { grid-template-columns: 1fr; }
}
.validation-card__col h4 {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--slate-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.validation-events {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.validation-events li {
  padding: 4px 0;
  border-bottom: 1px solid var(--slate-100);
}
.validation-events li:last-child { border-bottom: 0; }
.validation-events small {
  color: var(--slate-500);
  font-size: 11px;
  margin-left: 4px;
}
.validation-card__notes {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.validation-card__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.validation-reject-form {
  flex-basis: 100%;
  margin-top: 10px;
}

/* ============================================================
   REFEREE APP - interfaccia mobile arbitro
   Questa pagina viene caricata SENZA il chrome del CMS (no sidebar, no header)
   ============================================================ */
body.referee-app {
  margin: 0;
  background: #f8fafc;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;
  color: var(--slate-900);
  -webkit-font-smoothing: antialiased;
}

.ref-header {
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff;
  padding: 20px 18px;
  text-align: center;
}
.ref-header h1 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.ref-header p { margin: 0; font-size: 13px; opacity: 0.95; }

.ref-header--match {
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
}
.ref-header__main { flex: 1; min-width: 0; }
.ref-header__meta { margin: 0 0 4px; font-size: 11px; opacity: 0.9; }
.ref-header__title { margin: 0; font-size: 16px; font-weight: 700; }
.ref-vs-inline { font-weight: 400; opacity: 0.7; margin: 0 6px; font-size: 13px; }

.ref-back {
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  padding: 4px 0;
  display: inline-block;
}

.ref-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px 14px 80px;
}

.ref-info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
}

.ref-match-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ref-match-card {
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 60px 1fr 24px;
  gap: 12px;
  align-items: center;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  transition: transform 0.1s, box-shadow 0.1s;
}
.ref-match-card:active { transform: scale(0.99); }
.ref-match-card.ref-status--validated { opacity: 0.7; background: #f9fafb; }
.ref-match-card.ref-status--pending { border-color: #fbbf24; background: #fffbeb; }
.ref-match-card.ref-status--rejected { border-color: #f87171; background: #fef2f2; }

.ref-match-card__time {
  font-size: 20px;
  font-weight: 800;
  color: var(--slate-900);
  text-align: center;
  font-family: monospace;
}
.ref-match-card__main { min-width: 0; }
.ref-match-card__teams {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.ref-team {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ref-team-pill {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px var(--slate-200);
}
.ref-vs { color: var(--slate-400); font-weight: 600; font-size: 12px; }
.ref-score {
  font-weight: 800;
  font-size: 16px;
  color: #10b981;
  padding: 0 4px;
}
.ref-match-card__meta { font-size: 11px; color: var(--slate-500); margin-bottom: 6px; }
.ref-match-card__arrow { font-size: 18px; color: var(--slate-400); text-align: center; }

.ref-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.ref-status-badge.ref-status--draft { background: #e2e8f0; color: #475569; }
.ref-status-badge.ref-status--pending { background: #fef3c7; color: #b45309; }
.ref-status-badge.ref-status--validated { background: #d1fae5; color: #047857; }
.ref-status-badge.ref-status--rejected { background: #fee2e2; color: #dc2626; }

.ref-rejection-note {
  margin-top: 8px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 12px;
  color: #991b1b;
}

.ref-help {
  margin-top: 18px;
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--slate-500);
  line-height: 1.5;
}

/* === Edit partita === */
.ref-section { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px; }
.ref-section-title { margin: 0 0 10px; font-size: 14px; font-weight: 700; }

.ref-score-input {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}
.ref-score-side { flex: 1; text-align: center; }
.ref-score-side .ref-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--slate-500);
  margin-bottom: 4px;
  display: block;
}
.ref-score-field {
  width: 100%;
  height: 60px;
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  border: 2px solid var(--slate-200);
  border-radius: 10px;
  color: var(--slate-900);
  background: #fff;
}
.ref-score-field:focus {
  outline: none;
  border-color: #10b981;
}
.ref-score-separator {
  font-size: 28px;
  font-weight: 700;
  color: var(--slate-400);
  padding-top: 18px;
}

.ref-tabs {
  display: flex;
  background: #fff;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--slate-200);
}
.ref-tab {
  flex: 1;
  padding: 10px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--slate-600);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ref-tab.is-active {
  background: #10b981;
  color: #fff;
}

.ref-tab-content { background: #fff; border-radius: 10px; padding: 14px; margin-bottom: 12px; }

.ref-events-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ref-events-empty { margin: 0; color: var(--slate-400); font-size: 13px; text-align: center; padding: 14px 0; }
.ref-event-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--slate-50);
  border-radius: 8px;
}
.ref-event-icon { font-size: 18px; }
.ref-event-main { flex: 1; min-width: 0; font-size: 13px; }
.ref-event-main strong { display: block; }
.ref-event-main small { color: var(--slate-500); font-size: 11px; }
.ref-event-del {
  background: transparent;
  border: 0;
  color: #dc2626;
  font-size: 14px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
.ref-event-del:hover { background: #fee2e2; }

.ref-event-form {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--slate-50);
  border-radius: 8px;
}
.ref-event-form .ref-select,
.ref-event-form .ref-input {
  width: 100%;
}

.ref-select, .ref-input, .ref-textarea {
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid var(--slate-300);
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}
.ref-select:focus, .ref-input:focus, .ref-textarea:focus {
  outline: none;
  border-color: #10b981;
}
.ref-textarea { resize: vertical; min-height: 60px; width: 100%; box-sizing: border-box; }
.ref-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--slate-700);
}

.ref-btn {
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--slate-300);
  border-radius: 10px;
  background: #fff;
  color: var(--slate-700);
  cursor: pointer;
  text-align: center;
  min-height: 44px;
}
.ref-btn:active { transform: scale(0.98); }
.ref-btn--primary { background: #10b981; color: #fff; border-color: #10b981; }
.ref-btn--primary:active { background: #059669; }
.ref-btn--primary:disabled { background: #6ee7b7; cursor: not-allowed; }
.ref-btn--full { width: 100%; }

.ref-actions-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: #fff;
  border-radius: 10px;
  position: sticky;
  bottom: 8px;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
}

.referee-error {
  max-width: 480px;
  margin: 60px auto;
  text-align: center;
  padding: 30px 20px;
}
.referee-error__icon { font-size: 48px; margin-bottom: 12px; }
.referee-error h1 { margin: 0 0 10px; font-size: 22px; }
.referee-error p { color: var(--slate-600); margin: 6px 0; }

/* Tabella con righe espandibili (link arbitri) */
.row-expand-toggle {
  background: transparent;
  border: 0;
  font-size: 12px;
  color: var(--slate-500);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.row-expand-toggle:hover { background: var(--slate-100); color: var(--slate-900); }
.row-expand-toggle.is-open { color: var(--slate-900); }

.row-expand td {
  border-top: 0 !important;
}

/* Arbitri inline */
.referee-inline-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.referee-inline-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  font-size: 13px;
}
.referee-inline-item__name strong { display: inline; margin-right: 4px; }
.referee-inline-item__name small { color: var(--slate-500); font-size: 11px; }
.referee-inline-item__actions {
  display: flex;
  gap: 6px;
}
@media (max-width: 700px) {
  .referee-inline-item {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

/* Hint sotto il punteggio nella pagina arbitro */
.ref-score-hint {
  margin: 8px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--slate-500);
  line-height: 1.4;
}

/* Bottone secondario per "gol senza marcatore" */
.ref-btn--secondary {
  background: #fff;
  color: var(--slate-600);
  border-color: var(--slate-300);
  font-size: 13px;
  padding: 8px 12px;
}

/* Quando il punteggio è readonly mostriamo che non è editabile */
.ref-score-field[readonly] {
  background: #f8fafc;
  cursor: default;
}

/* Validations - checkbox e selezione */
.validation-card__check {
  display: flex;
  align-items: flex-start;
  padding-top: 4px;
  margin-right: 14px;
  cursor: pointer;
}
.validation-card__check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #10b981;
}
.validation-card__head {
  display: flex;
  align-items: flex-start;
}
.validation-card__head-text {
  flex: 1;
  min-width: 0;
}
.validation-card.is-selected {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Bulk checkbox label nel toolbar */
.bulk-checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}
.bulk-checkbox-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #10b981;
}
.bulk-toolbar__counter {
  font-size: 13px;
  color: var(--slate-600);
  margin-left: 14px;
}
.bulk-toolbar__counter strong {
  color: var(--slate-900);
  font-size: 15px;
}
.bulk-toolbar__left {
  display: flex;
  align-items: center;
  flex: 1;
}
