/* =========================================================
   VARIABILI & RESET
   ========================================================= */
:root {
  --bg: #f5f8fb;
  --card: rgba(255,255,255,0.94);
  --text: #12222f;
  --muted: #5e7281;
  --primary: #0F6391;
  --primary-dark: #0b4d71;
  --accent: #F7DB1F;
  --accent-dark: #d5b600;
  --success: #188a45;
  --danger: #c53b32;
  --warning: #c69300;
  --border: rgba(15,99,145,0.16);
  --shadow: 0 18px 50px rgba(15,99,145,0.10);
  --radius: 20px;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --sidebar-start: var(--primary);
  --sidebar-end: var(--primary-dark);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: radial-gradient(circle at top left, #edf5fa 0, #f8fbfd 42%, #f5f8fb 100%);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* =========================================================
   UTILITÀ
   ========================================================= */
.hidden { display: none !important; }
.top-space { margin-top: 16px; }
.full-width { width: 100%; }
.subtle { color: var(--muted); }
.error-text { color: var(--danger); font-size: 14px; }
.grow { flex: 1; }

/* =========================================================
   TOAST NOTIFICHE
   ========================================================= */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  pointer-events: all;
  min-width: 260px;
  max-width: 360px;
  padding: 14px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: toastIn 0.28s ease;
  background: #fff;
  border-left: 4px solid var(--primary);
  color: var(--text);
}
.toast.success { border-color: var(--success); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
.toast-icon { flex: 0 0 auto; font-size: 16px; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-close {
  flex: 0 0 auto;
  background: none;
  border: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 16px;
  padding: 0;
  cursor: pointer;
  line-height: 1;
  margin-left: 4px;
}
.toast-close:hover { transform: none; filter: none; color: var(--text); }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }

@keyframes toastIn  { from { opacity:0; transform: translateY(12px); } to { opacity:1; transform: translateY(0); } }
@keyframes toastOut { from { opacity:1; transform: translateY(0);    } to { opacity:0; transform: translateY(8px); } }

/* =========================================================
   LOGIN
   ========================================================= */
.overlay {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-overlay {
  background:
    radial-gradient(circle at top left, rgba(15,99,145,.14), transparent 30%),
    radial-gradient(circle at bottom right, rgba(247,219,31,.16), transparent 26%),
    linear-gradient(135deg, #f4f9fc 0%, #edf5fa 45%, #f8fbfd 100%);
}

.login-shell {
  width: min(1060px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 400px;
  gap: 24px;
  align-items: stretch;
}

.login-aside {
  padding: 42px 36px;
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(15,99,145,.96), rgba(11,77,113,.92));
  color: #fff;
  box-shadow: 0 22px 60px rgba(15,99,145,.20);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.login-aside::after {
  content: '';
  position: absolute;
  right: -50px; bottom: -50px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(247,219,31,.38), transparent 70%);
  pointer-events: none;
}

.login-logo-wrap { display: flex; justify-content: center; }
.login-center-logo {
  width: 100px; height: 100px;
  object-fit: contain;
  border-radius: 20px;
  background: rgba(255,255,255,.94);
  padding: 10px;
  box-shadow: 0 12px 28px rgba(0,0,0,.14);
}
.login-copy-box { position: relative; z-index: 1; }
.login-brand-badge {
  display: inline-flex;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 14px;
}
.login-aside h1 { margin: 0 0 10px; font-size: 38px; line-height: 1.08; letter-spacing: -.03em; }
.login-lead { margin: 0 0 22px; font-size: 16px; line-height: 1.6; color: rgba(255,255,255,.86); }

/* Feature list */
.login-features { display: grid; gap: 12px; }
.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255,255,255,.10);
  backdrop-filter: blur(4px);
}
.login-feature-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(247,219,31,.22);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 36px;
  color: #F7DB1F;
}
.login-feature strong { display: block; font-size: 14px; color: #fff; margin-bottom: 2px; }
.login-feature span   { font-size: 12px; color: rgba(255,255,255,.78); line-height: 1.45; }

.login-panel { align-self: center; }
.login-card { background: var(--card); border: 1px solid var(--border); border-radius: 24px; padding: 28px; box-shadow: var(--shadow); }
.login-panel h2 { margin: 0 0 6px; font-size: 28px; letter-spacing: -.02em; }
.login-form-grid { margin-top: 18px; }
.login-form-grid label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 13px; font-weight: 700; }
.login-submit { margin-top: 6px; width: 100%; padding: 14px 18px; font-size: 15px; justify-content: center; }
.soft-separator { border: 0; height: 1px; background: rgba(15,99,145,.12); margin: 18px 0; }
.login-contact-box {
  margin-top: 16px;
  padding: 13px 15px;
  border-radius: 15px;
  background: rgba(15,99,145,.06);
  border: 1px solid rgba(15,99,145,.12);
  display: grid;
  gap: 4px;
}
.login-contact-box strong { font-size: 13px; }
.login-contact-box a     { color: var(--primary); font-weight: 800; text-decoration: none; }
.login-contact-box small { color: var(--muted); line-height: 1.45; font-size: 12px; }

/* Badge cliente inattivo */
.member-inactive-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 11px;
  font-weight: 700;
  margin-left: 8px;
}
.member-list-item.inactive .ml-name { color: var(--muted); }
.member-list-item.inactive .ml-avatar { opacity: .5; }

/* =========================================================
   LAYOUT APP
   ========================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* top bar – solo mobile */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: linear-gradient(90deg, var(--sidebar-start), var(--sidebar-end));
  color: #fff;
  padding: 0 16px;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
  box-shadow: 0 2px 12px rgba(0,0,0,.14);
}
.mobile-topbar .brand-row { gap: 10px; }
.mobile-topbar #brand-title-mobile { font-weight: 800; font-size: 17px; }

.icon-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  color: inherit;
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover { background: rgba(255,255,255,.15); transform: none; filter: none; }

/* overlay per chiudere sidebar da mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 299;
}

/* =========================================================
   SIDEBAR
   ========================================================= */
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-start) 0%, var(--sidebar-end) 100%);
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: inset -1px 0 0 rgba(255,255,255,0.07);
}

.sidebar-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.sidebar-close { display: none; }

