/* ==========================================================================
   Gestionale Scuola Calcio Efraim — tema coordinato con efraimchurch.com
   Palette: verde #2E7D32 · oro #D4A843 · crema #FEFBF6 · blu notte #1A2332
   Font: Lora (titoli) · Nunito (testo)
   ========================================================================== */

:root {
  --primary: #2E7D32;
  --primary-dark: #1B5E20;
  --primary-light: #4CAF50;
  --primary-tint: #E8F3E9;
  --accent: #D4A843;
  --accent-dark: #B8912E;
  --accent-tint: #FBF3DF;
  --warm: #FEFBF6;
  --cream: #FDF8F0;
  --slate: #1A2332;
  --slate-2: #232F42;
  --text: #1C2127;
  --text-2: #5A6370;
  --text-3: #8A919B;
  --divider: #E8DFD0;
  --line: #EFE8DC;
  --input: #DCD2C1;
  --white: #FFFFFF;
  --danger: #B3261E;
  --danger-tint: #FBE9E7;
  --warning: #A15C00;
  --warning-tint: #FFF1DC;
  --info: #1F5F8B;
  --info-tint: #E6F0F7;
  --purple: #6B4E9B;
  --purple-tint: #F0EBF7;
  --font-serif: "Lora", ui-serif, Georgia, serif;
  --font-sans: "Nunito", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --shadow-sm: 0 1px 2px rgba(26, 35, 50, .05);
  --shadow: 0 10px 30px -12px rgba(26, 35, 50, .18);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--warm);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 600; color: var(--text); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 24px 0; }
small, .small { font-size: 13px; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.pos { color: var(--primary); }
.neg { color: var(--danger); }
.ico { flex-shrink: 0; vertical-align: middle; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--slate); color: #fff; padding: 8px 14px; z-index: 100; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sidebar-w); }
.content { flex: 1; width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px 36px 56px; }

/* ---------------------------------------------------------------- sidebar */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 40;
  background: var(--slate); color: rgba(255, 255, 255, .72);
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(212, 168, 67, .12);
}
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 22px 20px 20px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.brand-link { display: flex; align-items: center; gap: 12px; color: #fff; min-width: 0; }
.brand-link:hover { color: #fff; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-family: var(--font-sans); font-weight: 700; letter-spacing: .32em; text-transform: uppercase; font-size: 15px; color: #fff; }
.brand-sub { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 700; line-height: 1.35; margin-top: 3px; }
.sidebar .sidebar-close { display: none; color: #fff; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 12px 18px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.nav-section { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .38); padding: 18px 12px 8px; font-weight: 700; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin: 1px 0; color: rgba(255, 255, 255, .7);
  font-size: 14.5px; font-weight: 600; transition: background .2s, color .2s;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.nav-link.active { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-link.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; background: var(--accent); }
.nav-link.active .ico { color: var(--accent); }
.sidebar-foot { padding: 12px 12px calc(14px + var(--safe-b)); border-top: 1px solid rgba(255, 255, 255, .06); }
.season-tag { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .45); padding: 6px 12px 8px; }
.nav-backdrop { display: none; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 36px;
  background: rgba(254, 251, 246, .92); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--divider);
}
.topbar .menu-btn, .topbar .topbar-brand { display: none; }
.topbar-title { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--text-2); font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 40px; height: 40px; border: 0; background: transparent; color: var(--text); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: rgba(26, 35, 50, .05); color: var(--text); }
.badge-dot {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 18px; text-align: center; border-radius: 999px;
}
.user-menu { position: relative; }
.user-menu summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px 6px 4px 4px; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: rgba(26, 35, 50, .04); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta strong { font-size: 14px; }
.user-meta small { font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: .1em; }
.user-menu .caret { color: var(--text-2); }
.user-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: #fff;
  border: 1px solid var(--divider); box-shadow: var(--shadow); padding: 6px; z-index: 50;
}
.user-dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; color: var(--text); font-weight: 600; font-size: 14px; }
.user-dropdown a:hover { background: var(--cream); color: var(--primary); }

