  :root {
    --navy: #232324;
    --orange: #ed2f50;
    --silver: #9aa0a6;
    --bg: #0b0b0c;
    --card: #171718;
    --card-2: #252526;
    --text: #f2f2f3;
    --muted: #b6b6bc;
    --border: rgba(255,255,255,.135);
    --border-hover: rgba(255,255,255,.24);
    --row-line: rgba(255,255,255,.07);
    --input-bg: rgba(255,255,255,.045);
    --ok: #3fb765;
    --ko: #ff5a6e;
    --wait: #f0b43c;
    --ok-bg: rgba(63,183,101,.16);
    --ko-bg: rgba(255,90,110,.16);
    --wait-bg: rgba(240,180,60,.16);
    --info: #7fa8ff;
    --info-bg: rgba(127,168,255,.15);
    --banner-bg: #2a2214;
    --rail: 76px;
    --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
    --font-body: "Barlow", -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --radius: 14px;
    --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 8px 24px rgba(0,0,0,.28);
    color-scheme: dark;
  }
  html[data-theme="light"] {
    --navy: #202023;
    --orange: #c71f42;
    --bg: #f1f1f2;
    --card: #fcfcfd;
    --card-2: #e3e3e5;
    --text: #202023;
    --muted: #5b5b63;
    --border: rgba(35,35,40,.12);
    --border-hover: rgba(35,35,40,.22);
    --row-line: rgba(35,35,40,.07);
    --input-bg: #ffffff;
    --ok: #1a7f37;
    --ko: #c02626;
    --wait: #a06b00;
    --ok-bg: #e6f4ea;
    --ko-bg: #fce8e8;
    --wait-bg: #fff4dc;
    --info: #1a56c4;
    --info-bg: #e8f0fe;
    --banner-bg: #fff4e0;
    --shadow: 0 1px 2px rgba(30,30,35,.04), 0 6px 18px rgba(30,30,35,.06);
    color-scheme: light;
  }
  * { box-sizing: border-box; }
  html, body { max-width: 100%; overflow-x: hidden; }
  body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    background: var(--bg);
    color: var(--text);
    margin: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
  h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; }
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .spinner {
    display: inline-block;
    width: 15px;
    height: 15px;
    border: 2px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    vertical-align: middle;
    flex-shrink: 0;
  }
  .spinner.large { width: 30px; height: 30px; border-width: 3px; }
  .spinner.on-dark { border-color: rgba(255,255,255,.35); border-top-color: #fff; }
  @keyframes spin { to { transform: rotate(360deg); } }
  .loading-row {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    font-size: 14px;
    padding: 10px 2px;
  }
  .boot-loading {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  header.topbar {
    background: var(--card);
    color: var(--text);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    border-bottom: 1px solid var(--border);
    margin-left: var(--rail);
  }
  header.topbar .brand { display: none; }
  .brand-logo { height: 36px; width: 36px; object-fit: contain; display: block; border-radius: 8px; }
  .login-card .brand-logo { height: 64px; width: 64px; margin: 0 auto 12px; }
  header.topbar .who { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  header.topbar .who .btn.secondary { background: transparent !important; color: var(--text) !important; border-color: var(--border) !important; }
  header.topbar .who .btn.secondary:hover { border-color: var(--border-hover) !important; }
  #theme-btn { width: 34px; height: 34px; padding: 0; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 15px; line-height: 1; margin: 0; }
  details.archivio { margin-top: 18px; }
  details.archivio > summary { cursor: pointer; font-weight: 600; color: var(--muted); padding: 6px 0; }
  details.archivio[open] > summary { margin-bottom: 10px; }
  .ruolo-card > summary { cursor: pointer; list-style: none; }
  .ruolo-card > summary::-webkit-details-marker { display: none; }
  .rv-admin > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .rv-admin > summary::-webkit-details-marker { display: none; }
  .rv-admin > summary h3 { margin: 0; }
  .rv-admin > summary::after { content: "+"; font-size: 24px; font-weight: 600; line-height: 1; color: var(--orange); }
  .rv-admin[open] > summary::after { content: "\2212"; }
  .rv-admin[open] > summary { margin-bottom: 10px; }
  .ruolo-head { display: flex; align-items: center; gap: 12px; border-left: 3px solid var(--orange); padding-left: 12px; }
  .ruolo-head > div { flex: 1; }
  .ruolo-nome { font-family: var(--font-display); font-size: 20px; font-weight: 600; line-height: 1.2; }
  .ruolo-toggle { font-size: 13px; font-weight: 600; color: var(--orange); white-space: nowrap; }
  .ruolo-toggle::after { content: " \25BE"; }
  .ruolo-card[open] .ruolo-toggle::after { content: " \25B4"; }
  .ruolo-video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 16px; }
  .yt-thumb, .yt-frame { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 10px; overflow: hidden; background: #101010; }
  .yt-thumb { position: relative; padding: 0; cursor: pointer; }
  .yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .yt-play { position: absolute; top: 50%; left: 50%; width: 56px; height: 40px; margin: -20px 0 0 -28px; border-radius: 10px; background: var(--orange); }
  .yt-play::after { content: ""; position: absolute; top: 12px; left: 23px; border-style: solid; border-width: 8px 0 8px 13px; border-color: transparent transparent transparent #fff; }
  .link-video { text-decoration: none; }
  .link-video-host { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; color: #fff; font-size: 13px; font-weight: 600; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ruolo-video-row { padding: 12px 0; border-top: 1px solid var(--border); }
  #notifiche-btn.attive { background: var(--orange) !important; border-color: var(--orange) !important; }
  .notifiche-ios-banner {
    background: var(--banner-bg);
    color: var(--text);
    font-size: 13px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border);
  }
  .notifiche-ios-banner a { color: var(--orange); font-weight: 600; }
  .badge {
    background: var(--orange);
    color: #fff;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
  }
  #squadra-attiva-select {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text);
  }
  #squadra-attiva-select option { color: #1c2430; background: #fff; }
  /* Rail laterale a icone (desktop) / barra in basso (mobile), stile Elephants Playbook */
  nav.tabs {
    position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail); z-index: 900;
    display: flex; flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--card); border-right: 1px solid var(--border);
    padding: 12px 6px; overflow-y: auto; overflow-x: hidden;
  }
  nav.tabs { scrollbar-width: none; }
  nav.tabs::-webkit-scrollbar { display: none; }
  nav.tabs .rail-logo { display: flex; justify-content: center; padding: 4px 0 14px; }
  nav.tabs .rail-logo img { width: 44px; height: 44px; }
  nav.tabs button {
    background: none; border: none; border-radius: 12px;
    padding: 10px 2px 8px; color: var(--muted); cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    font-family: var(--font-body); font-size: 10.5px; font-weight: 600; line-height: 1.15; text-align: center;
    transition: color .15s ease, background .15s ease;
  }
  nav.tabs button svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
  nav.tabs button:hover { color: var(--text); background: var(--input-bg); }
  nav.tabs button.active { color: #fff; background: var(--orange); }
  main { max-width: 1400px; margin: 0 auto; padding: 24px 24px 60px calc(var(--rail) + 24px); }
  .card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
    margin-bottom: 16px;
  }
  .card h3 { margin: 0 0 12px; font-size: 19px; }
  .row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
  .row > * { flex: 1 1 160px; }
  label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
  input:hover, select:hover, textarea:hover { border-color: var(--border-hover); }
  select option { background: var(--card-2); color: var(--text); }
  input, select, textarea {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    background: var(--input-bg);
    color: var(--text);
  }
  textarea { resize: vertical; min-height: 60px; }
  input[type=checkbox] { width: auto; padding: 0; }
  .search-box { margin-bottom: 10px; }
  .search-box input { background: var(--input-bg); }
  .picker {
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 260px;
    overflow-y: auto;
  }
  .picker-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
  }
  .picker-item:last-child { border-bottom: none; }
  .picker-item:hover { background: var(--card-2); }
  .picker-item-row { display: flex; align-items: center; gap: 10px; }
  .picker-item input[type=checkbox] { flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
  .picker-item .titolo { font-size: 14px; font-weight: 600; flex: 1 1 auto; min-width: 0; word-break: break-word; }
  .picker-item .descrizione {
    margin: 0;
    padding-left: 26px;
    font-size: 12px;
    color: var(--muted);
    word-break: break-word;
  }
  .picker-item .tag {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    background: var(--card-2);
    border: 1px solid var(--border);
    padding: 2px 9px;
    border-radius: 999px;
    white-space: nowrap;
  }
  .picker-empty { padding: 12px; color: var(--muted); font-size: 13px; }
  .picker-item .coach-select {
    flex: 0 0 auto;
    width: auto;
    max-width: 200px;
    font-size: 12px;
    padding: 3px 6px;
  }
  .chat-box {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    background: var(--input-bg);
  }
  .chat-row { margin-bottom: 12px; display: flex; }
  .chat-row.utente { justify-content: flex-end; }
  .chat-row.assistente { justify-content: flex-start; }
  .chat-bubble {
    display: inline-block;
    max-width: 80%;
    padding: 9px 13px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    text-align: left;
  }
  .chat-bubble.utente { background: var(--orange); color: #fff; border-bottom-right-radius: 3px; }
  .chat-bubble.assistente { background: var(--card-2); border: 1px solid var(--border); border-bottom-left-radius: 3px; }

  .ai-widget { position: fixed; right: 18px; bottom: 18px; z-index: 1000; }
  .ai-fab {
    width: 56px; height: 56px; border-radius: 50%; background: var(--orange); color: #fff;
    border: none; font-size: 24px; cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.28);
    display: flex; align-items: center; justify-content: center;
  }
  .ai-fab:hover { opacity: .9; }
  .ai-panel {
    position: absolute; right: 0; bottom: 68px; width: 340px; max-width: calc(100vw - 36px);
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,.22); display: flex; flex-direction: column; overflow: hidden;
  }
  .ai-panel-header {
    background: var(--card-2); color: #fff; padding: 10px 14px;
    display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px;
  }
  .ai-icon-btn { background: none; border: none; color: #fff; cursor: pointer; font-size: 14px; margin-left: 8px; padding: 0; }
  .ai-settings { padding: 12px 14px; border-bottom: 1px solid var(--border); background: var(--card-2); }
  .ai-settings label { margin-top: 0; }
  .ai-panel .chat-box { flex: 1; max-height: 320px; min-height: 180px; border: none; border-radius: 0; margin: 0; background: var(--card); }
  .ai-panel-input { display: flex; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--border); }
  .ai-panel-input textarea { min-height: 40px; max-height: 90px; font-size: 13px; min-width: 0; flex: 1 1 auto; }
  .ai-panel-input .btn { flex-shrink: 0; }
  .ai-panel-footer { display: flex; justify-content: space-between; align-items: center; padding: 0 12px 10px; gap: 8px; }
  .btn {
    display: inline-block;
    background: var(--orange);
    color: #fff;
    border: none;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s ease, border-color .15s ease;
  }
  .btn:hover { opacity: .92; }
  .btn:disabled { opacity: .6; cursor: not-allowed; }
  .btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
  .btn.secondary:hover { border-color: var(--border-hover); opacity: 1; }
  .btn.small { padding: 5px 10px; font-size: 12px; }
  .btn.danger { background: var(--ko); }
  .btn { margin: 2px 6px 2px 0; }
  .btn:last-child { margin-right: 0; }
  a, button, input, select, textarea, [tabindex] {
    outline-offset: 2px;
  }
  a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
  textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
  }
  .btn-row { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
  .btn-confirm { background: var(--ok); color: #fff; border: none; }
  .btn-decline { background: var(--ko); color: #fff; border: none; }
  table { width: 100%; min-width: max-content; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
  th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--row-line); white-space: nowrap; }
  th { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-bottom-color: var(--border); }
  .pill { padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; display: inline-block; }
  .pill.confermato { background: var(--ok-bg); color: var(--ok); }
  .pill.rifiutato { background: var(--ko-bg); color: var(--ko); }
  .pill.in_attesa { background: var(--wait-bg); color: var(--wait); }
  .pill.rookie { background: var(--card-2); color: var(--muted); border: 1px solid var(--border); }
  .pill.ibrido { background: var(--ko-bg); color: var(--orange); }
  .pill.prima_squadra { background: var(--orange); color: #fff; }
  .pill.prospect { background: var(--info-bg); color: var(--info); border: 1px solid var(--border); }
  .pill.non_attivo { background: var(--card-2); color: var(--ko); border: 1px solid var(--border); }
  .stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 16px; }
  .stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
  .stat-card .num { font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--text); line-height: 1; }
  .stat-card .lbl { font-size: 12.5px; color: var(--muted); margin-top: 8px; }
  .kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
  .kanban-col { flex: 0 0 300px; background: var(--card-2); border-radius: var(--radius); padding: 12px; }
  .kanban-col h4 { margin: 0 0 10px; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: flex; justify-content: space-between; align-items: center; }
  .kanban-col h4 .count { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
  .kanban-card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 12px; margin-bottom: 10px; }
  /* Kanban compatto: le colonne si dividono la larghezza (tutte visibili) e le schede restano basse */
  .kanban-board { gap: 10px; }
  .kanban-col { flex: 1 1 0; min-width: 180px; padding: 8px; }
  .kanban-col h4 { margin-bottom: 8px; font-size: 12px; }
  .kanban-card { padding: 8px 10px; margin-bottom: 6px; font-size: 13px; }
  .kanban-card .row { gap: 4px 6px; }
  .kanban-card .row > * { flex: 0 1 auto; }
  .kanban-card .row > div:first-child { flex: 1 1 100%; }
  .kanban-card .btn.small { padding: 2px 8px; font-size: 11px; margin: 0 4px 0 0; }
  .kanban-card .pill { padding: 1px 7px; font-size: 10.5px; }
  .kanban-card > p.muted {
    font-size: 12px; line-height: 1.35; margin: 4px 0 0 !important;
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  }
  .kanban-empty { font-size: 13px; color: var(--muted); }
  .muted { color: var(--muted); font-size: 13px; }
  .error { color: var(--ko); font-size: 13px; margin-top: 8px; }
  .success { color: var(--ok); font-size: 13px; margin-top: 8px; }
  .login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .login-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 32px;
    width: 100%;
    max-width: 360px;
  }
  .login-card { text-align: center; }
  .login-card form { text-align: left; }
  .login-card h1 { font-size: 20px; margin: 0 0 4px; color: var(--text); }
  .login-card p.sub { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
  .login-card .btn { width: 100%; margin-top: 8px; }
  .confirm-card {
    max-width: 480px;
    margin: 40px auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 28px;
  }
  .confirm-card h2 { color: var(--text); margin-top: 0; }
  a.link { color: var(--text); text-decoration-color: var(--orange); word-break: break-all; }
  .empty { color: var(--muted); font-size: 14px; padding: 10px 0; }

  .todo-add-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .todo-add-circle { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; }
  .todo-add-row input[type=text] { border: none; padding: 4px 0; font-size: 15px; background: transparent; }
  .todo-add-row input[type=text]:focus-visible { outline: none; box-shadow: 0 2px 0 0 var(--orange); }
  .todo-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid var(--border);
  }
  .todo-row:last-child { border-bottom: none; }
  .todo-row:hover { background: var(--card-2); }
  .todo-check {
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted);
    flex-shrink: 0; display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: #fff; cursor: pointer;
  }
  .todo-check.done { background: var(--ok); border-color: var(--ok); }
  .todo-body { flex: 1 1 auto; min-width: 0; cursor: pointer; }
  .todo-title { font-size: 14px; font-weight: 500; word-break: break-word; }
  .todo-title.done { text-decoration: line-through; color: var(--muted); font-weight: 400; }
  .todo-meta { display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; align-items: center; }
  .todo-due { font-size: 12px; color: var(--muted); }
  .todo-due.overdue { color: var(--ko); font-weight: 600; }
  .todo-tag { font-size: 11px; color: var(--muted); background: var(--card-2); border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px; }
  .todo-star { flex-shrink: 0; cursor: pointer; font-size: 19px; color: var(--border); line-height: 1; }
  .todo-star.on { color: #f5a623; }
  .todo-completed-toggle { padding: 10px 16px; font-size: 13px; color: var(--muted); cursor: pointer; border-bottom: 1px solid var(--border); user-select: none; }

  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px); display: flex;
    align-items: center; justify-content: center; z-index: 2000; padding: 16px;
  }
  .modal-box {
    background: var(--card); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 420px;
    max-height: 90vh; overflow-y: auto; padding: 22px; box-shadow: var(--shadow);
  }
  .modal-box h3 { margin: 0 0 16px; }

  /* ---------- Formazione (campo da football) ---------- */
  .campo-sommario { margin: 0 2px 10px; }
  .campo {
    border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px;
    background-color: #2f7a3a;
    background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 58px, rgba(255,255,255,.28) 58px, rgba(255,255,255,.28) 60px);
    border: 3px solid #fff;
  }
  .campo-meta { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
  .campo-meta.difesa { background: rgba(0,0,0,.14); }
  .campo-etichetta {
    font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: .12em;
    text-transform: uppercase; color: rgba(255,255,255,.85); text-align: center;
  }
  .campo-scrimmage { position: relative; height: 26px; display: flex; align-items: center; justify-content: center; }
  .campo-scrimmage::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 3px dashed #ffd84d; }
  .campo-scrimmage span {
    position: relative; background: #2f7a3a; color: #ffd84d; padding: 0 10px;
    font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  }
  .campo-riga { display: grid; gap: 14px; }
  .campo-riga-1 { grid-template-columns: minmax(0, 420px); justify-content: center; }
  .campo-riga-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
  .postazione {
    background: var(--card); border-radius: 8px; padding: 10px 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,.18); min-width: 0;
  }
  .postazione-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
  .postazione-sigla {
    font-family: var(--font-display); font-size: 17px; font-weight: 700; color: #fff; background: var(--card-2);
    border-radius: 6px; padding: 1px 8px; white-space: nowrap;
  }
  .attacco .postazione-sigla { background: var(--orange); }
  .postazione-nome { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .postazione .count, .panchina .count {
    font-size: 12px; font-weight: 600; color: var(--muted); background: var(--card-2); border: 1px solid var(--border);
    border-radius: 999px; padding: 1px 8px;
  }
  .postazione ul { list-style: none; margin: 0; padding: 0; }
  .postazione li { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-top: 1px solid var(--border); font-size: 14px; }
  .postazione-vuota { font-size: 13px; color: var(--muted); padding: 4px 0; }
  .gf-nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .gf-eta { font-size: 12px; color: var(--muted); }
  .gf-eta::after { content: " anni"; }
  .panchina h3 { display: flex; align-items: center; gap: 8px; }
  .panchina-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
  .panchina-chip {
    display: flex; align-items: center; gap: 6px; background: var(--card-2); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 10px; font-size: 14px; min-width: 0;
  }
  @media (max-width: 600px) {
    .campo-meta { padding: 10px; gap: 10px; }
    .campo-riga-2 { grid-template-columns: minmax(0, 1fr); }
    .campo-etichetta { font-size: 18px; }
  }

  @media (max-width: 760px) {
    :root { --rail: 0px; }
    header.topbar { margin-left: 0; padding: 10px 14px; }
    header.topbar .brand { display: flex; }
    nav.tabs {
      top: auto; width: auto; right: 0; flex-direction: row; gap: 2px;
      border-right: none; border-top: 1px solid var(--border);
      /* Barra più alta, con margine extra sotto: lo swipe dal bordo basso dell'iPhone (home indicator)
         non deve finire sui pulsanti. */
      padding: 8px 8px calc(22px + env(safe-area-inset-bottom)); overflow-x: auto; overflow-y: hidden;
    }
    nav.tabs .rail-logo { display: none; }
    nav.tabs button { flex: 0 0 auto; min-width: 84px; min-height: 60px; padding: 10px 8px; gap: 6px; font-size: 12.5px; border-radius: 14px; }
    nav.tabs button svg { width: 27px; height: 27px; }
    main { padding: 16px 14px 150px; }
    .ai-widget { bottom: 124px; right: 12px; }
  }

  /* Drill: descrizione in colonna su desktop; su mobile una riga a tutta larghezza aperta dal "+" */
  .drill-table .td-plus, .drill-table .drill-desc-row { display: none; }
  .drill-plus {
    width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 1px solid var(--border);
    background: transparent; color: var(--orange); font-size: 20px; font-weight: 600; line-height: 1; cursor: pointer;
  }
  .drill-plus:hover { border-color: var(--border-hover); }
  @media (max-width: 760px) {
    .drill-table { display: block; table-layout: auto !important; min-width: 0; }
    .drill-table tbody { display: block; }
    .drill-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 0; border-bottom: 1px solid var(--row-line); }
    .drill-table tr.drill-head, .drill-table .td-desc { display: none; }
    .drill-table td { display: block; border: 0; padding: 0; width: auto !important; white-space: normal; }
    .drill-table td:only-child { width: 100% !important; }
    /* Riga 1: titolo a tutta larghezza (+ in alto a destra). Riga 2: squadra, link e bottoni. */
    .drill-table tr { position: relative; }
    .drill-table .td-nome { flex: 1 1 100%; min-width: 0; order: 1; font-size: 16px; line-height: 1.3; }
    .drill-table tr:has(.td-plus) .td-nome { padding-right: 44px !important; }
    .drill-table .td-plus { display: block; position: absolute; top: 10px; right: 0; }
    .drill-table .td-squadra, .drill-table .td-link, .drill-table .td-azioni { order: 3; font-size: 13px; flex: 0 0 auto; }
    .drill-table .td-azioni { margin-left: auto; }
    .drill-table tr.drill-desc-row { display: none; padding: 0 0 12px; border-bottom: 1px solid var(--row-line); }
    .drill-table tr.drill-desc-row.open { display: block; }
    .drill-table tr.drill-desc-row td { font-size: 14px; line-height: 1.5; color: var(--muted); padding-top: 2px; }
    .drill-table tr:has(+ .drill-desc-row.open) { border-bottom: 0; padding-bottom: 6px; }
  }
  .drill-table .doc-vis-mobile { display: none; }
  @media (max-width: 760px) { .drill-table .doc-vis-mobile { display: inline; } }
  .drill-table .cat-mobile { display: none; }
  @media (max-width: 760px) { .drill-table .cat-mobile { display: block; } }

  /* Import utenti */
  .imp-utenti > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .imp-utenti > summary::-webkit-details-marker { display: none; }
  .imp-utenti > summary h3 { margin: 0; }
  .imp-utenti > summary::after { content: "+"; font-size: 24px; font-weight: 600; line-height: 1; color: var(--orange); }
  .imp-utenti[open] > summary::after { content: "\2212"; }
  .imp-utenti[open] > summary { margin-bottom: 10px; }

  /* Presenze dell'allenatore: una riga per allenamento (info, stato, pulsante), drill richiudibili sotto. */
  .presenza-riga { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 9px 0; border-bottom: 1px solid var(--row-line); }
  .presenza-riga:last-child { border-bottom: none; }
  .presenza-info { flex: 1 1 220px; min-width: 0; }
  .presenza-riga .btn-row { margin-top: 0; gap: 8px; }
  .presenza-riga .btn { padding: 5px 12px; font-size: 12.5px; }
  .presenza-drill { flex-basis: 100%; font-size: 13px; }
  .presenza-drill > summary { cursor: pointer; color: var(--muted); }
  .presenza-drill ul { margin: 4px 0 2px; padding-left: 18px; }

  /* ---------- Giocatori (anagrafica unificata) ---------- */
  .pill.custom { background: var(--card-2); color: var(--muted); border: 1px solid var(--border); }
  .gio-intro-top { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; }
  .gio-intro-top h3 { margin-bottom: 6px; }
  .gio-intro-top p { margin: 0; max-width: 640px; }
  .gio-intro-azioni { display: flex; gap: 8px; flex-wrap: wrap; }
  .gio-nuovo { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 14px; }
  .gio-toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
  .gio-toolbar input { flex: 1 1 240px; width: auto; }
  .gio-toolbar select { flex: 0 1 200px; width: auto; }
  .gio-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
  .gio-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
  .gio-chip:hover { border-color: var(--border-hover); color: var(--text); }
  .gio-chip.on { background: var(--info-bg); color: var(--info); border-color: var(--info); }
  .gio-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
  @media (min-width: 1100px) {
    .gio-layout { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
    .gio-scheda { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  }
  .gio-lista { padding: 0; overflow: hidden; }
  .gio-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 110px 48px 48px 48px 48px; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--row-line); cursor: pointer; font-size: 14px; }
  .gio-row:first-child { border-top: none; }
  .gio-row:not(.gio-row-head):hover { background: var(--card-2); }
  .gio-row.sel { background: var(--info-bg); }
  .gio-row-head { cursor: default; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 700; padding-top: 12px; padding-bottom: 8px; }
  .gio-nome { display: flex; flex-direction: column; min-width: 0; }
  .gio-nome .muted { font-size: 12px; }
  .gio-sq { font-size: 12.5px; }
  .gio-dots { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
  .gio-row-head .gio-dots { font-size: 10px; white-space: nowrap; }
  .gio-d { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
  .gio-d.ok { background: var(--ok); } .gio-d.wa { background: var(--wait); } .gio-d.ko { background: var(--ko); }
  @media (max-width: 700px) {
    .gio-row { grid-template-columns: minmax(0, 1fr) auto 34px 34px 34px 34px; gap: 4px; padding-left: 12px; padding-right: 12px; }
    .gio-row .gio-sq { display: none; }
  }
  .gio-card { padding: 0; overflow: hidden; margin-bottom: 0; }
  .gio-vuota { text-align: center; padding: 36px 20px; }
  #gio-testa { padding: 16px 18px 10px; }
  .gio-testa-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
  .gio-avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--info-bg); color: var(--info); display: flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
  .mp-testo { margin-top: 8px; }
  .mp-testo summary { cursor: pointer; font-size: 13px; color: var(--info); }
  .mp-testo-corpo { white-space: pre-wrap; font-size: 13px; line-height: 1.5; max-height: 260px; overflow-y: auto; margin-top: 6px; padding: 10px 12px; border-radius: 10px; background: var(--card-2); }
  .gio-avatar { overflow: hidden; }
  .gio-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .gio-avatar.piccolo { width: 34px; height: 34px; font-size: 12px; }
  .gio-avatar.grande { width: 72px; height: 72px; font-size: 22px; }
  .gio-nome.gio-nome-av { flex-direction: row; align-items: center; gap: 10px; }
  .gio-nome-av > div:last-child { min-width: 0; display: flex; flex-direction: column; }
  .gio-foto-box { display: flex; flex-direction: column; align-items: center; gap: 4px; flex-shrink: 0; }
  .gio-foto-btn { font-size: 12px; color: var(--info); cursor: pointer; text-decoration: underline; }
  .gio-foto-btn input { display: none; }
  .gio-foto-rimuovi { background: none; border: 0; padding: 0; font-size: 12px; color: var(--muted, #888); cursor: pointer; text-decoration: underline; }
  .gio-testa-nome { flex: 1 1 160px; min-width: 0; font-size: 16px; }
  .gio-testa-nome .muted { font-size: 13px; }
  .gio-azioni { display: flex; gap: 6px; flex-wrap: wrap; }
  .gio-azioni .btn { margin: 0; text-decoration: none; }
  .gio-compl { margin-top: 12px; }
  .gio-compl-top { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; margin-bottom: 5px; }
  .gio-barra { height: 6px; border-radius: 3px; background: var(--card-2); overflow: hidden; }
  .gio-barra div { height: 100%; background: var(--info); border-radius: 3px; }
  .gio-barra div.ok { background: var(--ok); }
  .gio-save { min-height: 18px; font-size: 12.5px; margin-top: 6px; }
  .gio-save.success { color: var(--ok); } .gio-save.error { color: var(--ko); }
  .gio-tabs { display: flex; gap: 2px; flex-wrap: wrap; padding: 0 12px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
  .gio-tab { background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--muted); padding: 10px 12px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit; }
  .gio-tab:hover { color: var(--text); }
  .gio-tab.on { color: var(--text); border-bottom-color: var(--orange); }
  #gio-corpo { padding: 14px 18px 18px; }
  .gio-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 12px; }
  .gio-campo label { margin-bottom: 3px; }
  .gio-campo input:disabled { opacity: .65; }
  .gio-nota { font-size: 12.5px; margin: 10px 0 0; }
  .gio-sezione { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--row-line); }
  .gio-storia { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
  .gio-banner { margin: 0 0 4px; padding: 9px 12px; border-radius: 10px; background: var(--card-2); font-size: 13px; }
  .gio-banner.attenzione { background: var(--wait-bg); color: var(--wait); }
  .gio-tutore { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--row-line); flex-wrap: wrap; }
  .gio-tutore .gio-form { flex: 1 1 360px; }
  .gio-nuovo-tutore summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--info); }
  .gio-consenso { padding: 8px 0; border-top: 1px solid var(--row-line); }
  .gio-consenso-riga { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .gio-consenso-form { margin-top: 8px; }
  .gio-note { max-height: 240px; overflow-y: auto; margin-bottom: 10px; }
  .gio-note p { margin: 0 0 8px; font-size: 13.5px; }
  .gio-stato-riga { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
  .gio-stato-riga input:not([type=checkbox]) { flex: 1 1 200px; width: auto; }
  .gio-check { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; color: var(--text); white-space: nowrap; }

  /* ---------- Iscrizioni online ---------- */
  nav.tabs button { position: relative; }
  .tab-badge { position: absolute; top: 4px; right: 8px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--ko); color: #fff; font: 700 11px/18px var(--font-body); font-style: normal; text-align: center; }
  nav.tabs button.active .tab-badge { background: #fff; color: var(--orange); }
  .isc-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
  .isc-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; background: var(--card); }
  .isc-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
  .isc-dati { margin-top: 10px; display: grid; gap: 4px; font-size: 13.5px; }
  .isc-riga { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; }
  .isc-riga span:first-child { color: var(--muted); }
  .isc-riga span:last-child { word-break: break-word; }
  .isc-consensi { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
  .isc-dup { margin-top: 12px; padding: 12px 14px; border-radius: 10px; background: var(--wait-bg); }
  .isc-ok { background: var(--ok-bg); border-color: var(--ok); color: var(--text); }
  .isc-link { border-top: 1px solid var(--row-line); padding: 12px 0; }
  .isc-link-top { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
  .isc-link-azioni { display: flex; gap: 6px; flex-wrap: wrap; }
  .isc-link-azioni .btn { margin: 0; }
  .isc-url { font-size: 12.5px; color: var(--muted); }
  .isc-qr { display: flex; gap: 16px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
  .isc-qr svg { border-radius: 8px; max-width: 100%; height: auto; }

  /* ---------- Certificati medici e scadenze ---------- */
  .gio-d.na { background: transparent; border: 1.5px solid var(--muted); width: 11px; height: 11px; }
  .gio-cert-riga { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--row-line); font-size: 13.5px; }
  .gio-cert-azioni { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
  .gio-cert-azioni .btn { margin: 0; }
  .scad-riepilogo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
  .scad-box { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; text-align: left; font-family: inherit; color: var(--text); }
  .scad-box:hover { border-color: var(--border-hover); }
  .scad-box.on { border-color: var(--info); background: var(--info-bg); }
  .scad-box b { display: block; font-size: 26px; font-family: var(--font-display); line-height: 1.1; }
  .scad-box span { font-size: 12.5px; color: var(--muted); }
  .scad-box.ko b { color: var(--ko); } .scad-box.wa b { color: var(--wait); }
  .scad-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
  @media (min-width: 1100px) { .scad-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
  .scad-riga { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 0; border-top: 1px solid var(--row-line); font-size: 14px; }
  .scad-riga:first-of-type { border-top: none; }
  .scad-riga .muted { font-size: 12.5px; }
  .scad-cal-testa { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .scad-cal-testa h3 { margin: 0; text-transform: capitalize; }
  .scad-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .scad-cal .gg-nome { text-align: center; font-size: 11px; color: var(--muted); text-transform: uppercase; padding: 2px 0 4px; }
  .scad-giorno { min-height: 48px; border: 1px solid var(--row-line); border-radius: 8px; padding: 4px 6px; font-size: 12.5px; cursor: pointer; background: transparent; color: var(--text); font-family: inherit; text-align: left; display: flex; flex-direction: column; justify-content: space-between; }
  .scad-giorno.vuoto { visibility: hidden; }
  .scad-giorno.oggi { border-color: var(--orange); }
  .scad-giorno.sel { background: var(--info-bg); border-color: var(--info); }
  .scad-giorno .n { align-self: flex-end; min-width: 18px; height: 18px; border-radius: 9px; background: var(--wait); color: #1b1b1b; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; padding: 0 4px; }
  .scad-giorno .n.ko { background: var(--ko); color: #fff; }
  .gio-dot-cell { display: flex; justify-content: center; align-items: center; }
  .gio-row-head .gio-sq, .gio-row-head .gio-dot-cell { font-size: 11px; }

  /* ---------- Quote e pagamenti ---------- */
  .qt-riga { border-top: 1px solid var(--row-line); }
  .qt-riga:first-child { border-top: none; }
  .qt-nome { display: flex; flex-direction: column; min-width: 0; }
  .qt-nome .muted { font-size: 12.5px; }
  .qt-rate { display: flex; gap: 4px; flex-wrap: wrap; }
  .qt-chip { min-width: 24px; height: 24px; border-radius: 6px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
  .qt-chip.ok { background: var(--ok-bg); color: var(--ok); }
  .qt-chip.wa { background: var(--wait-bg); color: var(--wait); }
  .qt-chip.ko { background: var(--ko-bg); color: var(--ko); }
  .qt-resid { display: flex; flex-direction: column; text-align: right; }
  .qt-resid b { font-size: 15px; }
  .qt-resid .muted { font-size: 12px; }
  .qt-dettaglio { padding: 6px 12px 16px 38px; background: var(--card); }
  .qt-rata { display: grid; grid-template-columns: 110px 150px 120px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--row-line); }
  .qt-rata:first-child { border-top: none; }
  .qt-rata-num { font-weight: 600; font-size: 14px; }
  .qt-rata-campo label { margin-bottom: 2px; font-size: 11px; }
  .qt-rata-stato .muted { font-size: 12px; margin-top: 3px; }
  .qt-rata-azioni { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
  .qt-rata-azioni .btn { margin: 0; }
  .qt-incasso { grid-column: 1 / -1; padding: 12px 14px; border-radius: 10px; background: var(--info-bg); }
  .qt-candidati { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 12px; max-height: 280px; overflow-y: auto; }
  .qt-prova { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--card-2); white-space: pre-wrap; font-size: 13px; }
  @media (max-width: 800px) {
    .qt-rata { grid-template-columns: 1fr 1fr; }
    .qt-rata-num, .qt-rata-stato, .qt-rata-azioni { grid-column: 1 / -1; justify-content: flex-start; }
    .qt-dettaglio { padding-left: 12px; }
  }

  /* Nuovo piano quote: passi, calendario rate, elenco giocatori */
  .qt-form { display: grid; gap: 22px; }
  .qt-passo-titolo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; margin-bottom: 12px; }
  .qt-passo-titolo span { width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; }
  .qt-nota { font-size: 12px; color: var(--muted); margin-top: 3px; }
  .qt-sched { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; margin-top: 12px; }
  .qt-sched-voce { display: flex; flex-direction: column; gap: 1px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card-2); font-size: 12.5px; color: var(--muted); }
  .qt-sched-voce b { font-size: 16px; color: var(--text); }
  .qt-gl { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
  .qt-gl-testa { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 12px; background: var(--card-2); }
  .qt-gl-conta { font-size: 13px; font-weight: 600; }
  .qt-gl-azioni { display: flex; gap: 6px; }
  .qt-gl-azioni .btn { margin: 0; }
  .qt-gl-corpo { max-height: 320px; overflow-y: auto; }
  .qt-g-riga { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: center; margin: 0; padding: 10px 14px; border-top: 1px solid var(--row-line); font-size: 14.5px; font-weight: 500; color: var(--text); cursor: pointer; }
  .qt-g-riga:hover { background: var(--card-2); }
  .qt-g-riga input { width: 18px; height: 18px; }
  .qt-g-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* ---------- Impostazioni personali ---------- */
  nav.tabs button[data-tab="impostazioni"] { margin-top: auto; }
  @media (max-width: 760px) { nav.tabs button[data-tab="impostazioni"] { margin-top: 0; } }
  .imp-passi { margin: 0; padding-left: 20px; font-size: 14px; line-height: 1.7; }
  .imp-voci { display: grid; gap: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
  .imp-voce { display: grid; grid-template-columns: 22px 28px minmax(0, 1fr); gap: 12px; align-items: center; margin: 0; padding: 11px 14px; border-top: 1px solid var(--row-line); cursor: pointer; color: var(--text); font-weight: 400; }
  .imp-voce:first-child { border-top: none; }
  .imp-voce:hover { background: var(--card-2); }
  .imp-voce input { width: 18px; height: 18px; }
  .imp-icona svg { width: 22px; height: 22px; stroke: var(--muted); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .imp-testo { display: flex; flex-direction: column; min-width: 0; }
  .imp-testo b { font-size: 14.5px; }
  .imp-testo .muted { font-size: 12.5px; }

  /* Impostazioni: trascinamento delle voci del menu */
  .imp-voce { grid-template-columns: 30px minmax(0, 1fr) auto; padding: 4px 10px 4px 4px; cursor: default; background: var(--card); }
  .imp-voce:hover { background: var(--card-2); }
  .imp-corpo { display: grid; grid-template-columns: 22px 28px minmax(0, 1fr); gap: 12px; align-items: center; margin: 0; padding: 8px 0; cursor: pointer; color: var(--text); font-weight: 400; }
  .imp-maniglia { display: flex; align-items: center; justify-content: center; height: 40px; cursor: grab; touch-action: none; color: var(--muted); border-radius: 8px; user-select: none; }
  .imp-maniglia:hover { color: var(--text); background: var(--input-bg); }
  .imp-maniglia svg { width: 20px; height: 20px; fill: currentColor; }
  .imp-frecce { display: flex; gap: 4px; }
  .imp-frecce .btn { margin: 0; padding: 3px 8px; line-height: 1; }
  .imp-home { margin-left: 8px; font-size: 10.5px; vertical-align: middle; }
  .imp-home[hidden] { display: none; }
  .imp-voce.imp-trascinata { background: var(--info-bg); box-shadow: 0 6px 18px rgba(0, 0, 0, .35); position: relative; z-index: 2; cursor: grabbing; }
  .imp-voce.imp-trascinata .imp-maniglia { cursor: grabbing; color: var(--info); }
  @media (max-width: 520px) { .imp-frecce { display: none; } .imp-voce { grid-template-columns: 34px minmax(0, 1fr); } }

  /* ---------- Allenatori e staff ---------- */
  .stf-row { grid-template-columns: minmax(0, 1fr) 150px 52px 52px; }
  .stf-row.coach { grid-template-columns: minmax(0, 1fr) 130px 52px 52px 60px; }
  @media (max-width: 700px) {
    .stf-row, .stf-row.coach { grid-template-columns: minmax(0, 1fr) 38px 38px; }
    .stf-row.coach { grid-template-columns: minmax(0, 1fr) 38px 38px 44px; }
    .stf-row .gio-sq { display: none; }
  }
  @media (min-width: 701px) { .stf-row .gio-nome .muted { display: none; } }
  .stf-avviso { margin-bottom: 14px; border-color: var(--wait); }
  .stf-avviso-riga { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--row-line); font-size: 13.5px; }
  .stf-avviso b:first-child { display: block; margin-bottom: 4px; }
  .gio-banner.errore { background: var(--ko-bg, rgba(220, 60, 60, .15)); color: var(--ko); }
  .stf-upload { cursor: pointer; margin: 0; }
  .stf-upload input { display: none; }

/* ---------- Gestione infortuni ---------- */
.inf-layout { display: grid; grid-template-columns: 340px 1fr; gap: 14px; align-items: start; }
@media (max-width: 860px) { .inf-layout { grid-template-columns: 1fr; } }
.inf-riga { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 8px; cursor: pointer; background: var(--card-2); }
.inf-riga.on { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.inf-riga .inf-top { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.inf-st { display: inline-block; border: 1px solid currentColor; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; }
.inf-st.OK { color: var(--ok); } .inf-st.Limited { color: var(--info); } .inf-st.Questionable { color: var(--wait); }
.inf-st.Doubtful { color: #ff9a3c; } .inf-st.Out { color: var(--ko); } .inf-st.IR { color: #b07cff; } .inf-st.chiuso { color: var(--muted); }
.inf-statusbar { display: flex; gap: 6px; flex-wrap: wrap; }
.inf-statusbar button { background: transparent; border: 1px solid currentColor; border-radius: 8px; padding: 6px 10px; font-weight: 700; cursor: pointer; font-size: 13px; opacity: .5; font-family: inherit; }
.inf-statusbar button.on { opacity: 1; background: color-mix(in srgb, currentColor 18%, transparent); }
.inf-statusbar button:disabled { cursor: default; }
.inf-statusbar button.OK { color: var(--ok); } .inf-statusbar button.Limited { color: var(--info); } .inf-statusbar button.Questionable { color: var(--wait); }
.inf-statusbar button.Doubtful { color: #ff9a3c; } .inf-statusbar button.Out { color: var(--ko); } .inf-statusbar button.IR { color: #b07cff; }
.inf-timeline { border-left: 2px solid var(--border); margin-left: 6px; padding-left: 14px; }
.inf-voce { position: relative; margin-bottom: 12px; }
.inf-voce:before { content: ""; position: absolute; left: -21px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.inf-voce.stato:before { background: var(--orange); }
.inf-voce .inf-meta { font-size: 12px; color: var(--muted); }
.inf-voce .inf-meta b { color: var(--text); }
.inf-voce .inf-testo { background: var(--card-2); border-radius: 8px; padding: 8px 10px; margin-top: 3px; white-space: pre-wrap; }
.inf-ruolo { font-size: 11px; border: 1px solid var(--border); border-radius: 8px; padding: 0 6px; margin-left: 4px; }
.inf-file { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; background: var(--card-2); }
.inf-file > div { flex: 1; min-width: 0; word-break: break-word; }
.inf-filtri { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.inf-filtri button { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 14px; padding: 3px 10px; font-size: 12px; cursor: pointer; font-family: inherit; }
.inf-filtri button.on { color: var(--text); border-color: var(--orange); }
.inf-bell-wrap { position: relative; display: inline-block; }
.inf-bell-panel { position: absolute; right: 0; top: 110%; width: 320px; max-width: 90vw; max-height: 60vh; overflow: auto; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; z-index: 50; box-shadow: 0 8px 30px rgba(0,0,0,.4); }
.inf-notif { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; }
.inf-notif:last-child { border: 0; }
.inf-notif.nuova { font-weight: 700; }
.inf-sola-lettura { background: var(--card-2); border-radius: 8px; padding: 8px 10px; color: var(--muted); font-size: 13px; margin: 8px 0; }

  /* Shared status filters and team assignment. */
  .filters-menu,.team-picker { position:relative; min-width:0; }
  :is(.filters-menu,.team-picker)>summary { display:flex; align-items:center; cursor:pointer; list-style:none; }
  :is(.filters-menu,.team-picker)>summary::-webkit-details-marker { display:none; }
  :is(.filters-menu,.team-picker)>summary svg { width:18px; height:18px; flex:none; }
  .filters-menu { flex:none; }
  .filters-menu>summary { position:relative; justify-content:center; width:44px; height:44px; color:var(--text); background:var(--card); border:1px solid var(--border); border-radius:12px; }
  .filters-menu[open]>summary,.filters-menu.has-filter>summary { color:var(--orange); border-color:currentColor; }
  .filters-menu.has-filter>summary::after { content:""; position:absolute; width:6px; height:6px; border-radius:50%; top:7px; right:7px; background:currentColor; }
  .filters-popover { position:absolute; z-index:20; top:calc(100% + 8px); right:0; width:min(260px, calc(100vw - 42px)); padding:13px; border:1px solid var(--border); border-radius:16px; color:var(--text); background:var(--card); box-shadow:0 14px 32px #0004; }
  .filters-popover>strong { display:block; padding:0 8px 5px; }
  .filters-popover>label { margin:5px 0; }
  .filters-options { display:grid; gap:3px; margin-top:6px; }
  .filters-options>button { padding:9px 10px; min-height:42px; text-align:left; font:inherit; color:var(--text); background:transparent; border:0; border-radius:9px; cursor:pointer; }
  .filters-options>button:hover { background:var(--card-2); }
  .filters-options>button[aria-pressed=true] { color:var(--info); background:var(--info-bg); font-weight:600; }
  .gio-toolbar:has(.filters-menu) { flex-wrap:nowrap; gap:8px; margin:0 0 16px; max-width:400px; }
  .gio-toolbar:has(.filters-menu)>input { flex:1 1 0; min-width:0; }
  .gio-layout:has(>.gio-scheda[hidden]) { grid-template-columns:minmax(0,1fr); }
  .gio-scheda[hidden] { display:none; }
  .team-picker { width:min(100%, 360px); }
  .team-picker>summary { justify-content:space-between; gap:12px; min-height:44px; padding:10px 13px; border:1px solid var(--border); border-radius:12px; background:var(--input-bg); color:var(--text); }
  .team-picker>summary span { min-width:0; overflow-wrap:anywhere; }
  .team-picker[open]>summary svg { transform:rotate(180deg); }
  .team-picker-options { display:grid; gap:4px; margin-top:6px; max-height:230px; overflow:auto; padding:5px; border:1px solid var(--border); border-radius:12px; background:var(--card); }
  .team-picker-options>label { display:flex; align-items:center; gap:12px; min-height:44px; padding:8px 10px; margin:0; border-radius:8px; color:var(--text); font:inherit; cursor:pointer; }
  .team-picker-options>label:hover,.team-picker-options>label:has(input:checked) { background:var(--card-2); }
  .team-picker-options input[type=checkbox],.users-table input[type=checkbox],.users-bulk input[type=checkbox],.qt-select input[type=checkbox] { flex:none; width:18px; height:18px; margin:0; accent-color:var(--orange); cursor:pointer; }
  .team-picker .team-picker-save { margin-top:8px; }

  /* Account rows, adjustable desktop table and touch layout. */
  .profile-mini { position:relative; display:inline-grid; place-items:center; width:36px; height:36px; flex:0 0 36px; border-radius:50%; overflow:hidden; background:var(--info-bg); color:var(--info); font-size:12px; font-weight:700; }
  .profile-mini>img { position:absolute; inset:0; display:block; width:100%; height:100%; object-fit:cover; }
  .users-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:12px 18px; margin:0 0 12px; }
  .users-toolbar>input { flex:0 1 330px; min-width:0; max-width:330px; }
  .users-bulk { display:flex; align-items:center; gap:8px 12px; flex-wrap:wrap; }
  .users-bulk>label,.users-select,.qt-select { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:44px; margin:0; font-size:13px; cursor:pointer; }
  .users-select { min-width:26px; }
  .users-result { margin:0 0 10px; }
  .users-result:empty { display:none; }
  .users-table { table-layout:fixed; }
  .users-table th { position:relative; padding-right:20px; text-align:left; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .users-table td { white-space:normal; overflow-wrap:anywhere; }
  .users-table .users-edit[hidden] { display:none!important; }
  .users-table .users-resize { position:absolute; inset:0 0 0 auto; width:16px; cursor:col-resize; touch-action:none; }
  .users-resize::after { content:""; position:absolute; inset:26% 5px 26% auto; width:2px; border-radius:2px; background:var(--border); }
  .users-resize:hover::after,.users-resize:focus-visible::after { background:var(--orange); }
  .users-table .users-resize:focus-visible { outline-offset:-2px; }
  .users-sr { position:absolute; width:1px; height:1px; overflow:hidden; clip-path:inset(50%); white-space:nowrap; }
  .users-identity { display:flex; align-items:center; gap:10px; }
  .users-identity>b { font-weight:600; }
  .users-actions { display:flex; flex-wrap:wrap; gap:5px; }
  .users-actions .btn,.users-bulk .btn { margin:0; }
  @media(max-width:760px) {
    .users-toolbar>input { flex:1 1 100%; max-width:none; }
    .users-table-scroll { overflow:visible; }
    .users-table { width:100%!important; min-width:0; }
    .users-table,.users-table tbody,.users-table .users-edit td { display:block; }
    .users-table :is(colgroup,thead) { display:none; }
    .users-table .utente-riga { display:grid; grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"name select" "role status" "teams teams" "username username" "email email" "sheet sheet" "actions actions"; gap:6px 8px; padding:14px 0; border-bottom:1px solid var(--row-line); }
    .users-table td[data-col] { display:block; padding:0; border:0; }
    .users-table [data-col=nome] { grid-area:name; align-self:center; }
    .users-table [data-col=selezione] { grid-area:select; }
    .users-table [data-col=ruolo] { grid-area:role; }
    .users-table [data-col=stato] { grid-area:status; color:var(--muted); text-align:right; }
    .users-table [data-col=squadre] { grid-area:teams; }
    .users-table [data-col=squadre]::before { content:"Squadre  "; color:var(--muted); }
    .users-table [data-col=username] { grid-area:username; color:var(--muted); }
    .users-table [data-col=username]::before { content:"@"; }
    .users-table [data-col=email] { grid-area:email; color:var(--muted); }
    .users-table [data-col=scheda] { grid-area:sheet; margin-top:4px; }
    .users-table [data-col=scheda]::before { content:"Scheda  "; color:var(--muted); }
    .users-table [data-col=azioni] { grid-area:actions; }
    .users-table .users-select { min-width:44px; }
    .users-table .users-edit { display:block; }
    .users-table .users-edit td { padding:12px 0; }
  }

  /* Keep open and delete together, even when actions wrap. */
  .repo-actions,.repo-open-delete,.repo-visibility { display:flex; align-items:center; gap:6px; }
  .repo-actions { flex-wrap:wrap; justify-content:flex-end; }
  .repo-open-delete { flex:none; }
  .repo-actions .btn,.repo-visibility { margin:0; }
  .repo-visibility { font-size:12px; }
  @media(max-width:760px) {
    .drill-table .td-azioni { flex-basis:100%; padding-top:4px; }
    .repo-visibility { min-height:44px; }
  }

  /* Quote summary and expandable installments. */
  .qt-toolbar,.qt-plan-filter,.qt-reminder-actions { display:flex; align-items:center; gap:8px; }
  .qt-toolbar { flex-wrap:wrap; }
  .qt-toolbar>input { flex:1 1 195px; max-width:330px; }
  .qt-plan-filter { flex:1 1 300px; min-width:0; }
  .qt-plan-filter select { flex:1 1 0; min-width:0; }
  .qt-reminder-actions { flex-wrap:wrap; margin:12px 0 18px; }
  .qt-reminder-actions .btn { margin:0; }
  .qt-riga-top { display:grid; grid-template-columns:32px minmax(0,1fr); align-items:start; gap:8px; padding:8px 0; }
  .qt-select { min-width:32px; margin-top:5px; }
  .qt-overview { display:grid; grid-template-columns:minmax(0,1fr) auto 16px; grid-template-areas:"name state arrow" "amount rates arrow"; gap:12px 14px; align-items:center; width:100%; min-width:0; padding:11px 9px; text-align:left; color:var(--text); background:transparent; border:0; border-radius:12px; font:inherit; cursor:pointer; }
  .qt-overview:hover,.qt-riga.aperta .qt-overview { background:var(--card-2); }
  .qt-overview .qt-nome { grid-area:name; display:flex; flex-direction:row; align-items:center; gap:10px; min-width:0; overflow-wrap:anywhere; }
  .qt-nome>span:last-child { display:grid; gap:3px; }
  .qt-nome b { font-size:16px; }
  .qt-status { grid-area:state; align-self:start; justify-self:end; white-space:nowrap; }
  .qt-overview .qt-resid { grid-area:amount; align-items:flex-start; text-align:left; }
  .qt-overview .qt-resid b { font-size:19px; line-height:1.25; }
  .qt-overview .qt-rate { grid-area:rates; justify-content:flex-end; align-items:center; gap:5px; }
  .qt-rate .muted { font-size:12px; margin-right:3px; }
  .qt-overview>svg { grid-area:arrow; width:16px; height:16px; color:var(--muted); }
  .qt-overview[aria-expanded=true]>svg { transform:rotate(180deg); }
  @media(max-width:600px) {
    .qt-toolbar>input { max-width:none; }
    .qt-riga-top { gap:5px; }
    .qt-overview { grid-template-columns:minmax(0,1fr) auto; grid-template-areas:"name state" "amount arrow" "rates rates"; gap:10px 6px; padding:10px 3px; }
    .qt-overview .qt-rate { justify-content:flex-start; }
    .qt-overview>svg { justify-self:end; }
    .qt-overview .qt-nome { gap:7px; }
    .qt-overview .profile-mini { width:28px; height:28px; flex-basis:28px; }
  }

  .imp-avatar-form { display:flex; align-items:center; gap:14px; flex-wrap:wrap; }
  .imp-avatar-form .profile-mini { width:64px; height:64px; flex-basis:64px; font-size:20px; }
  .imp-avatar-fields { display:flex; flex:1 1 220px; min-width:0; align-items:center; flex-wrap:wrap; gap:8px; }
  .imp-avatar-fields input[type=file] { flex:1 1 210px; min-width:0; max-width:100%; }