.sidebar h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; opacity: .72; margin: 0 0 4px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-btn {
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.07);
  color: white;
  cursor: pointer;
  text-align: left;
  font-weight: 700;
  font-size: 14px;
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background 0.15s, box-shadow 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,.14); transform: none; filter: none; box-shadow: none; }
.nav-btn.active {
  background: linear-gradient(135deg, var(--accent) 0%, #ffe867 100%);
  color: #12222f;
  box-shadow: 0 8px 20px rgba(247,219,31,.28);
}
.nav-btn.active svg { stroke: #12222f; }

.sidebar-footer { margin-top: auto; padding-top: 12px; }

.center-switch label { color: rgba(255,255,255,.82); font-size: 12px; font-weight: 700; display: block; margin-bottom: 4px; }

/* =========================================================
   CONTENT
   ========================================================= */
.content { padding: 28px; overflow-x: hidden; }
.tab { display: none; }
.tab.active { display: block; }

/* =========================================================
   BRAND
   ========================================================= */
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 10px; background: rgba(255,255,255,.92); padding: 4px; flex: 0 0 46px; }

/* =========================================================
   CARD
   ========================================================= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.hero-card { padding: 26px; position: relative; overflow: hidden; }
.hero-card::after {
  content: '';
  position: absolute;
  inset: auto -30px -30px auto;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(247,219,31,.28), transparent 70%);
  pointer-events: none;
}
.hero-top, .section-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.hero-strip { display: flex; gap: 10px; flex-wrap: wrap; margin: 0 0 16px; }
.hero-pill { padding: 8px 14px; border-radius: 999px; background: rgba(247,219,31,.22); color: #7f6900; font-weight: 700; font-size: 13px; }
.hero-pill.alt { background: rgba(15,99,145,.10); color: var(--primary); }

.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-kicker { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--primary); font-weight: 800; margin-bottom: 8px; }

/* =========================================================
   FORM & INPUT
   ========================================================= */
button, input, select, textarea { padding: 11px 14px; border-radius: 13px; border: 1px solid var(--border); font: inherit; font-size: 14px; }

button {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: 0;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(15,99,145,.20);
  transition: transform 0.12s, filter 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
button:hover:not(:disabled) { filter: brightness(1.04); transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; filter: none; }
button.secondary { background: rgba(15,99,145,.08); color: var(--primary); box-shadow: none; border: 1px solid rgba(15,99,145,.18); }
button.secondary:hover:not(:disabled) { background: rgba(15,99,145,.14); }
button.primary.big { padding: 14px 20px; font-size: 15px; }

input, select, textarea { width: 100%; background: rgba(255,255,255,.96); border-color: rgba(15,99,145,.18); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,99,145,.12); }
textarea { min-height: 88px; resize: vertical; }

.form-grid { display: grid; gap: 12px; }
.form-grid.two-cols { grid-template-columns: 1fr 1fr; }
.form-grid .full-span, .full-span { grid-column: 1 / -1; }

.field-stack { display: grid; gap: 12px; }
.inline-field { display: flex; flex-direction: column; gap: 5px; }
.inline-field label, .form-grid label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field-help { color: var(--muted); font-size: 13px; margin-top: -4px; }

.hero-actions, .row, .inline-search { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-field.grow { flex: 1; }

.checkbox-line { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; cursor: pointer; }
.checkbox-line input[type="checkbox"] { width: auto; flex: 0 0 auto; }

.color-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.color-row input[type="color"] { padding: 4px 6px; height: 44px; cursor: pointer; }

.inline-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* =========================================================
   CHECK-IN AREA
   ========================================================= */
.checkin-layout { max-width: 1200px; }

.member-card {
  min-height: 120px;
  border: 1px dashed rgba(15,99,145,.22);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(240,247,252,.96));
  margin-bottom: 16px;
}
.member-card.empty { color: var(--muted); display: flex; align-items: center; font-style: italic; }
.member-name { font-size: 24px; font-weight: 900; margin-bottom: 8px; letter-spacing: -0.02em; }
.member-meta { color: var(--muted); display: grid; gap: 4px; font-size: 14px; }

.checkin-search-wrap { margin-top: 4px; }
.checkin-search-wrap label { font-size: 13px; font-weight: 700; color: var(--muted); display: block; margin-bottom: 6px; }

.search-results { margin-top: 8px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: white; }
.search-item { padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 14px; }
.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: rgba(15,99,145,.06); }

/* Bottoni conferma check-in */
.consume-options { display: flex; flex-direction: column; gap: 8px; }
.btn-confirm-main { padding: 14px 18px; font-size: 15px; }
.btn-checkin-only { font-size: 13px; padding: 10px 14px; }

.status-text { color: var(--muted); margin-top: 12px; font-size: 14px; }

/* =========================================================
   STATUS BADGE
   ========================================================= */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.status-badge.neutral { background: rgba(15,99,145,.10); color: var(--primary); }