/* ---------------------------------------------------------------- avatar */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .03em;
}
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-photo { display: block; object-fit: cover; background: var(--slate); }
.avatar-edit { position: relative; flex-shrink: 0; }
.avatar-edit .avatar-camera-btn,
.avatar-edit .avatar-remove-btn {
  position: absolute; display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; padding: 0; border: 2px solid #fff; border-radius: 50%;
  background: var(--primary); color: #fff; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.avatar-edit .avatar-camera-btn { right: -2px; bottom: -2px; }
.avatar-edit .avatar-remove-btn { right: -2px; top: -2px; background: var(--danger); }
.avatar-edit .avatar-camera-btn:hover { filter: brightness(1.08); }
.avatar-crop-stage {
  position: relative; width: min(280px, calc(100vw - 80px)); aspect-ratio: 1; margin: 0 auto 16px;
  border-radius: 50%; overflow: hidden; background: #1a2332; touch-action: none; cursor: grab;
}
.avatar-crop-stage:active { cursor: grabbing; }
.avatar-crop-stage canvas { display: block; width: 100%; height: 100%; }
.avatar-crop-zoom { width: 100%; margin: 0 0 18px; }
.avatar-crop-hint { text-align: center; font-size: 13px; color: var(--text-2); margin: 0 0 14px; }

/* ---------------------------------------------------------------- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: 32px; }
.page-sub { margin: 6px 0 0; color: var(--text-2); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.eyebrow { display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 700; letter-spacing: .25em; text-transform: uppercase; color: var(--accent-dark); margin-bottom: 10px; }
.eyebrow-line { display: inline-block; width: 40px; height: 1px; background: var(--accent); }
.eyebrow-gold { color: var(--accent); }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; min-height: 42px; border: 1px solid transparent; border-radius: 0; cursor: pointer;
  font-family: var(--font-sans); font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  line-height: 1.2; white-space: nowrap; transition: background .2s, color .2s, border-color .2s, transform .1s;
  text-decoration: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-dark { background: var(--slate); color: #fff; }
.btn-dark:hover { background: #0F1622; color: #fff; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--input); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: rgba(26, 35, 50, .05); color: var(--text); }
.btn-danger { background: #fff; color: var(--danger); border-color: #EBC5C1; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-light { background: rgba(255,255,255,.9); color: var(--text); }
.btn-wa { background: #1FA855; color: #fff; }
.btn-wa:hover { background: #178A45; color: #fff; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: 11.5px; }
.btn-xs { padding: 4px 9px; min-height: 28px; font-size: 11px; letter-spacing: .04em; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- pills */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; line-height: 1.5; white-space: nowrap;
  background: #F1EEE8; color: var(--text-2);
}
.pill-green { background: var(--primary-tint); color: var(--primary-dark); }
.pill-gold { background: var(--accent-tint); color: #8A6A17; }
.pill-red { background: var(--danger-tint); color: var(--danger); }
.pill-orange { background: var(--warning-tint); color: var(--warning); }
.pill-blue { background: var(--info-tint); color: var(--info); }
.pill-purple { background: var(--purple-tint); color: var(--purple); }
.pill-dark { background: var(--slate); color: #fff; }
.pill-gray { background: #F1EEE8; color: var(--text-2); }
.pill-outline { background: transparent; border: 1px solid var(--divider); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

/* ---------------------------------------------------------------- cards */
.card { background: #fff; border: 1px solid var(--divider); margin-bottom: 24px; position: relative; }
.card-hover { transition: transform .3s, box-shadow .3s, border-color .3s; }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-left-color: var(--accent); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.card-head .ico { color: var(--accent-dark); }
.card-body { padding: 22px; }
.card-body.tight { padding: 0; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: var(--cream); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.card-accent { border-top: 3px solid var(--accent); }
.card-green { border-top: 3px solid var(--primary); }

.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 16px; }

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; margin-bottom: 28px; }
.kpi { background: #fff; border: 1px solid var(--divider); padding: 20px 22px; position: relative; overflow: hidden; display: block; color: inherit; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--primary); }
.kpi.gold::before { background: var(--accent); }
.kpi.red::before { background: var(--danger); }
.kpi.dark::before { background: var(--slate); }
a.kpi:hover { box-shadow: var(--shadow); color: inherit; }
.kpi-label { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--text-2); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kpi-value { font-family: var(--font-serif); font-size: 30px; font-weight: 600; margin-top: 8px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.kpi-icon { position: absolute; right: 18px; top: 18px; color: var(--divider); }

/* ---------------------------------------------------------------- tables */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); font-weight: 700;
  padding: 11px 14px; background: var(--cream); border-bottom: 1px solid var(--divider); white-space: nowrap;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: #FFFDF8; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tfoot td { background: var(--cream); font-weight: 700; border-top: 1px solid var(--divider); padding: 12px 14px; }
.table .actions { text-align: right; white-space: nowrap; }
.table .check { width: 36px; }
.table a.row-link { color: var(--text); font-weight: 700; }
.table a.row-link:hover { color: var(--primary); }
.cell-person { display: flex; align-items: center; gap: 12px; min-width: 180px; }
.cell-person .sub { display: block; font-size: 12.5px; color: var(--text-2); font-weight: 400; }
tr.row-muted td { opacity: .55; }

/* ---------------------------------------------------------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 18px; }
.col-12 { grid-column: span 12; } .col-9 { grid-column: span 9; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; } .col-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.req::after { content: " *"; color: var(--accent-dark); }
.input, .field input[type=text], .field input[type=email], .field input[type=password], .field input[type=tel], .field input[type=number],
.field input[type=date], .field input[type=time], .field input[type=month], .field input[type=url], .field input[type=search], .field select, .field textarea, select.input, textarea.input {
  width: 100%; padding: 10px 12px; min-height: 44px; border: 1px solid var(--input); border-radius: 0; background: #fff;
  font-family: var(--font-sans); font-size: 15px; color: var(--text); transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.field select, select.input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%235A6370' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px;
}
.field select[multiple] { background-image: none; padding-right: 12px; min-height: 120px; }
.field textarea, textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(46, 125, 50, .14); }
.field input[readonly] { background: var(--cream); }
.input-group { display: flex; }
.input-group > .input, .input-group > input { flex: 1; min-width: 0; }
.input-group > .btn { border-left: 0; }
.input-prefix { display: flex; align-items: center; padding: 0 12px; background: var(--cream); border: 1px solid var(--input); border-right: 0; color: var(--text-2); font-weight: 700; }
.check-row { display: flex; align-items: flex-start; gap: 10px; font-size: 14.5px; cursor: pointer; line-height: 1.4; }
.check-row input { margin-top: 2px; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.fieldset { border: 0; padding: 0; margin: 0 0 28px; }
.fieldset-title { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 18px; font-weight: 600; margin: 0 0 16px; padding-bottom: 10px; border-bottom: 1px solid var(--line); width: 100%; }
.fieldset-title .ico { color: var(--accent-dark); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 8px; }
.form-actions.sticky { position: sticky; bottom: 0; background: rgba(254, 251, 246, .95); padding: 14px 0; border-top: 1px solid var(--divider); margin-top: 8px; z-index: 5; }
.segmented { display: inline-flex; border: 1px solid var(--input); background: #fff; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; font-size: 12.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; color: var(--text-2); }
.segmented input:checked + span { background: var(--primary); color: #fff; }
.segmented input.out:checked + span { background: var(--danger); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }

/* filtri */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filters .field { min-width: 150px; }
.filters .field.grow { flex: 1; min-width: 220px; }
.search-box { position: relative; }
.search-box .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-box input { padding-left: 38px !important; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--divider); background: #fff;
  border-radius: 999px; font-size: 12.5px; font-weight: 700; color: var(--text-2);
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--slate); border-color: var(--slate); color: #fff; }
.chip .count { font-size: 11px; opacity: .75; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; padding: 12px 16px; font-size: 12.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--primary-dark); }
.tabs a.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--accent); }
.tabs .pill { font-size: 10px; padding: 1px 7px; }

/* ---------------------------------------------------------------- flash, alert, toast */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.flash { display: flex; align-items: flex-start; gap: 12px; padding: 13px 16px; background: #fff; border: 1px solid var(--divider); border-left: 3px solid var(--primary); font-weight: 600; animation: slidein .3s ease; }
.flash > span { flex: 1; }
.flash-success { border-left-color: var(--primary); } .flash-success .ico { color: var(--primary); }
.flash-error { border-left-color: var(--danger); } .flash-error .ico { color: var(--danger); }
.flash-warning { border-left-color: var(--accent); } .flash-warning .ico { color: var(--accent-dark); }
.flash-info { border-left-color: var(--info); } .flash-info .ico { color: var(--info); }
.flash-close { border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 2px; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.note { display: flex; gap: 12px; padding: 14px 16px; background: var(--cream); border: 1px solid var(--divider); font-size: 14px; margin-bottom: 18px; }
.note .ico { color: var(--accent-dark); margin-top: 2px; }
.note.warn { background: var(--warning-tint); border-color: #F2D7AE; }
.note.warn .ico { color: var(--warning); }
.note.danger { background: var(--danger-tint); border-color: #F0C9C5; }
.note.danger .ico { color: var(--danger); }
.note.ok { background: var(--primary-tint); border-color: #C9E2CB; }
.note.ok .ico { color: var(--primary); }
.note p:last-child { margin-bottom: 0; }
.alert-banner {
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin-bottom: 20px;
  background: linear-gradient(90deg, var(--danger) 0%, #8E1E18 100%); color: #fff;
}
.alert-banner > div { flex: 1; display: flex; flex-direction: column; }
.alert-banner span { opacity: .85; font-size: 14px; }
.toast-root { position: fixed; right: 20px; bottom: calc(20px + var(--safe-b)); z-index: 90; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; background: var(--slate); color: #fff; padding: 12px 16px; min-width: 240px; max-width: 360px; box-shadow: var(--shadow); border-left: 3px solid var(--accent); font-weight: 600; font-size: 14px; animation: slidein .25s ease; }
.toast.error { border-left-color: #FF6B5E; }

/* ---------------------------------------------------------------- empty state */
.empty { text-align: center; padding: 48px 20px; }
.empty-icon { display: inline-flex; width: 64px; height: 64px; align-items: center; justify-content: center; border: 1px solid var(--divider); color: var(--accent-dark); margin-bottom: 14px; background: #fff; }
.empty h2, .empty h3 { margin-bottom: 6px; }
.empty p { color: var(--text-2); max-width: 460px; margin: 0 auto 18px; }

/* ---------------------------------------------------------------- liste */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 22px; border-bottom: 1px solid var(--line); color: var(--text); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #FFFDF8; color: var(--text); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 700; display: block; }
.list-item .meta { font-size: 13px; color: var(--text-2); display: block; }
.date-badge { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 50px; height: 54px; border: 1px solid var(--divider); background: var(--cream); flex-shrink: 0; line-height: 1; }
.date-badge .d { font-family: var(--font-serif); font-size: 21px; font-weight: 600; }
.date-badge .m { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-dark); font-weight: 800; margin-top: 4px; }
.date-badge.today { background: var(--primary); border-color: var(--primary); color: #fff; }
.date-badge.today .m { color: #fff; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14.5px; }
.alert-item:last-child { border-bottom: 0; }
.alert-item:hover { background: #FFFDF8; color: var(--text); }
.alert-item .ai-icon { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.alert-item .grow { flex: 1; }
.ai-red { background: var(--danger-tint); color: var(--danger); }
.ai-orange { background: var(--warning-tint); color: var(--warning); }
.ai-gold { background: var(--accent-tint); color: var(--accent-dark); }
.ai-blue { background: var(--info-tint); color: var(--info); }
.ai-green { background: var(--primary-tint); color: var(--primary); }

/* ---------------------------------------------------------------- chart barre */
.bars { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; align-items: end; height: 190px; padding: 10px 0 0; }
.bar-group { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 8px; }
.bar-pair { display: flex; gap: 4px; align-items: flex-end; height: 100%; width: 100%; justify-content: center; }
.bar { width: 40%; max-width: 22px; background: var(--primary); min-height: 2px; position: relative; transition: height .6s ease; }
.bar.out { background: var(--accent); }
.bar-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 700; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; display: inline-block; }
.progress { height: 8px; background: var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); transition: width .4s ease; }
.progress.gold > span { background: var(--accent); }

/* ---------------------------------------------------------------- scheda atleta */
.profile-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 24px; background: #fff; border: 1px solid var(--divider); border-top: 3px solid var(--primary); margin-bottom: 24px; }
.profile-head h1 { margin: 0; font-size: 28px; }
.profile-head .grow { flex: 1; min-width: 200px; }
.profile-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 10px 16px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--text-2); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; padding-top: 2px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.contact-actions { display: inline-flex; gap: 6px; margin-left: 6px; vertical-align: middle; }
.contact-actions a { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border: 1px solid var(--divider); color: var(--text-2); background: #fff; }
.contact-actions a:hover { color: var(--primary); border-color: var(--primary); }
.contact-actions a.wa:hover { color: #1FA855; border-color: #1FA855; }

/* ---------------------------------------------------------------- squadre */
.team-card { border-top: 3px solid var(--team, var(--primary)); }
.team-card .card-body { display: flex; flex-direction: column; gap: 10px; }
.team-stats { display: flex; gap: 18px; font-size: 13px; color: var(--text-2); flex-wrap: wrap; }
.team-stats strong { color: var(--text); font-size: 18px; font-family: var(--font-serif); display: block; }

/* ---------------------------------------------------------------- calendario */
.cal-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.cal-title { font-family: var(--font-serif); font-size: 24px; font-weight: 600; margin: 0 8px; min-width: 190px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: #fff; border: 1px solid var(--divider); border-right: 0; border-bottom: 0; }
.cal-dow { padding: 10px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--text-2); background: var(--cream); border-right: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.cal-day { min-height: 118px; padding: 6px; border-right: 1px solid var(--divider); border-bottom: 1px solid var(--divider); display: flex; flex-direction: column; gap: 4px; min-width: 0; position: relative; }
.cal-day.out { background: #FBF9F5; }
.cal-day.out .cal-num { color: var(--text-3); }
.cal-day.today { background: #F6FBF6; }
.cal-num { font-size: 13px; font-weight: 800; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.cal-day.today .cal-num span { background: var(--primary); color: #fff; width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.cal-add { opacity: 0; color: var(--text-3); display: inline-flex; }
.cal-day:hover .cal-add { opacity: 1; }
.cal-ev { display: block; font-size: 12px; line-height: 1.3; padding: 3px 6px; border-left: 3px solid var(--ev, var(--primary)); background: var(--ev-bg, var(--primary-tint)); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.cal-ev:hover { color: var(--text); filter: brightness(.97); }
.cal-ev.cancelled { text-decoration: line-through; opacity: .6; }
.cal-ev .t { font-weight: 800; margin-right: 4px; }
.ev-allenamento { --ev: var(--primary); --ev-bg: var(--primary-tint); }
.ev-partita { --ev: var(--accent); --ev-bg: var(--accent-tint); }
.ev-torneo { --ev: var(--slate); --ev-bg: #E7EAF0; }
.ev-evento { --ev: var(--purple); --ev-bg: var(--purple-tint); }
.ev-riunione { --ev: var(--info); --ev-bg: var(--info-tint); }
.ev-altro { --ev: var(--text-3); --ev-bg: #F1EEE8; }
.cal-more { font-size: 11.5px; color: var(--text-2); font-weight: 700; padding-left: 4px; }
.agenda .list-item { align-items: flex-start; }
.agenda-day { padding: 10px 22px; background: var(--cream); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--text-2); border-bottom: 1px solid var(--line); }
.ev-bar { width: 4px; align-self: stretch; background: var(--ev, var(--primary)); flex-shrink: 0; }
.cal-mobile { display: none; }

/* presenze */
.att-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); }
.att-row .grow { flex: 1; min-width: 0; }
.att-btns { display: inline-flex; border: 1px solid var(--input); }
.att-btns button { border: 0; background: #fff; min-width: 42px; height: 38px; font-weight: 800; font-size: 13px; cursor: pointer; color: var(--text-2); border-right: 1px solid var(--input); font-family: var(--font-sans); }
.att-btns button:last-child { border-right: 0; }
.att-btns button.on[data-v=presente] { background: var(--primary); color: #fff; }
.att-btns button.on[data-v=assente] { background: var(--danger); color: #fff; }
.att-btns button.on[data-v=giustificato] { background: var(--accent); color: #fff; }
.att-btns button.on[data-v=ritardo] { background: var(--info); color: #fff; }
.att-matrix td, .att-matrix th { text-align: center; padding: 8px 6px !important; }
.att-matrix td:first-child, .att-matrix th:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; }
.att-matrix th:first-child { background: var(--cream); }
.mk { display: inline-flex; width: 24px; height: 24px; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; }
.mk-presente { background: var(--primary-tint); color: var(--primary-dark); }
.mk-assente { background: var(--danger-tint); color: var(--danger); }
.mk-giustificato { background: var(--accent-tint); color: #8A6A17; }
.mk-ritardo { background: var(--info-tint); color: var(--info); }

/* ---------------------------------------------------------------- galleria */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.album { background: #fff; border: 1px solid var(--divider); display: block; color: var(--text); transition: transform .3s, box-shadow .3s; }
.album:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.album-cover { aspect-ratio: 4 / 3; background: var(--cream) center / cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--divider); }
.album-body { padding: 14px 16px; }
.album-body h3 { margin: 0 0 4px; font-size: 17px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 1; overflow: hidden; background: var(--cream); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; transition: transform .4s; }
.photo:hover img { transform: scale(1.03); }
.photo-actions { position: absolute; right: 6px; top: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .2s; }
.photo:hover .photo-actions, .photo:focus-within .photo-actions { opacity: 1; }
.photo-actions button, .photo-actions a { width: 30px; height: 30px; border: 0; background: rgba(26, 35, 50, .8); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.dropzone { border: 2px dashed var(--input); background: var(--cream); padding: 30px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; display: block; }
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-tint); }
.dropzone .ico { color: var(--accent-dark); }
.upload-list { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.lightbox { position: fixed; inset: 0; background: rgba(12, 17, 25, .94); z-index: 100; display: none; align-items: center; justify-content: center; padding: 20px; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 110px); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.lightbox .lb-btn { position: absolute; width: 48px; height: 48px; border: 0; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.lightbox .lb-btn:hover { background: rgba(255,255,255,.18); }
.lb-close { top: calc(16px + var(--safe-t)); right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }
.lb-caption { position: absolute; bottom: calc(18px + var(--safe-b)); left: 0; right: 0; text-align: center; color: rgba(255,255,255,.8); font-size: 14px; padding: 0 70px; }
.lb-caption a { color: var(--accent); }

/* ---------------------------------------------------------------- bacheca */
.notice { background: #fff; border: 1px solid var(--divider); border-left: 3px solid var(--info); padding: 18px 22px; margin-bottom: 16px; }
.notice.importante { border-left-color: var(--accent); }
.notice.urgente { border-left-color: var(--danger); }
.notice.unread { box-shadow: var(--shadow); }
.notice-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.notice h3 { margin: 0 0 4px; font-size: 19px; }
.notice-meta { font-size: 12.5px; color: var(--text-2); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.prose p { margin: 0 0 .8em; }
.prose ul { margin: 0 0 .8em; padding-left: 20px; }
.prose h2 { font-size: 20px; margin-top: 1em; }
.prose h3 { font-size: 17px; }

/* ---------------------------------------------------------------- misc */
.pager { display: flex; gap: 4px; justify-content: center; margin: 22px 0 0; flex-wrap: wrap; }
.pager a, .pager-gap { min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--divider); background: #fff; color: var(--text); font-weight: 700; font-size: 14px; }
.pager a.active { background: var(--slate); border-color: var(--slate); color: #fff; }
.pager-gap { border: 0; background: none; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--cream); border: 1px solid var(--divider); padding: 8px 10px; word-break: break-all; display: block; }
.kbd { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: var(--cream); border: 1px solid var(--divider); padding: 1px 6px; }
.placeholders { display: flex; gap: 6px; flex-wrap: wrap; }
.placeholders button { border: 1px dashed var(--input); background: #fff; font-family: ui-monospace, Menlo, monospace; font-size: 12px; padding: 4px 8px; cursor: pointer; color: var(--text-2); }
.placeholders button:hover { border-color: var(--primary); color: var(--primary); }
.preview-box { border: 1px solid var(--divider); background: var(--cream); padding: 16px 18px; font-size: 14.5px; }
.wa-bubble { background: #DCF8C6; padding: 10px 12px; max-width: 420px; font-size: 14.5px; white-space: pre-wrap; box-shadow: 0 1px 1px rgba(0,0,0,.08); }
.stat-inline { display: flex; gap: 24px; flex-wrap: wrap; }
.stat-inline div { display: flex; flex-direction: column; }
.stat-inline strong { font-family: var(--font-serif); font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-inline span { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); font-weight: 700; }
.sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.size { display: inline-flex; flex-direction: column; align-items: center; min-width: 48px; border: 1px solid var(--divider); padding: 4px 8px; background: #fff; }
.size b { font-size: 11px; letter-spacing: .08em; color: var(--text-2); }
.size span { font-family: var(--font-serif); font-size: 17px; font-weight: 600; }
.size.low span { color: var(--danger); }
dialog.modal { border: 0; padding: 0; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(0,0,0,.3); }
dialog.modal::backdrop { background: rgba(26, 35, 50, .55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 20px; }
.modal-body { padding: 22px; overflow-y: auto; }
.qr-box { display: inline-block; padding: 12px; background: #fff; border: 1px solid var(--divider); }
.status-line { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.status-line .dot { width: 10px; height: 10px; }
.receipt-actions { display: flex; gap: 10px; justify-content: center; margin: 20px 0; }

/* ---------------------------------------------------------------- footer Efraim */
.site-footer { background: var(--slate); color: rgba(255, 255, 255, .8); margin-top: 20px; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 0 32px 40px; }
.footer-mark { display: flex; align-items: center; gap: 24px; padding: 56px 0 44px; }
.footer-mark .line-gold { width: 64px; height: 1px; background: var(--accent); }
.footer-mark .mark-text { font-family: var(--font-serif); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: rgba(212, 168, 67, .8); }
.footer-mark .line-fade { flex: 1; height: 1px; background: rgba(255, 255, 255, .05); }
.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px; padding-bottom: 20px; }
.footer-brand a { display: inline-block; margin-bottom: 24px; }
.footer-brand img { width: 192px; height: auto; margin-bottom: 8px; display: block; }
.footer-tagline { font-family: var(--font-serif); font-size: 15px; font-style: italic; font-weight: 300; color: rgba(255, 255, 255, .4); display: block; margin-top: 4px; }
.footer-desc { font-size: 14px; color: rgba(255, 255, 255, .5); line-height: 1.7; }
.footer-social { display: flex; gap: 12px; margin-top: 32px; }
.footer-social a { width: 40px; height: 40px; background: rgba(255, 255, 255, .08); display: flex; align-items: center; justify-content: center; color: rgba(255, 255, 255, .85); transition: background .2s; }
.footer-social a:hover { background: var(--accent); color: #fff; }
.footer-h { font-family: var(--font-sans); font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: rgba(255, 255, 255, .4); margin-bottom: 24px; font-weight: 400; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.footer-links a { display: flex; align-items: center; font-size: 14px; color: rgba(255, 255, 255, .6); transition: color .3s; }
.footer-links a:hover { color: var(--accent); }
.footer-links .hover-line { width: 0; height: 1px; background: var(--accent); transition: width .3s, margin .3s; margin-right: 0; }
.footer-links a:hover .hover-line { width: 12px; margin-right: 8px; }
.footer-contacts { font-style: normal; display: flex; flex-direction: column; gap: 16px; font-size: 14px; color: rgba(255, 255, 255, .6); border-left: 1px solid rgba(212, 168, 67, .3); padding-left: 16px; }
.footer-contacts > div { display: flex; align-items: flex-start; gap: 12px; }
.footer-contacts .ico { color: rgba(212, 168, 67, .6); margin-top: 3px; }
.footer-contacts a { color: rgba(255, 255, 255, .6); }
.footer-contacts a:hover { color: var(--accent); }
.footer-hours { border: 1px solid rgba(255, 255, 255, .08); padding: 20px; position: relative; display: flex; flex-direction: column; gap: 16px; font-size: 13px; }
.footer-hours .corner { position: absolute; width: 12px; height: 12px; border-color: rgba(212, 168, 67, .5); border-style: solid; border-width: 0; }
.corner.tl { top: -1px; left: -1px; border-top-width: 1px; border-left-width: 1px; }
.corner.tr { top: -1px; right: -1px; border-top-width: 1px; border-right-width: 1px; }
.corner.bl { bottom: -1px; left: -1px; border-bottom-width: 1px; border-left-width: 1px; }
.corner.br { bottom: -1px; right: -1px; border-bottom-width: 1px; border-right-width: 1px; }
.hours-row { display: flex; align-items: flex-start; gap: 12px; }
.hours-row .ico { color: var(--accent); margin-top: 2px; }
.hours-row p { margin: 0; }
.hours-day { color: #fff; font-weight: 500; letter-spacing: .03em; }
.hours-time { color: rgba(255, 255, 255, .5); }
.hours-sep { height: 1px; background: rgba(255, 255, 255, .08); }
.footer-live { display: inline-flex; align-items: center; gap: 12px; margin-top: 24px; font-size: 14px; color: var(--accent); }
.footer-live:hover { color: #fff; }
.footer-live .live-line { width: 24px; height: 1px; background: var(--accent); transition: width .3s; }
.footer-live:hover .live-line { width: 40px; }
.footer-bottom { margin-top: 36px; padding-top: 28px; border-top: 1px solid rgba(212, 168, 67, .2); display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 12px; color: rgba(255, 255, 255, .35); flex-wrap: wrap; }
.footer-bottom p { margin: 0; }
.footer-bottom a { color: rgba(255, 255, 255, .35); letter-spacing: .03em; }
.footer-bottom a:hover { color: rgba(255, 255, 255, .6); }

/* ---------------------------------------------------------------- pagine di accesso */
body.auth { background: var(--warm); }
.auth-wrap { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.auth-hero {
  position: relative; overflow: hidden; color: #fff; display: flex; align-items: center; padding: 64px;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(76, 175, 80, .35), transparent 60%),
    linear-gradient(160deg, #1B5E20 0%, #245f2a 35%, #1A2332 100%);
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0; opacity: .08;
  background-image: repeating-linear-gradient(45deg, #fff 0 1px, transparent 1px 22px);
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 520px; }
.auth-logo { width: 96px; height: 96px; object-fit: contain; margin: 26px 0 18px; }
.auth-brand { display: flex; flex-direction: column; }
.auth-brand-1 { font-size: 44px; font-weight: 600; letter-spacing: .32em; text-transform: uppercase; line-height: 1.1; }
.auth-brand-2 { font-size: 22px; font-weight: 300; letter-spacing: .22em; text-transform: uppercase; opacity: .9; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 30px 0 22px; }
.auth-divider span { width: 40px; height: 1px; background: var(--accent); }
.auth-divider i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.auth-tagline { font-family: var(--font-serif); font-style: italic; font-size: 27px; line-height: 1.4; color: rgba(255, 255, 255, .9); margin: 0; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 28px; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1 { font-size: 32px; margin-bottom: 6px; }
.auth-sub { color: var(--text-2); margin-bottom: 26px; }
.auth-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 22px; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-top: 6px; }
.auth-links a { font-weight: 700; }
.auth-mobile-brand { display: none; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px !important; }
.pw-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 42px; border: 0; background: transparent; color: var(--text-3); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.pw-toggle:hover { color: var(--text); }
.hp-field { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

/* ---------------------------------------------------------------- navigazione mobile */
.bottom-nav { display: none; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 44px; }
}

@media (max-width: 1024px) {
  .main-col { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .3s ease; width: min(300px, 86vw); padding-top: var(--safe-t); }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .35); z-index: 60; }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; background: rgba(12, 17, 25, .5); z-index: 55; }
  body.nav-open { overflow: hidden; }
  .sidebar .sidebar-close { display: inline-flex; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px 0 8px; padding-top: var(--safe-t); height: calc(var(--topbar-h) + var(--safe-t)); background: var(--slate); border-bottom-color: rgba(212, 168, 67, .2); color: #fff; }
  .topbar .icon-btn { color: #fff; }
  .topbar .icon-btn:hover { background: rgba(255, 255, 255, .08); }
  .topbar .topbar-brand { display: inline-flex; }
  .topbar-brand .brand-name { font-size: 14px; }
  .topbar-title { color: rgba(255, 255, 255, .55); font-size: 10.5px; letter-spacing: .16em; }
  .user-meta, .user-menu .caret { display: none; }
  .user-menu summary:hover { background: transparent; }
  .content { padding: 22px 20px calc(96px + var(--safe-b)); }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: rgba(26, 35, 50, .97); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(212, 168, 67, .25); padding-bottom: var(--safe-b);
  }
  .bottom-nav a, .bottom-nav button {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    padding: 9px 2px 8px; color: rgba(255, 255, 255, .6); background: none; border: 0; font-family: var(--font-sans);
    font-size: 10.5px; font-weight: 700; letter-spacing: .04em; cursor: pointer; -webkit-tap-highlight-color: transparent; min-height: 56px;
  }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 2px; background: var(--accent); }
  .bottom-nav a { position: relative; }
  .site-footer { margin-top: 0; }
  .toast-root { bottom: calc(80px + var(--safe-b)); left: 16px; right: 16px; align-items: stretch; }
  .toast { max-width: none; }
}

@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-panel { padding: calc(28px + var(--safe-t)) 20px 40px; align-items: flex-start; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 12px; padding: 16px; margin: -4px -4px 26px; background: linear-gradient(135deg, #1B5E20, #1A2332); color: #fff; }
  .auth-mobile-brand span { font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: 13px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .col-9, .col-8, .col-6, .col-4, .col-3 { grid-column: span 12; }
  .col-2 { grid-column: span 6; }
  .form-grid .col-sm-6 { grid-column: span 6; }
}

@media (max-width: 760px) {
  body { font-size: 15.5px; }
  h1, .page-head h1 { font-size: 26px; }
  .content { padding: 18px 16px calc(96px + var(--safe-b)); }
  .page-head { margin-bottom: 20px; align-items: flex-start; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .kpis { gap: 12px; }
  .kpi { padding: 16px; }
  .kpi-value { font-size: 23px; }
  .kpi-icon { display: none; }
  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .list-item, .alert-item { padding: 12px 16px; }
  .grid { gap: 16px; }
  .grid-4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 10px; }
  .filters .field, .filters .field.grow { min-width: 0; flex: 1 1 100%; }
  .filters .btn { flex: 1; }
  /* input a 16px: evita lo zoom automatico di Safari su iPhone */
  .input, .field input, .field select, .field textarea, select.input, textarea.input { font-size: 16px; }
  /* tabelle -> schede */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td, .table.responsive tfoot { display: block; width: 100%; }
  .table.responsive tr { border-bottom: 1px solid var(--divider); padding: 10px 14px; position: relative; }
  .table.responsive tbody tr:last-child { border-bottom: 0; }
  .table.responsive td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-2); font-weight: 700; text-align: left; padding-top: 2px; }
  .table.responsive td[data-label=""]::before, .table.responsive td:not([data-label])::before { display: none; }
  .table.responsive td.main-cell { display: block; text-align: left; padding-bottom: 6px; }
  .table.responsive td.main-cell::before { display: none; }
  .table.responsive td.actions { justify-content: flex-end; padding-top: 8px; }
  .table.responsive td.check { position: absolute; right: 12px; top: 12px; width: auto; padding: 0; }
  .table.responsive tfoot tr { padding: 12px 14px; }
  .table.responsive tfoot td { background: none; border: 0; padding: 3px 0; }
  .cal-grid { display: none; }
  .cal-mobile { display: block; }
  .cal-title { font-size: 20px; min-width: 0; flex: 1; }
  .bars { gap: 8px; height: 160px; }
  .footer-inner { padding: 0 20px 32px; }
  .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .footer-mark { padding: 44px 0 32px; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .segmented { display: flex; width: 100%; }
  .segmented label { flex: 1; }
  .segmented span { justify-content: center; width: 100%; }
  .photos { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .albums { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .photo-actions { opacity: 1; }
  .form-actions .btn { flex: 1; }
  .att-row { padding: 10px 12px; flex-wrap: wrap; }
  .lightbox .lb-prev, .lightbox .lb-next { top: auto; bottom: calc(12px + var(--safe-b)); transform: none; }
  .lb-caption { bottom: calc(70px + var(--safe-b)); padding: 0 16px; }
}

@media (max-width: 420px) {
  .kpis { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpi-value { font-size: 20px; }
  .kpi-label { font-size: 10px; letter-spacing: .12em; }
  .photos { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------------- cookie banner (Analytics) */
.cookie-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
  padding: 14px 18px calc(14px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(26, 35, 50, 0.12);
  font-size: 13px;
  line-height: 1.45;
}
.cookie-banner-text { margin: 0; max-width: 52rem; color: var(--text-muted); }
.cookie-banner-text a { color: var(--accent); }
.cookie-banner-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; pointer-events: auto; }
.cookie-banner .btn { pointer-events: auto; position: relative; z-index: 1; }
.avatar-crop-overlay {
  position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center;
  padding: 20px; background: rgba(26, 35, 50, .55);
}
.avatar-crop-overlay.open { display: flex; }
.avatar-crop-panel { width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); box-shadow: 0 30px 80px rgba(0,0,0,.3); }

/* ---------------------------------------------------------------- stampa (ricevute, rendiconti) */
@media print {
  .cookie-banner { display: none !important; }
  @page { margin: 14mm; }
  body { background: #fff; font-size: 12pt; }
  .sidebar, .topbar, .bottom-nav, .site-footer, .no-print, .page-actions, .filters, .tabs, .flash-stack, .pager, .toast-root { display: none !important; }
  .main-col { margin: 0; }
  .content { padding: 0; max-width: none; }
  .card { border-color: #ccc; break-inside: avoid; }
  .table th { background: #f3f3f3 !important; }
  a { color: inherit; }
}