.status-badge.success { background: #dcfce7; color: #166534; }
.status-badge.error   { background: #fee2e2; color: #991b1b; }
.status-badge.warning { background: #ffedd5; color: #9a3412; }

/* =========================================================
   TABELLE
   ========================================================= */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 480px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr.clickable:hover { background: rgba(15,99,145,.05); cursor: pointer; }
.empty-row { color: var(--muted); text-align: center; padding: 20px; }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.mini-btn { padding: 7px 10px; border-radius: 9px; font-size: 12px; }

/* =========================================================
   UID ROW
   ========================================================= */
.uid-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: end;
}
.uid-action-btn { white-space: nowrap; align-self: end; }

/* =========================================================
   STAT BOX
   ========================================================= */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-box { padding: 16px; border: 1px solid var(--border); border-radius: 15px; background: #f8fbff; }
.stat-box span { display: block; color: var(--muted); margin-bottom: 4px; font-size: 13px; }
.stat-box strong { font-size: 30px; font-weight: 900; }

/* =========================================================
   SETTINGS
   ========================================================= */
.settings-logo { max-width: 200px; max-height: 110px; object-fit: contain; border: 1px solid var(--border); border-radius: 12px; background: white; padding: 8px; }
.logo-preview-wrap { display: flex; align-items: center; justify-content: center; }
.logo-preview-wrap.compact { justify-content: flex-start; margin-top: 8px; }
.center-logo-block { display: grid; gap: 8px; }
.settings-note { border-left: 4px solid var(--accent); padding: 12px 14px; background: rgba(247,219,31,.10); border-radius: 12px; font-size: 14px; }
.neutral-note { border-left-color: var(--primary); background: rgba(15,99,145,.07); }
code { display: inline-block; background: #eef3fb; padding: 5px 9px; border-radius: 7px; font-size: 13px; }

/* =========================================================
   GRIDS
   ========================================================= */
.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* =========================================================
   CHECK-IN — NUOVO DESIGN
   ========================================================= */

/* Zona lettura + ricerca */
.ci-read-area {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.ci-read-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.ci-read-btn {
  padding: 12px 20px;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.ci-status-text {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.ci-read-right {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.ci-search-wrap {
  position: relative;
}
.ci-search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.ci-search-input {
  width: 100%;
  padding: 11px 14px 11px 34px;
  border-radius: 13px;
  border: 1px solid rgba(15,99,145,.18);
  background: rgba(255,255,255,.96);
  font: inherit;
  font-size: 14px;
  color: var(--text);
}
.ci-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15,99,145,.12);
}

/* Hero cliente */
.ci-member-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--border);
  border-radius: 18px;
  margin-bottom: 12px;
  box-shadow: 0 4px 14px rgba(15,99,145,.07);
  flex-wrap: wrap;
}
.ci-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(15,99,145,.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 800;
  flex: 0 0 48px;
  letter-spacing: -.02em;
}
.ci-member-info { flex: 1; min-width: 0; }
.ci-member-name { font-size: 18px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.ci-member-sub  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.ci-cert {
  font-size: 12px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.ci-cert.ok   { background: #dcfce7; color: #166534; }
.ci-cert.warn { background: #ffedd5; color: #9a3412; }
.ci-cert.err  { background: #fee2e2; color: #991b1b; }
.ci-badge { margin-left: auto; }

/* Griglia check-in */
.ci-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
}

/* Card pacchetti */
.ci-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 12px;
}
.ci-pkg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.ci-pkg-item:last-child { border-bottom: none; padding-bottom: 0; }
.ci-pkg-name { font-size: 14px; font-weight: 700; color: var(--text); }
.ci-pkg-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.ci-pkg-units { text-align: right; flex: 0 0 auto; }
.ci-pkg-num   { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1; }
.ci-pkg-lbl   { font-size: 11px; color: var(--muted); }
.ci-empty-msg { font-size: 13px; color: var(--muted); font-style: italic; padding: 12px 0; }

/* Card operazione */
.ci-op-card { display: flex; flex-direction: column; }
.ci-btn-main {
  width: 100%;
  justify-content: center;
  padding: 13px 16px;
  font-size: 14px;
  margin-bottom: 8px;
}
.ci-btn-ghost {
  width: 100%;
  padding: 10px 16px;
  border-radius: 13px;
  border: 1px solid rgba(15,99,145,.18);
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  box-shadow: none;
}
.ci-btn-ghost:hover { background: rgba(15,99,145,.05); transform: none; filter: none; }

/* =========================================================
   CLIENTI — NUOVO DESIGN
   ========================================================= */

.members-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.members-search-wrap {
  flex: 1;
  position: relative;
}
.members-new-btn { white-space: nowrap; flex: 0 0 auto; }

.members-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  align-items: start;
}

/* Lista clienti */
.members-list-card { padding: 8px; }
.member-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .12s;
}
.member-list-item:hover   { background: rgba(15,99,145,.06); }
.member-list-item.active  { background: rgba(15,99,145,.10); }
.ml-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(15,99,145,.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex: 0 0 36px;
}
.ml-name { font-size: 13px; font-weight: 700; color: var(--text); }
.ml-card { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ml-cert-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-left: auto;
  flex: 0 0 8px;
}
.ml-cert-dot.ok   { background: #22c55e; }
.ml-cert-dot.warn { background: #f97316; }
.ml-cert-dot.err  { background: #ef4444; }
.ml-cert-dot.none { background: var(--border); }

/* Detail card */
.members-detail-card { min-height: 420px; }

.member-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.md-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: rgba(15,99,145,.12);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  flex: 0 0 46px;
}
.md-name { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.md-sub  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.md-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Tabs dettaglio cliente */
.md-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin: 14px -22px 0;
  padding: 0 22px;
}
.md-tab {
  padding: 9px 16px;
  border: none;
  background: none;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
}
.md-tab:hover  { color: var(--text); background: none; transform: none; filter: none; }
.md-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.md-pane { display: none; padding-top: 16px; }
.md-pane.active { display: block; }

/* Assegna pacchetto */
.md-assign-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

/* Package cards nel dettaglio */
.md-pkg-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background: rgba(248,251,255,.9);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 8px;
}
.md-pkg-info { flex: 1; min-width: 0; }
.md-pkg-name { font-size: 14px; font-weight: 700; color: var(--text); }
.md-pkg-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.md-pkg-bar  { height: 4px; border-radius: 2px; background: var(--border); overflow: hidden; }
.md-pkg-fill { height: 100%; border-radius: 2px; background: var(--primary); transition: width .3s; }
.md-pkg-progress-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.md-pkg-progress-row .md-pkg-bar { flex: 1; margin-top: 0; }
.md-pkg-pct { font-size: 11px; font-weight: 700; color: var(--muted); flex: 0 0 auto; min-width: 28px; text-align: right; }
.md-pkg-units-detail { font-size: 11px; color: var(--muted); margin-top: 3px; }

button.secondary.danger-secondary { color: var(--danger); border-color: rgba(197,59,50,.3); }
button.secondary.danger-secondary:hover { background: rgba(197,59,50,.08); }
.md-pkg-units { text-align: right; flex: 0 0 auto; }
.md-pkg-num   { font-size: 22px; font-weight: 900; color: var(--text); line-height: 1; }
.md-pkg-tot   { font-size: 11px; color: var(--muted); }

/* Movimenti */
.md-mov-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.md-mov-item:last-child { border-bottom: none; }
.md-mov-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: 0 0 8px;
}
.md-mov-dot.consume { background: #ef4444; opacity: .75; }
.md-mov-dot.checkin { background: #22c55e; opacity: .75; }
.md-mov-desc { flex: 1; color: var(--text); }
.md-mov-date { color: var(--muted); font-size: 12px; white-space: nowrap; }
.md-mov-qty  { font-weight: 700; min-width: 28px; text-align: right; }
.md-mov-qty.minus { color: #ef4444; }
.md-mov-qty.zero  { color: var(--muted); }

/* Stato vuoto */
.member-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  line-height: 1.6;
}

/* =========================================================
   REPORT — DASHBOARD
   ========================================================= */
.rpt-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.rpt-kpi {
  background: rgba(248,251,255,.95);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
}
.rpt-kpi-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.rpt-kpi-value { font-size: 32px; font-weight: 900; color: var(--text); line-height: 1; letter-spacing: -.02em; }
.rpt-kpi-delta { font-size: 12px; margin-top: 5px; font-weight: 600; color: var(--muted); }
.rpt-kpi-delta.pos  { color: var(--success); }
.rpt-kpi-delta.neg  { color: var(--danger); }

.rpt-charts-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 12px;
  margin-bottom: 12px;
}
.rpt-donut-wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}
.rpt-cat-legend {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.rpt-cat-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}
.rpt-cat-legend-dot {
  width: 10px; height: 10px;
  border-radius: 3px;
  flex: 0 0 10px;
}
.rpt-cat-legend-item strong { color: var(--text); margin-left: 4px; }

.rpt-alerts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* alert items */
.rpt-alert-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.rpt-alert-item:last-child { border-bottom: none; padding-bottom: 0; }
.rpt-alert-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.rpt-alert-dot.err  { background: #ef4444; }
.rpt-alert-dot.warn { background: #f97316; }
.rpt-alert-dot.ok   { background: #22c55e; }
.rpt-alert-name { font-size: 13px; font-weight: 700; color: var(--text); }
.rpt-alert-sub  { font-size: 12px; color: var(--muted); margin-top: 1px; }
.rpt-alert-date { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 600; }

/* recent items */
.rpt-recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.rpt-recent-item:last-child { border-bottom: none; padding-bottom: 0; }
.rpt-recent-av {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(15,99,145,.12);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800;
  flex: 0 0 34px;
}
.rpt-recent-name { font-size: 13px; font-weight: 700; color: var(--text); }
.rpt-recent-sub  { font-size: 12px; color: var(--muted); margin-top: 1px; }
.rpt-recent-date { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.rpt-recent-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: #dcfce7;
  color: #166534;
  white-space: nowrap;
}

.rpt-empty { font-size: 13px; color: var(--muted); font-style: italic; padding: 10px 0; }

/* =========================================================
   PACCHETTI — CARD DESIGN
   ========================================================= */
.tpl-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.tpl-search-wrap { flex: 1; min-width: 160px; position: relative; }
.tpl-filter-btn {
  padding: 9px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
  white-space: nowrap;
}
.tpl-filter-btn:hover  { background: rgba(15,99,145,.06); transform: none; filter: none; }
.tpl-filter-btn.active { background: rgba(15,99,145,.10); color: var(--primary); border-color: rgba(15,99,145,.3); }

.tpl-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.tpl-card {
  background: rgba(255,255,255,.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  border-left-width: 4px;
  cursor: default;
  transition: box-shadow .15s;
}
.tpl-card:hover { box-shadow: 0 4px 18px rgba(15,99,145,.10); }
.tpl-card.scope-shared { border-left-color: #3b82f6; }
.tpl-card.scope-local  { border-left-color: #8b5cf6; }
.tpl-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.tpl-card-name { font-size: 14px; font-weight: 800; color: var(--text); }
.tpl-scope-badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; flex: 0 0 auto;
}
.tpl-scope-badge.shared { background: #eff6ff; color: #1d4ed8; }
.tpl-scope-badge.local  { background: #f5f3ff; color: #6d28d9; }
.tpl-card-cat { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.tpl-card-stats { display: flex; gap: 16px; }
.tpl-stat-n { font-size: 20px; font-weight: 900; color: var(--text); line-height: 1; }
.tpl-stat-l { font-size: 11px; color: var(--muted); margin-top: 2px; }

.tpl-form-panel { margin-bottom: 16px; }
.tpl-form-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.tpl-form-header h3 { margin: 0; }

.tpl-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; margin-top: 4px;
}

.cat-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.cat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  background: rgba(248,251,255,.95);
  border: 1px solid var(--border);
  border-radius: 14px;
}
.cat-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 36px;
  font-size: 16px;
}
.cat-icon.blue   { background: #eff6ff; color: #1d4ed8; }
.cat-icon.purple { background: #f5f3ff; color: #6d28d9; }
.cat-icon.green  { background: #f0fdf4; color: #166534; }
.cat-icon.amber  { background: #fffbeb; color: #92400e; }
.cat-icon.coral  { background: #fff1f2; color: #be123c; }
.cat-icon.gray   { background: rgba(15,99,145,.08); color: var(--primary); }
.cat-card-name { font-size: 13px; font-weight: 700; color: var(--text); }
.cat-card-sub  { font-size: 12px; color: var(--muted); margin-top: 1px; }
.cat-card-count { margin-left: auto; font-size: 22px; font-weight: 900; color: var(--text); }

/* =========================================================
   PRINT FRIENDLY
   ========================================================= */
@media print {
  .sidebar, .mobile-topbar { display: none !important; }
  .content { padding: 0; }
  .app-shell { display: block; }
}

/* =========================================================
   RESPONSIVE — TABLET (≤ 960px)
   ========================================================= */
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding-top: var(--topbar-h);
  }

  .mobile-topbar { display: flex; }

  /* sidebar slide-in da sinistra */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: min(var(--sidebar-w), 80vw);
    z-index: 300;
    transform: translateX(-110%);
    transition: transform 0.28s cubic-bezier(.4,0,.2,1);
    height: 100vh;
    padding-top: 20px;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }

  .grid.two,
  .form-grid.two-cols,
  .login-shell { grid-template-columns: 1fr; }

  .login-aside { padding: 28px 22px; }
  .login-aside h1 { font-size: 30px; }
  .login-lead { font-size: 15px; }
  .login-features { gap: 10px; }
  .login-feature { padding: 10px 12px; }
  .login-feature-icon { width: 32px; height: 32px; flex: 0 0 32px; }

  .content { padding: 16px; }

  .uid-row { grid-template-columns: 1fr; }
  .uid-action-btn { width: 100%; }

  .hero-actions { flex-direction: column; align-items: stretch; }
  .hero-actions button { width: 100%; justify-content: center; }

  .stats-grid { grid-template-columns: 1fr 1fr; }

  /* report responsive */
  .rpt-kpi-grid    { grid-template-columns: 1fr 1fr; }
  .rpt-charts-row  { grid-template-columns: 1fr; }
  .rpt-alerts-grid { grid-template-columns: 1fr; }

  /* pacchetti responsive */
  .tpl-cards-grid { grid-template-columns: 1fr 1fr; }
  .cat-cards-grid { grid-template-columns: 1fr 1fr; }
  .tpl-toolbar    { gap: 6px; }

  /* check-in responsive */
  .ci-grid { grid-template-columns: 1fr; }
  .ci-read-area { flex-direction: column; align-items: stretch; gap: 12px; }
  .ci-read-left { flex-wrap: wrap; gap: 10px; }
  .ci-read-btn { width: 100%; justify-content: center; }
  .ci-read-right { min-width: 100%; }
  .ci-badge { margin-left: 0; }

  /* clienti responsive */
  .members-layout { grid-template-columns: 1fr; }
  .members-list-card { max-height: 280px; overflow-y: auto; }
  .members-toolbar { flex-wrap: wrap; }
  .members-new-btn { width: 100%; justify-content: center; }
}

/* =========================================================
   RESPONSIVE — MOBILE (≤ 600px)
   ========================================================= */
@media (max-width: 600px) {
  .rpt-kpi-grid   { grid-template-columns: 1fr 1fr; }
  .tpl-cards-grid { grid-template-columns: 1fr; }
  .cat-cards-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }

  .row, .inline-actions { flex-direction: column; }
  .row button, .inline-actions button { width: 100%; justify-content: center; }

  .hero-strip { gap: 6px; }
  .hero-pill  { font-size: 12px; padding: 6px 10px; }

  .consume-options { gap: 8px; }
  .btn-confirm-main, .btn-checkin-only { width: 100%; justify-content: center; }

  .card { padding: 16px; border-radius: 16px; }

  #toast-container { bottom: 12px; right: 12px; left: 12px; }
  .toast { max-width: 100%; }
}

/* =========================================================
   PRENOTAZIONI — GRIGLIA E MODALE
   ========================================================= */

/* Toolbar */
.bk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.bk-date-nav { display: flex; align-items: center; gap: 8px; }
.bk-arrow { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
.bk-date-input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  cursor: pointer;
}
.bk-toolbar-actions { display: flex; gap: 8px; }

/* Griglia */
.bk-grid-wrap { overflow-x: auto; padding: 0 !important; }

.bk-grid {
  min-width: 600px;
  display: grid;
  border-radius: 16px;
  overflow: hidden;
}

/* Header riga (slot orari) */
.bk-header-row {
  display: contents;
}
.bk-corner {
  background: var(--sidebar-start);
  color: rgba(255,255,255,.7);
  font-size: 11px;
  font-weight: 700;
  padding: 10px 14px;
  display: flex;
  align-items: center;
}
.bk-slot-header {
  background: var(--sidebar-start);
  color: rgba(255,255,255,.9);
  font-size: 11px;
  font-weight: 700;
  padding: 10px 6px;
  text-align: center;
  border-left: 1px solid rgba(255,255,255,.1);
  white-space: nowrap;
}

/* Righe campo */
.bk-court-row { display: contents; }

.bk-court-label {
  background: var(--card);
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.bk-court-label-name { font-size: 13px; font-weight: 800; color: var(--text); }
.bk-court-label-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bk-court-indoor-badge {
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(15,99,145,.10); color: var(--primary);
}

/* Celle slot */
.bk-slot-cell {
  min-height: 62px;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
  position: relative;
  display: flex;
  align-items: stretch;
}
.bk-slot-cell:hover { background: rgba(15,99,145,.05); }

.bk-slot-empty {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}
.bk-slot-empty:hover { color: var(--primary); }
.bk-slot-empty svg { opacity: .5; }

.bk-slot-booked {
  width: 100%;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-radius: 0;
}
.bk-slot-booked.payment-package { background: rgba(15,99,145,.10); border-left: 3px solid var(--primary); }
.bk-slot-booked.payment-cash    { background: rgba(247,219,31,.18); border-left: 3px solid #b8a010; }
.bk-slot-booked.payment-guest   { background: rgba(100,116,139,.10); border-left: 3px solid #64748b; }

.bk-slot-who  { font-size: 12px; font-weight: 800; color: var(--text); line-height: 1.2; }
.bk-slot-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Gestione campi */
.courts-list-wrap { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 10px; }
.court-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.court-card-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: rgba(15,99,145,.10); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 36px;
}
.court-card-name { font-size: 13px; font-weight: 800; color: var(--text); }
.court-card-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.court-card-actions { margin-left: auto; display: flex; gap: 6px; }
.court-card-actions button { padding: 6px 10px; font-size: 12px; }

/* Modale */
.bk-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.bk-modal {
  width: min(480px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 20px !important;
  padding: 22px !important;
}
.bk-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.bk-modal-header h3 { margin: 0; font-size: 18px; }

/* Toggle tipo cliente / pagamento */
.bk-client-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 12px;
}
.bk-type-btn {
  flex: 1;
  padding: 9px 14px;
  border: none;
  background: none;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
  box-shadow: none;
}
.bk-type-btn:hover  { background: rgba(15,99,145,.06); transform: none; filter: none; }
.bk-type-btn.active { background: rgba(15,99,145,.12); color: var(--primary); }

/* Membro selezionato nel modale */
.bk-member-selected {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(15,99,145,.07);
  border-radius: 12px;
  border: 1px solid rgba(15,99,145,.18);
  margin-top: 6px;
}
.bk-member-selected-av {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(15,99,145,.15);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex: 0 0 32px;
}
.bk-member-selected-name { font-size: 13px; font-weight: 800; color: var(--text); }
.bk-member-selected-card { font-size: 11px; color: var(--muted); }
.bk-member-clear {
  margin-left: auto;
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 4px;
}

/* Dettaglio prenotazione nel modale */
.bk-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.bk-detail-item { }
.bk-detail-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; }
.bk-detail-value { font-size: 14px; font-weight: 800; color: var(--text); }

/* Responsive */
@media (max-width: 860px) {
  .courts-list-wrap { grid-template-columns: 1fr 1fr; }
  .bk-toolbar { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 600px) {
  .courts-list-wrap { grid-template-columns: 1fr; }
  .bk-modal { padding: 16px !important; }
}

/* =========================================================
   ADMIN — CARD CENTRI E UTENTI
   ========================================================= */
.admin-section-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.admin-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

/* Card Centro */
.admin-center-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  transition: box-shadow .15s;
}
.admin-center-card:hover { box-shadow: 0 4px 20px rgba(15,99,145,.10); }
.admin-center-card.inactive { opacity: .65; }
.admin-center-color-bar {
  height: 72px;
  display: flex; align-items: center; justify-content: center;
}
.admin-center-logo-thumb { height: 48px; border-radius: 10px; background: rgba(255,255,255,.9); padding: 6px; }
.admin-center-code { font-size: 22px; font-weight: 900; color: rgba(255,255,255,.9); letter-spacing: .06em; }
.admin-center-body { padding: 14px 16px 10px; }
.admin-center-name { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 3px; }
.admin-center-meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.admin-center-colors { display: flex; gap: 6px; }
.admin-color-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.1); }
.admin-card-actions { display: flex; gap: 6px; padding: 10px 16px 14px; border-top: 1px solid var(--border); }
.admin-card-actions button { flex: 1; padding: 8px 10px; font-size: 12px; }

/* Card Utente */
.admin-user-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: box-shadow .15s;
}
.admin-user-card:hover { box-shadow: 0 4px 18px rgba(15,99,145,.08); }
.admin-user-card.inactive { opacity: .6; }
.admin-user-av {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex: 0 0 40px;
}
.avc-coral  { background: #FAECE7; color: #993C1D; }
.avc-blue   { background: #E6F1FB; color: #185FA5; }
.avc-gray   { background: rgba(15,99,145,.10); color: var(--primary); }
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-size: 14px; font-weight: 800; color: var(--text); margin-bottom: 5px; }
.admin-user-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-role-badge { padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.role-coral  { background: #FAECE7; color: #993C1D; }
.role-blue   { background: #E6F1FB; color: #185FA5; }
.role-gray   { background: rgba(15,99,145,.10); color: var(--primary); }
.admin-user-centers { font-size: 12px; color: var(--muted); }
.admin-user-card .admin-card-actions { flex-direction: column; padding: 0; border: none; }
.admin-user-card .admin-card-actions button { padding: 6px 10px; font-size: 11px; }

/* =========================================================
   SELF-BOOKING — TOGGLE CLIENTE
   ========================================================= */
.self-booking-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  background: rgba(15,99,145,.05);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 10px;
}
.self-booking-label { font-size: 14px; font-weight: 700; color: var(--text); }
.self-booking-sub   { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; cursor: pointer; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track-sw {
  display: block; width: 44px; height: 24px;
  background: var(--border); border-radius: 999px;
  transition: background .2s;
  position: relative;
}
.toggle-switch input:checked + .toggle-track-sw { background: var(--primary); }
.toggle-thumb {
  position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .2s; box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-track-sw .toggle-thumb { transform: translateX(20px); }

.self-booking-actions {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(22,163,74,.06);
  border: 1px solid rgba(22,163,74,.2);
  border-radius: 12px;
  margin-bottom: 10px;
}
.self-booking-pin {
  font-size: 13px; font-weight: 700;
  color: var(--primary);
  font-family: monospace;
  letter-spacing: .1em;
}
.self-booking-actions button { flex: 0 0 auto; padding: 8px 14px; font-size: 12px; }

/* Responsive admin */
@media (max-width: 1024px) {
  .admin-cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .admin-cards-grid { grid-template-columns: 1fr; }
}

.avc-teal { background: #E1F5EE; color: #0F6E56; }
.role-teal { background: #E1F5EE; color: #0F6E56; }

/* =========================================================
   INCASSI GIORNALIERI — CHECK-IN
   ========================================================= */
.cash-section { padding: 0 !important; overflow: hidden; }

.cash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 10px;
}
.cash-header-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.cash-date-input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  width: auto;
  margin: 0;
}
.cash-refresh-btn { padding: 8px 10px !important; }

/* Riga prenotazione */
.cash-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background .12s;
}
.cash-item:last-child { border-bottom: none; }
.cash-item.paid { background: rgba(22,163,74,.04); }
.cash-item.paid .cash-item-name { color: var(--muted); text-decoration: line-through; opacity: .6; }

.cash-item-time {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  min-width: 44px;
  flex: 0 0 44px;
}
.cash-item-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(15,99,145,.12);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
  flex: 0 0 32px;
}
.cash-item.paid .cash-item-avatar { background: rgba(22,163,74,.12); color: var(--success); }
.cash-item-info { flex: 1; min-width: 0; }
.cash-item-name { font-size: 13px; font-weight: 800; color: var(--text); }
.cash-item-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; }

.cash-paid-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: rgba(22,163,74,.12);
  color: var(--success);
  white-space: nowrap;
  flex: 0 0 auto;
}
.cash-item-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.btn-mark-paid {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(22,163,74,.3);
  background: rgba(22,163,74,.08);
  color: var(--success);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.btn-mark-paid:hover { background: rgba(22,163,74,.15); }
.btn-unmark-paid {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: all .15s;
}
.btn-unmark-paid:hover { color: var(--danger); border-color: rgba(197,59,50,.3); }

/* Badge contatore */
.cash-pending-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 0 5px;
  margin-left: 4px;
}

@media (max-width: 700px) {
  .cash-header { padding: 12px 14px; }
  .cash-item   { padding: 10px 14px; gap: 10px; }
  .btn-mark-paid { padding: 6px 10px; font-size: 11px; }
}

/* =========================================================
   LISTA PRENOTAZIONI — TAB BOOKINGS
   ========================================================= */
.bk-list-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.bk-list-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.bk-list-filters {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.bk-list-select {
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 10px;
  font: inherit; font-size: 13px; color: var(--text); background: var(--card);
  margin: 0; width: auto;
}

/* Riga prenotazione nella lista */
.bk-list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.bk-list-item:last-child { border-bottom: none; }
.bk-list-item:hover { background: rgba(15,99,145,.03); }
.bk-list-item.cancelled { opacity: .55; }

.bk-list-date {
  flex: 0 0 90px; text-align: center;
  background: rgba(15,99,145,.07); border-radius: 10px;
  padding: 8px 6px;
}
.bk-list-date-day   { font-size: 18px; font-weight: 900; color: var(--primary); line-height: 1; }
.bk-list-date-month { font-size: 11px; color: var(--muted); font-weight: 700;
                      text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }
.bk-list-item.cancelled .bk-list-date { background: rgba(100,116,139,.08); }
.bk-list-item.cancelled .bk-list-date-day { color: var(--muted); }

.bk-list-body { flex: 1; min-width: 0; }
.bk-list-who  { font-size: 13px; font-weight: 800; color: var(--text); }
.bk-list-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.bk-list-right { display: flex; flex-direction: column; align-items: flex-end;
                 gap: 5px; flex: 0 0 auto; }
.bk-list-time  { font-size: 13px; font-weight: 800; color: var(--text); }

.bk-status-badge {
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.bk-status-confirmed { background: rgba(22,163,74,.10); color: var(--success); }
.bk-status-cancelled { background: rgba(100,116,139,.10); color: var(--muted); }

.bk-pay-badge {
  padding: 2px 8px; border-radius: 999px; font-size: 10px; font-weight: 700;
}
.bk-pay-package { background: #eff6ff; color: #1d4ed8; }
.bk-pay-cash    { background: #fef9c3; color: #854d0e; }
.bk-pay-cash-paid { background: rgba(22,163,74,.10); color: var(--success); }

@media (max-width: 700px) {
  .bk-list-header  { padding: 12px 14px; }
  .bk-list-item    { padding: 10px 14px; gap: 10px; }
  .bk-list-date    { flex: 0 0 70px; }
  .bk-list-filters { gap: 6px; }
  .bk-list-filters .cash-date-input { font-size: 12px; padding: 6px 8px; }
}

/* =========================================================
   QUOTE GIOCATORI — INCASSI DEL GIORNO
   ========================================================= */
.cash-players-list {
  display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px;
}
.cash-player-chip {
  display: inline-flex; align-items: center;
  background: rgba(15,99,145,.07);
  border: 1px solid rgba(15,99,145,.15);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px; font-weight: 600; color: var(--primary);
  white-space: nowrap;
}
.cash-item.paid .cash-player-chip {
  background: rgba(22,163,74,.07);
  border-color: rgba(22,163,74,.2);
  color: var(--success);
  opacity: .7;
}
.cash-cost-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 7px; padding-top: 7px;
  border-top: 1px dashed var(--border);
  flex-wrap: wrap; gap: 4px;
}
.cash-cost-label { font-size: 11px; color: var(--muted); }
.cash-cost-total {
  font-size: 13px; font-weight: 900; color: var(--primary);
  background: rgba(15,99,145,.08);
  padding: 2px 10px; border-radius: 999px;
}
.cash-cost-total.paid {
  color: var(--success);
  background: rgba(22,163,74,.10);
}

/* =========================================================
   MODALE INCASSO
   ========================================================= */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 201;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  width: min(520px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.modal-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  padding: 20px 20px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-sub   { font-size: 12px; color: var(--muted); margin-top: 3px; }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; padding: 2px 6px;
  border-radius: 6px; line-height: 1;
}
.modal-close:hover { background: var(--hover); color: var(--text); }

/* Slot giocatore */
.pm-slots { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }

.pm-slot {
  border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  transition: border-color .15s, background .15s;
}
.pm-slot.paid {
  border-color: rgba(22,163,74,.35);
  background: rgba(22,163,74,.04);
}
.pm-slot.booker { border-style: solid; }
.pm-slot-header {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.pm-slot-index {
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(15,99,145,.1); color: var(--primary);
  font-size: 11px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 22px;
}
.pm-slot.paid .pm-slot-index {
  background: rgba(22,163,74,.15); color: var(--success);
}
.pm-slot-name {
  flex: 1; font-size: 13px; font-weight: 700;
  color: var(--text);
}
.pm-slot-quota {
  font-size: 14px; font-weight: 900; color: var(--primary);
  flex: 0 0 auto;
}
.pm-slot.paid .pm-slot-quota { color: var(--success); }

.pm-slot-fields {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 8px; align-items: center;
}
.pm-slot-fields input[type="text"] {
  font-size: 12px; padding: 7px 10px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  width: 100%;
}
.pm-type-select {
  font-size: 12px; padding: 7px 8px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font: inherit; white-space: nowrap;
}
.pm-paid-toggle {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  color: var(--muted); cursor: pointer;
  white-space: nowrap; user-select: none;
}
.pm-paid-toggle input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--success); }
.pm-paid-toggle.checked { color: var(--success); }

/* Footer modale */
.pm-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
  position: sticky; bottom: 0; background: var(--card);
}
.pm-total-row {
  display: flex; align-items: baseline; gap: 4px; flex: 1;
}
.pm-total-label { font-size: 12px; color: var(--muted); }
.pm-total-value { font-size: 20px; font-weight: 900; color: var(--success); margin-left: 6px; }
.pm-total-sep   { font-size: 14px; color: var(--muted); }
.pm-total-expected { font-size: 14px; color: var(--muted); }
.pm-status-badge {
  padding: 5px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
}
.pm-status-badge.partial  { background: rgba(234,179,8,.12); color: #92400e; }
.pm-status-badge.full     { background: rgba(22,163,74,.12); color: var(--success); }
.pm-status-badge.none     { background: rgba(100,116,139,.1); color: var(--muted); }

/* Cash item cliccabile */
.cash-item { cursor: pointer; }
.cash-item:hover { background: rgba(15,99,145,.04); }
.cash-item.fully-paid { background: rgba(22,163,74,.04); }
.cash-item.fully-paid .cash-item-time { color: var(--success); }
.cash-item.fully-paid .cash-item-avatar {
  background: rgba(22,163,74,.15); color: var(--success);
}
.cash-item.partial-paid .cash-item-time { color: #b45309; }
.cash-item.partial-paid .cash-item-avatar {
  background: rgba(234,179,8,.15); color: #b45309;
}

/* =========================================================
   GRIGLIA VERTICALE PRENOTAZIONI
   ========================================================= */
.bk-grid-vertical {
  display: flex;
  gap: 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}

/* Colonna orari (sinistra) */
.bk-time-col {
  flex: 0 0 52px;
  border-right: 1px solid var(--border);
  position: sticky; left: 0;
  background: var(--card);
  z-index: 2;
}
.bk-time-col-header {
  height: 40px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); font-weight: 700;
}
.bk-time-label {
  height: 56px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--muted); font-weight: 700;
  border-bottom: 1px solid var(--border);
}

/* Colonna campo */
.bk-court-col {
  flex: 1; min-width: 140px;
  border-right: 1px solid var(--border);
}
.bk-court-col:last-child { border-right: none; }
.bk-court-col-header {
  height: 40px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--text);
  padding: 0 8px; text-align: center;
  position: sticky; top: 0; background: var(--card); z-index: 1;
}

/* Celle slot */
.bk-slot-cell {
  height: 56px;
  border-bottom: 1px solid var(--border);
  padding: 3px 4px;
  cursor: pointer;
  transition: background .1s;
  position: relative;
}
.bk-slot-cell:last-child { border-bottom: none; }
.bk-slot-cell:hover { background: rgba(15,99,145,.04); }
.bk-slot-cell.booked {
  background: rgba(15,99,145,.08);
  cursor: default;
}
.bk-slot-cell.booked:hover { background: rgba(15,99,145,.12); }
.bk-slot-cell.blocked {
  background: repeating-linear-gradient(
    45deg,
    rgba(100,116,139,.06),
    rgba(100,116,139,.06) 4px,
    transparent 4px,
    transparent 10px
  );
  cursor: not-allowed;
}
.bk-slot-cell.out-of-hours {
  background: rgba(0,0,0,.02);
  cursor: not-allowed;
}

/* Contenuto cella prenotata */
.bk-cell-booking {
  height: 100%;
  border-radius: 7px;
  padding: 4px 7px;
  display: flex; flex-direction: column; justify-content: center;
  font-size: 11px;
  background: rgba(15,99,145,.85);
  color: #fff;
  overflow: hidden;
  cursor: pointer;
}
.bk-cell-booking.fully-paid-cell { background: rgba(22,163,74,.8); }
.bk-cell-booking.partial-paid-cell { background: rgba(234,179,8,.85); color: #7c2d12; }
.bk-cell-booking-name { font-weight: 800; font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bk-cell-booking-time { font-size: 10px; opacity: .85; }

/* Cella bloccata label */
.bk-cell-block {
  height: 100%;
  border-radius: 7px;
  padding: 4px 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  background: rgba(100,116,139,.12);
  color: var(--muted);
  border: 1px dashed rgba(100,116,139,.3);
}

/* =========================================================
   SETTINGS SEZIONI COLLASSABILI
   ========================================================= */
.settings-section {
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}
.settings-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
  transition: background .1s;
}
.settings-section-header:hover { background: rgba(15,99,145,.03); }
.settings-section-body {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
}
.settings-section-body.hidden { display: none; }

/* Blocchi lista */
.block-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  margin-bottom: 6px; font-size: 12px;
}
.block-item-icon {
  width: 28px; height: 28px; border-radius: 8px;
  background: rgba(100,116,139,.1); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; flex: 0 0 28px;
}
.block-item-info { flex: 1; }
.block-item-label { font-weight: 700; color: var(--text); }
.block-item-sub   { color: var(--muted); margin-top: 1px; }
.block-delete-btn {
  background: none; border: 1px solid rgba(197,59,50,.2);
  color: var(--danger); border-radius: 7px; padding: 4px 8px;
  font-size: 11px; cursor: pointer; flex: 0 0 auto;
}
.block-delete-btn:hover { background: rgba(197,59,50,.06); }


/* Cella blocco rossa */
.bk-slot-cell.blocked {
  background: rgba(197,59,50,.06) !important;
  cursor: not-allowed !important;
}
.bk-cell-block-red {
  height: 100%;
  border-radius: 7px;
  padding: 4px 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  background: rgba(197,59,50,.12);
  color: #b91c1c;
  border: 1px solid rgba(197,59,50,.25);
  overflow: hidden;
  white-space: nowrap;
}

/* =========================================================
   RESPONSIVE COMPLETO — TABLET & SMARTPHONE
   ========================================================= */

/* ── Variabili touch ───────────────────────────────────── */
:root {
  --touch-min: 44px;   /* dimensione minima target touch (Apple HIG) */
}

/* ── TABLET (≤ 1024px) ─────────────────────────────────── */
@media (max-width: 1024px) {

  /* Topbar più alta e leggibile */
  .mobile-topbar { height: 54px; padding: 0 14px; }
  .mobile-topbar h1 { font-size: 16px; }
  .btn-menu { width: 44px; height: 44px; }

  /* Tutti i bottoni: altezza minima touch */
  button, .btn, .secondary, .nav-btn,
  .ci-btn-main, .ci-btn-ghost,
  .btn-mark-paid, .btn-unmark-paid {
    min-height: var(--touch-min);
  }

  /* Input e select più alti */
  input, select, textarea {
    min-height: 42px;
    font-size: 16px !important; /* Evita zoom automatico iOS */
  }

  /* Griglia verticale prenotazioni: celle più alte */
  .bk-time-label, .bk-slot-cell { height: 64px; }
  .bk-time-col { flex: 0 0 58px; }
  .bk-court-col { min-width: 160px; }
  .bk-court-col-header { height: 48px; font-size: 13px; }
  .bk-cell-booking { font-size: 12px; }
  .bk-cell-booking-name { font-size: 12px; }

  /* Modale: più grande su tablet */
  .modal {
    width: min(600px, calc(100vw - 24px));
    max-height: 85vh;
  }

  /* Check-in: bottone lettura tessera più grande */
  .ci-read-btn { min-height: 52px; font-size: 15px; }

  /* Incassi: chip giocatori più grandi */
  .cash-player-chip { font-size: 12px; padding: 4px 12px; }
  .btn-mark-paid { padding: 10px 16px !important; font-size: 13px; }

  /* Form a 1 colonna su tablet */
  .form-grid.two-cols { grid-template-columns: 1fr 1fr; gap: 12px; }

  /* Bk-list filtri su più righe */
  .bk-list-header { padding: 12px 14px; }
  .bk-list-filters { gap: 6px; }
  .cash-date-input { font-size: 14px; padding: 8px 10px; }
}

/* ── TABLET PICCOLO / LANDSCAPE PHONE (≤ 768px) ─────────── */
@media (max-width: 768px) {

  /* Content padding ridotto */
  .content { padding: 12px; }

  /* Griglia 2 colonne per KPI */
  .rpt-kpi-grid { grid-template-columns: 1fr 1fr; }

  /* Modale: quasi fullscreen */
  .modal {
    width: calc(100vw - 16px);
    max-height: 88vh;
    border-radius: 16px;
  }
  .booking-modal-box {
    width: calc(100vw - 16px);
    max-height: 88vh;
    border-radius: 16px;
  }

  /* Griglia: celle ancora più alte per dita */
  .bk-slot-cell { height: 68px; }
  .bk-time-label { height: 68px; font-size: 12px; }

  /* Slot booking nella cella: testo più grande */
  .bk-cell-booking { padding: 5px 8px; border-radius: 8px; }
  .bk-cell-booking-name { font-size: 12px; font-weight: 900; }

  /* Cash items: layout colonna */
  .cash-item { padding: 12px 14px; gap: 10px; }
  .cash-item-actions { flex-direction: column; align-items: flex-end; gap: 6px; }
  .btn-mark-paid { font-size: 13px; padding: 10px 14px !important; border-radius: 10px; }

  /* Blocchi: header filtri su colonna */
  .bk-list-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .bk-list-filters { width: 100%; flex-wrap: wrap; }
  .bk-list-filters .cash-date-input { flex: 1; min-width: 120px; }

  /* Settings sezioni: padding ridotto */
  .settings-section-header { padding: 14px; }
  .settings-section-body { padding: 14px; }

  /* Admin cards */
  .admin-section-header { flex-wrap: wrap; gap: 10px; }
  .admin-section-header button { width: 100%; }

  /* Griglia campi: 1 colonna */
  .form-grid.two-cols { grid-template-columns: 1fr; }
}

/* ── SMARTPHONE (≤ 480px) ──────────────────────────────── */
@media (max-width: 480px) {

  /* Topbar compatta */
  :root { --topbar-h: 52px; }
  .mobile-topbar { height: 52px; padding: 0 12px; gap: 8px; }
  .mobile-topbar h1 { font-size: 14px; }

  /* Content padding minimo */
  .content { padding: 10px; }

  /* Sidebar occupa tutto lo schermo in apertura */
  .sidebar { width: 85vw; }

  /* KPI su 2 colonne compatte */
  .rpt-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rpt-kpi { padding: 12px 10px; }
  .rpt-kpi-value { font-size: 26px; }
  .rpt-kpi-label { font-size: 10px; }

  /* Modale fullscreen */
  .modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    transform: none;
  }
  .modal-overlay { display: none; }

  /* Booking modal fullscreen */
  #booking-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .booking-modal-box {
    width: 100vw;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
  }

  /* Payment modal fullscreen */
  #payment-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100vw; max-height: 100vh;
    border-radius: 0;
    transform: none;
  }

  /* Check-in hero compatto */
  .ci-member-hero { padding: 10px 12px; gap: 10px; }
  .ci-avatar { width: 40px; height: 40px; font-size: 14px; }
  .ci-member-name { font-size: 16px; }

  /* Griglia prenotazioni: celle grandi per touch */
  .bk-time-label, .bk-slot-cell { height: 72px; }
  .bk-time-col { flex: 0 0 48px; }
  .bk-time-col-header { font-size: 10px; }
  .bk-time-label { font-size: 11px; }
  .bk-court-col { min-width: 120px; }
  .bk-court-col-header { height: 46px; font-size: 11px; padding: 0 4px; }
  .bk-cell-booking { padding: 4px 5px; }
  .bk-cell-booking-name { font-size: 11px; }
  .bk-cell-booking-time { font-size: 10px; }

  /* Navigazione inferiore (bottom nav) per smartphone */
  .sidebar { display: none !important; }
  .app-shell { padding-top: 52px; padding-bottom: 62px; }
  .bottom-nav { display: flex !important; }

  /* Incassi su smartphone */
  .cash-header { flex-direction: column; align-items: flex-start; gap: 8px; padding: 12px; }
  .cash-item { flex-wrap: wrap; }
  .cash-cost-row { font-size: 11px; }

  /* Slot pagamento: label compatta */
  .pm-slot-fields { grid-template-columns: 1fr; gap: 6px; }
  .pm-slot-fields .pm-type-select { width: 100%; }

  /* Tabelle report: scroll orizzontale */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  /* Btn azioni: full width */
  .row { flex-wrap: wrap; }
  .row button { flex: 1; min-width: 120px; }

  /* Form labels più grandi */
  label { font-size: 13px; }
  input, select, textarea { font-size: 16px !important; min-height: 46px; }

  /* Members list: compatta */
  .members-list-card { max-height: 220px; }
  .member-item { padding: 10px 12px; }

  /* Package cards: 1 colonna */
  .tpl-cards-grid { grid-template-columns: 1fr; }
  .cat-cards-grid { grid-template-columns: 1fr 1fr; }
}

/* ── BOTTOM NAV (solo smartphone) ──────────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 62px;
  background: var(--sidebar-bg);
  border-top: 1px solid rgba(255,255,255,.1);
  z-index: 200;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,.55);
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  border-radius: 10px;
  transition: color .15s, background .15s;
  font-size: 10px;
  font-weight: 700;
  min-height: 44px;
}
.bottom-nav-btn.active {
  color: #fff;
  background: rgba(255,255,255,.12);
}
.bottom-nav-btn svg { flex: 0 0 20px; }

/* Safe area per iPhone con notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .app-shell { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .bottom-nav { padding-bottom: env(safe-area-inset-bottom); }
}

/* Overflow scroll mobile-friendly */
@media (max-width: 768px) {
  .bk-grid-vertical { -webkit-overflow-scrolling: touch; scroll-snap-type: x mandatory; }
  .bk-court-col { scroll-snap-align: start; }
  .tab { -webkit-overflow-scrolling: touch; }
  main.content { overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* =========================================================
   TOUCH FIX — nessun delay/zoom su tap
   ========================================================= */
/* Elimina il 300ms delay di iOS/Android senza rompere i click */
* { touch-action: manipulation; }

/* Ripristina scroll dove serve */
.bk-grid-vertical,
.tab,
main,
.modal,
.members-list-card,
.table-scroll { touch-action: pan-x pan-y; }

/* =========================================================
   FIX DROPDOWN RICERCA TESSERATO IN MODALE INCASSO
   ========================================================= */
.pm-slot { overflow: visible !important; }
.pm-slots { overflow: visible !important; }

#pm-slots .search-results {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  z-index: 999;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 24px rgba(0,0,0,.15);
  max-height: 180px;
  overflow-y: auto !important;
  overflow-x: hidden;
}

#pm-slots .pl-res-item {
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
#pm-slots .pl-res-item:last-child { border-bottom: none; }
#pm-slots .pl-res-item:hover { background: rgba(15,99,145,.06); }

/* =========================================================
   ANALYTICS
   ========================================================= */
#analytics-section table td,
#analytics-section table th {
  padding: 8px 10px;
  font-size: 12px;
}
#analytics-section table thead th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  background: var(--bg);
}
#analytics-heatmap table td,
#analytics-heatmap table th {
  padding: 3px 4px;
}
@media (max-width: 768px) {
  #analytics-section > div > div {
    grid-template-columns: 1fr !important;
  }
}

/* =========================================================
   REPORT — TAB INTERNE + SEZIONI COLLASSABILI
   ========================================================= */

/* Tab bar interna */
.rpt-inner-tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 5px;
  margin-bottom: 14px;
}
.rpt-inner-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 10px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.rpt-inner-tab:hover { background: var(--bg); color: var(--text); }
.rpt-inner-tab.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(15,99,145,.25);
}
.rpt-inner-tab svg { flex: 0 0 15px; }

/* Panel contenuto tab */
.rpt-inner-panel { display: flex; flex-direction: column; gap: 10px; }
.rpt-inner-panel.hidden { display: none; }

/* Toolbar filtri */
.rpt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 4px;
}

/* Sezione collassabile */
.rpt-subsection {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow .2s;
}
.rpt-subsection:hover { box-shadow: 0 2px 12px rgba(0,0,0,.06); }

.rpt-subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  transition: background .15s;
}
.rpt-subsection-header:hover { background: rgba(15,99,145,.03); }

.rpt-subsection-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.rpt-subsection-title svg { color: var(--primary); flex: 0 0 14px; }

.rpt-chevron {
  flex: 0 0 16px;
  color: var(--muted);
  transition: transform .2s;
}
.rpt-subsection.open .rpt-chevron { transform: rotate(180deg); }

.rpt-subsection-body {
  padding: 0 18px 16px;
  border-top: 1px solid var(--border);
}
.rpt-subsection-body.hidden { display: none; }
.rpt-subsection.open .rpt-subsection-body { display: block; }
.rpt-subsection-body .rpt-kpi-grid { padding-top: 14px; }
.rpt-subsection-body .rpt-charts-row { padding-top: 14px; }
.rpt-subsection-body .rpt-alerts-grid { padding-top: 14px; }
.rpt-subsection-body .card { margin-top: 14px; box-shadow: none; border: 1px solid var(--border); }

/* Responsive tab interne */
@media (max-width: 600px) {
  .rpt-inner-tab { font-size: 11px; padding: 8px 6px; gap: 4px; }
  .rpt-inner-tab svg { display: none; }
  .rpt-toolbar { padding: 8px 10px; gap: 6px; }
}

/* =========================================================
   REPORT INCASSI — KPI e tabelle
   ========================================================= */
.rpt-rev-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
  padding: 4px 0;
}
.rpt-rev-kpi {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.rpt-rev-kpi--green { border-color: rgba(46,184,130,.3); background: rgba(46,184,130,.06); }
.rpt-rev-kpi--blue  { border-color: rgba(15,99,145,.3);  background: rgba(15,99,145,.06);  }
.rpt-rev-kpi-label  { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.rpt-rev-kpi-value  { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1; }
.rpt-rev-kpi--green .rpt-rev-kpi-value { color: #2eb882; }
.rpt-rev-kpi--blue  .rpt-rev-kpi-value { color: var(--primary); }
.rpt-rev-kpi-sub    { font-size: 11px; color: var(--muted); margin-top: 4px; }

.rpt-rev-section { margin-bottom: 20px; }
.rpt-rev-section-title {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.rpt-rev-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.rpt-rev-table th {
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(15,99,145,.05);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.rpt-rev-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.rpt-rev-table tr:last-child td { border-bottom: none; }
.rpt-rev-table tbody tr:hover { background: rgba(15,99,145,.03); }

@media (max-width: 768px) {
  .rpt-rev-kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .rpt-rev-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .rpt-rev-kpi-value { font-size: 20px; }
}
