/* ==================================================================
   Variabili e base
   ================================================================== */

:root {
    --navy: #1c2b5a;
    --teal: #3aa8a8;
    --blue: #2d6cb5;
    --red: #d93a3a;
    --yel: #e8a21a;
    --grn: #2e8b57;
    --bg: #eef1f6;
}

* {
    box-sizing: border-box;
}

/* L'attributo hidden deve sempre nascondere, anche su elementi a cui gli stili danno un display */
[hidden] {
    display: none !important;
}

body {
    font: 15px system-ui, sans-serif;
    margin: 0;
    background: var(--bg);
    color: #1a1f33;
    padding-bottom: 76px;
}

h1, h2, h3, .it {
    font-style: italic;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .02em;
}

button, input, select, textarea {
    font: inherit;
}

input, select, textarea {
    padding: 7px 9px;
    border: 1px solid #c5ccdb;
    border-radius: 8px;
    background: #fff;
    max-width: 100%;
}

input[type=number] {
    width: 62px;
}

label {
    display: block;
    font-size: 12px;
    color: #556;
    margin: 8px 0;
}

label select,
label input,
label textarea {
    display: block;
    width: 100%;
    margin-top: 2px;
}

label textarea {
    resize: vertical;
}

.empty {
    color: #889;
    font-style: italic;
    padding: 8px;
}

/* Icone SVG (tratto del colore del testo) */
.ic {
    width: 1.1em;
    height: 1.1em;
    vertical-align: -.18em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: none;
}

/* Pallino colorato della disciplina */
.dot {
    display: inline-block;
    width: .7em;
    height: .7em;
    border-radius: 50%;
    flex: none;
}

/* Pulsante con sola icona (modifica, elimina) */
button.ib {
    border: 0;
    background: none;
    cursor: pointer;
    color: var(--navy);
    padding: 4px;
}

button.ib:hover {
    color: var(--red);
}

/* Messaggio temporaneo */
#toast {
    position: fixed;
    left: 50%;
    bottom: calc(80px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: min(92vw, 520px);
    background: var(--navy);
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    box-shadow: 0 4px 16px #0004;
    z-index: 120;
    font-size: 14px;
}

/* ==================================================================
   Splash
   ================================================================== */

#splash {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 99;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    transition: opacity .6s;
}

#splash.off {
    opacity: 0;
    pointer-events: none;
}

#splash img {
    width: min(80vw, 420px);
    animation: pop .9s ease both;
}

#splash p {
    margin: 0;
    color: var(--navy);
    text-align: center;
    animation: pop 1.2s .3s ease both;
}

.dots {
    display: flex;
    gap: 8px;
}

.dots i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: bounce 1s infinite;
}

@keyframes pop {
    from { opacity: 0; transform: scale(.9); }
}

@keyframes bounce {
    50% { transform: translateY(-8px); }
}

/* ==================================================================
   Testata, hero, navigazione
   ================================================================== */

header {
    background: #fff;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 5;
    box-shadow: 0 2px 8px #0002;
}

header img {
    height: 38px;
}

header span,
header a {
    margin-left: auto;
    font-size: 12px;
    color: #666;
}

header b {
    color: var(--navy);
}

/* Indicatore connessione WebSocket */
#conn {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex: none;
    background: #bbb;
}

#conn.on {
    background: var(--grn);
    box-shadow: 0 0 0 3px #2e8b5733;
}

#conn.off {
    background: #c9a227;
}

.stripe {
    height: 5px;
    /* i colori degli sport (come sulla locandina), nell'ordine della locandina */
    background: linear-gradient(90deg,
        #5bb4d8 0 14%, #c8b46e 0 28%, #3e9672 0 43%, #e0b94e 0 57%,
        #377db5 0 72%, #7f9cd6 0 86%, #b54347 0);
}

.hero {
    background: linear-gradient(135deg, var(--navy), #2d4a9a);
    color: #fff;
    padding: 18px 14px;
}

.hero h1 {
    margin: 0;
    font-size: 22px;
}

.hero p {
    margin: 4px 0 0;
    opacity: .85;
}

main {
    padding: 12px;
    max-width: 980px;
    margin: auto;
}

nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: flex;
    box-shadow: 0 -2px 10px #0002;
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 6;
}

nav button {
    flex: 1;
    border: 0;
    background: none;
    padding: 9px 0 7px;
    font-size: 12px;
    color: #667;
    cursor: pointer;
    position: relative;
}

nav .ni {
    display: block;
    height: 24px;
    margin-bottom: 2px;
}

nav .ni .ic {
    width: 24px;
    height: 24px;
}

/* Numero di partite seguite */
nav .badge {
    position: absolute;
    top: 4px;
    left: calc(50% + 8px);
    background: var(--red);
    color: #fff;
    font-size: 10px;
    min-width: 17px;
    height: 17px;
    line-height: 17px;
    border-radius: 9px;
    padding: 0 4px;
}

nav button.on {
    color: var(--navy);
    font-weight: 700;
    box-shadow: inset 0 3px var(--red);
}

/* ==================================================================
   Chip (site / giorni) e selettore vista
   ================================================================== */

.bar {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.bar .chips {
    flex: 1;
    min-width: 0;
}

/* i chip vanno a capo invece di scorrere (niente barre di scorrimento) */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 2px 0 10px;
}

/* Programma (griglia) e tabelloni usano tutta la larghezza disponibile */
main.wide {
    max-width: 1600px;
}

/* Quando lo scorrimento orizzontale serve davvero, la barra è sottile */
.gridw,
.bk-wrap,
.side {
    scrollbar-width: thin;
    scrollbar-color: #c5ccdb transparent;
}

.gridw::-webkit-scrollbar,
.bk-wrap::-webkit-scrollbar,
.side::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.gridw::-webkit-scrollbar-thumb,
.bk-wrap::-webkit-scrollbar-thumb,
.side::-webkit-scrollbar-thumb {
    background: #c5ccdb;
    border-radius: 3px;
}

.chip {
    white-space: nowrap;
    border: 2px solid var(--navy);
    background: #fff;
    color: var(--navy);
    padding: 6px 14px;
    border-radius: 20px;
    font-weight: 700;
    cursor: pointer;
}

.chip.on {
    background: var(--navy);
    color: #fff;
}

.chip.sm {
    padding: 3px 11px;
    font-size: 13px;
    border-width: 1px;
}

/* Interruttore Griglia / Lista */
.seg {
    display: flex;
    flex: none;
    border: 2px solid var(--navy);
    border-radius: 20px;
    overflow: hidden;
    background: #fff;
}

.seg button {
    border: 0;
    background: none;
    color: var(--navy);
    padding: 6px 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.seg button.on {
    background: var(--navy);
    color: #fff;
}

/* ==================================================================
   Schede e incontri
   ================================================================== */

.card {
    background: #fff;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 14px;
    box-shadow: 0 2px 8px #1c2b5a1a;
}

.card h3 {
    margin: 0 0 6px;
    font-size: 16px;
    color: var(--navy);
    display: flex;
    gap: 8px;
    align-items: center;
}

.card h3 small {
    font-weight: 400;
    color: #778;
    text-transform: none;
    font-style: normal;
}

.card h3 button {
    margin-left: auto;
}

/* Incontro (vista lista) */
.m {
    border-left: 5px solid var(--c, #999);
    background: #f8f9fc;
    border-radius: 8px;
    padding: 8px 10px;
    margin: 8px 0;
}

.m.live {
    background: #fff6dd;
    box-shadow: 0 0 0 2px var(--yel);
}

.m.done,
.m.wo {
    opacity: .85;
}

.mh {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: #556;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.mh b {
    font-size: 14px;
    color: var(--navy);
}

/* Riga squadra + punteggio */
.t {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 2px 0;
}

.t em {
    font-style: normal;
    font-size: 20px;
    font-weight: 800;
    color: var(--navy);
    min-width: 30px;
    text-align: right;
}

.t.win span {
    font-weight: 800;
}

/* Singolari */
.gl {
    font-size: 12px;
    color: #556;
    margin-top: 4px;
    border-top: 1px dashed #ccd;
    padding-top: 3px;
}

a.pl {
    color: inherit;
    cursor: pointer;
    text-decoration: underline dotted;
}

a.pl:hover {
    color: var(--blue);
}

/* Etichette di stato */
.pill {
    margin-left: auto;
    padding: 2px 9px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #889;
    white-space: nowrap;
}

.pill.live { background: var(--red); }
.pill.done { background: var(--grn); }
.pill.wo   { background: #b8741a; }
.pill.lost { background: #999; }
.pill.bye  { background: #b4bccb; }

.pill.live::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    margin-right: 4px;
    vertical-align: 1px;
    animation: blink 1s infinite;
}

/* Campanella "segui" */
.fb {
    border: 1px solid #c5ccdb;
    background: #fff;
    color: #778;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
}

.fb.on {
    background: var(--yel);
    border-color: var(--yel);
    color: #fff;
}

.fb.on .ic {
    fill: currentColor;
}

.gh .fb {
    width: 24px;
    height: 24px;
}

/* Scheda "Seguite" */
.note {
    background: #fff4dc;
    border: 1px solid #f0d49a;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 14px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.note.ok {
    background: #e6f4ec;
    border-color: #b7dcc5;
}

.card.follow h3 .fb {
    margin-left: auto;
}

.queue-info {
    font-weight: 700;
    color: var(--red);
    margin: 2px 0 6px;
}

.qrow {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 13px;
    padding: 5px 2px;
    border-bottom: 1px dashed #dde2ec;
}

.qrow b {
    color: var(--navy);
    min-width: 40px;
}

.qrow span {
    flex: 1;
}

.qrow em {
    font-style: normal;
    font-weight: 700;
    color: #667;
}

.qrow.done,
.qrow.wo {
    opacity: .6;
}

.qrow.live em {
    color: var(--red);
}

/* Posizione in classifica (oro, argento, bronzo) */
.pos {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 800;
    color: var(--navy);
    background: #eef1f6;
}

.pos1 { background: #e8b923; color: #fff; }
.pos2 { background: #a7adb8; color: #fff; }
.pos3 { background: #c27c3e; color: #fff; }

@keyframes blink {
    50% { opacity: .2; }
}

.tag {
    display: inline-block;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 9px;
    color: #fff;
    margin: 1px;
}

/* ==================================================================
   Tabelle e classifica
   ================================================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    font-size: 12px;
    text-transform: uppercase;
    color: #778;
    text-align: left;
}

td, th {
    padding: 8px 5px;
    border-bottom: 1px solid #eef;
}

tr.top td { background: #fff9e6; }
tr.clk { cursor: pointer; }
tr.clk:hover td { background: #eef4ff; }

.pts {
    font-weight: 800;
    font-size: 18px;
    color: var(--navy);
}

/* ==================================================================
   Griglia campi × orari (pubblica e gestione)
   ================================================================== */

.gridw {
    overflow: auto;
    max-height: 80vh;
    padding: 0;
}

/* Griglia pubblica: niente scorrimento verticale interno, scorre la pagina */
.gridw.pubw {
    max-height: none;
    overflow-y: visible;
}

.gt {
    min-width: 100%;
}

.gt th {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    text-align: center;
    font-style: normal;
}

/* Gestione: prima colonna (orari) bloccata a sinistra */
.gt:not(.pub) th:first-child,
.gt:not(.pub) tr > th {
    position: sticky;
    left: 0;
    z-index: 3;
    min-width: 56px;
    background: #fff;
}

.gt:not(.pub) tr:first-child th:first-child {
    z-index: 4;
}

.gt td {
    min-width: 170px;
    height: 70px;
    vertical-align: top;
    border: 1px solid #e3e7f0;
    padding: 3px;
}

.gt td:hover { background: #f3f8ff; }
.gt td.ov2   { background: #dff3e8; }

/* Variante pubblica: celle ad altezza libera, nessun hover di modifica */
.gt.pub td {
    height: auto;
    min-width: 160px;
}

.gt.pub td:hover {
    background: none;
}

.gt.pub td:empty {
    background: #fafbfd;
}

/* Scheda incontro nella griglia */
.gm {
    border-left: 4px solid var(--c);
    background: #f4f6fb;
    border-radius: 6px;
    padding: 4px 6px;
    margin-bottom: 3px;
    cursor: grab;
    font-size: 13px;
}

.gt.pub .gm {
    cursor: default;
}

.gm.live {
    background: #fff6dd;
    box-shadow: 0 0 0 2px var(--yel);
}

.gm .t em {
    font-size: 15px;
}

.gh {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #667;
    margin-bottom: 2px;
    flex-wrap: wrap;
}

/* Orario della singola partita (in arancio se diverso da quello della riga) */
.tm {
    font-size: 12px;
    font-weight: 800;
    color: var(--navy);
    white-space: nowrap;
}

button.tm {
    border: 1px solid #c5ccdb;
    background: #fff;
    border-radius: 6px;
    padding: 0 5px;
    cursor: pointer;
}

.tm.ovr {
    color: #b8741a;
    border-color: #e8a21a;
    background: #fff4dc;
}

/* Prima colonna della griglia di gestione: orario modificabile */
.gt th.slt {
    white-space: nowrap;
    font-size: 13px;
    color: var(--navy);
}

.gt th.slt input {
    width: 92px;
    padding: 3px 4px;
}

.gt th.slt select {
    display: block;
    width: 100%;
    margin-bottom: 3px;
    padding: 2px 4px;
    font-size: 12px;
}

.gt th.slt small {
    font-weight: 400;
    color: #889;
}

.gt th.slt.seguire input {
    color: #889;
}

.card.side.ov2 {
    box-shadow: 0 0 0 3px var(--teal);
}

.gt th.slt button {
    border: 0;
    background: none;
    cursor: pointer;
    padding: 2px;
}

.sep {
    width: 1px;
    align-self: stretch;
    background: #dde2ec;
    margin: 0 4px;
}

.hint {
    font-size: 12px;
    color: #778;
    margin: 0 0 8px;
}

/* ==================================================================
   Modale
   ================================================================== */

.ov {
    position: fixed;
    inset: 0;
    background: #0009;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mb {
    background: #fff;
    border-radius: 16px;
    padding: 16px;
    width: min(94vw, 640px);
    max-height: 90vh;
    overflow: auto;
    position: relative;
}

.mb h2 {
    margin: 0 24px 8px 0;
    color: var(--navy);
    font-size: 20px;
}

.mb h3 {
    color: var(--navy);
    margin: 14px 0 4px;
}

.x {
    position: absolute;
    right: 10px;
    top: 8px;
    border: 0;
    background: none;
    font-size: 20px;
    cursor: pointer;
}

.big {
    font-size: 34px;
    font-weight: 800;
    color: var(--navy);
}

.big small {
    font-size: 13px;
    font-weight: 400;
    color: #667;
}

/* ==================================================================
   Tabellone compatto "a linee" (pubblico e gestione)
   ================================================================== */

.bk-wrap {
    overflow-x: auto;
}

.bl {
    position: relative;
    font-size: 13px;
}

/* titolo della colonna (turno) */
.bl-h {
    position: absolute;
    top: 0;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #889;
    padding-left: 6px;
}

/* riga di una coppia: nome sopra la linea */
.bl-s {
    position: absolute;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 0 8px 2px 6px;
    border-bottom: 2px solid #c9d0de;
    white-space: nowrap;
}

.bl-s .nm {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bl-s.win {
    font-weight: 800;
    border-bottom-color: var(--c, var(--navy));
}

.bl-s.lost {
    color: #99a;
}

.bl-s.lost a.pl {
    text-decoration: none;
}

.bl-s.live {
    background: #fff6dd;
    border-bottom-color: var(--yel);
}

.bl-s.champ {
    font-weight: 800;
    color: var(--navy);
    border-bottom: 3px solid #e8b923;
}

.bl-s[onclick] {
    cursor: pointer;
}

.bl-s[onclick]:hover {
    background: #f1f5fd;
}

.bl-s .bye {
    color: #99a;
    font-style: italic;
}

.bl-s .ib {
    padding: 0 2px;
}

/* posto libero del primo turno (gestione) */
.bl-s[data-slot] {
    border-bottom-style: dashed;
    color: var(--blue);
}

.bl-s[data-slot].ov2 {
    background: #e8f0fd;
}

.bl-s .add {
    font-size: 12px;
    opacity: .7;
}

/* risultato (o orario) sotto la linea */
.bl-i {
    position: absolute;
    text-align: center;
    font-size: 11px;
    color: #556;
    line-height: 14px;
}

.bl-i .when {
    color: #99a;
}

.bl-i .lv {
    color: var(--red);
}

/* squash: singolari e tie-break accanto al risultato */
.bl-i .gs {
    color: #889;
    cursor: help;
}

/* linea verticale che unisce le due coppie di un incontro */
.bl-v {
    position: absolute;
    width: 2px;
    background: #c9d0de;
}

.bl-v.live {
    background: var(--yel);
}

/* Scheda "Dati e cestino" */
.tools {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.tool {
    border: 1px solid #e3e7f0;
    border-radius: 12px;
    padding: 12px;
}

.item.static {
    cursor: default;
}

/* ==================================================================
   Gestione (admin)
   ================================================================== */

body.admin {
    padding: 0;
}

button.p,
button.ghost,
button.danger,
.tb > button,
.item > button:not(.ib),
.bk-tools button,
.actions button {
    border: 1px solid #c5ccdb;
    background: #fff;
    color: var(--navy);
    border-radius: 10px;
    padding: 8px 13px;
    cursor: pointer;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

button.p {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

button.p:hover {
    background: #2d4a9a;
}

button.danger {
    color: var(--red);
    border-color: #f0c2c2;
}

button.danger:hover {
    background: #fdeeee;
}

button.big {
    padding: 11px 20px;
    font-size: 16px;
}

.muted {
    color: #889;
    font-weight: 400;
    font-size: 13px;
}

.hint {
    font-size: 13px;
    color: #778;
    margin: 6px 0;
}

.hint.warn {
    color: #8a5a00;
    background: #fff6e0;
    border-radius: 6px;
    padding: 6px 10px;
}

small.lbl {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: #889;
    margin-bottom: 3px;
    font-weight: 700;
}

.row-inline {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

/* Schede principali */
.tabs {
    display: flex;
    gap: 4px;
    background: #fff;
    padding: 6px 10px;
    overflow-x: auto;
    box-shadow: 0 2px 6px #0001;
}

.tabs button {
    border: 0;
    background: none;
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    color: #667;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.tabs button:hover {
    background: #eef1f6;
}

.tabs button.on {
    background: var(--navy);
    color: #fff;
}

.tabs .ni .ic {
    width: 18px;
    height: 18px;
}

/* Barre degli strumenti */
.tb {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 8px;
}

.tb label {
    margin: 0;
}

.slotpanel {
    background: #f4f6fb;
    border-radius: 10px;
    padding: 10px;
}

.slotpanel input[type=time] {
    width: 110px;
}

.bk-tools {
    align-items: center;
    gap: 8px;
    border-top: 1px solid #eef;
    padding-top: 10px;
}

.bk-tools > b {
    font-size: 16px;
    color: var(--navy);
}

/* Scelta a pulsanti (al posto delle select) */
.pick {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 3px;
}

.pick button {
    border: 1px solid #c5ccdb;
    background: #fff;
    color: #334;
    border-radius: 18px;
    padding: 6px 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    text-transform: none;
}

.pick button:hover {
    border-color: var(--navy);
}

.pick button.on {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
    font-weight: 700;
}

.pick.sm button {
    padding: 3px 9px;
    font-size: 13px;
}

.pick.full {
    flex-wrap: nowrap;
    margin-bottom: 8px;
}

.pick.full button {
    flex: 1;
    justify-content: center;
    font-size: 13px;
    padding: 6px 8px;
    white-space: nowrap;
}

.grp-h {
    flex-basis: 100%;
    font-size: 11px;
    text-transform: uppercase;
    color: #889;
    font-weight: 700;
    margin-top: 4px;
}

/* Scelta coppia con ricerca */
.pp {
    position: relative;
    margin-top: 3px;
}

.pp-cur {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    text-align: left;
    border: 1px solid #c5ccdb;
    background: #fff;
    border-radius: 10px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 15px;
    color: #1a1f33;
}

.pp-pop {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    background: #fff;
    border: 1px solid #c5ccdb;
    border-radius: 10px;
    box-shadow: 0 8px 24px #1c2b5a33;
    z-index: 10;
    padding: 8px;
}

.pp-pop input {
    width: 100%;
    margin-bottom: 6px;
}

.pp-list {
    max-height: 240px;
    overflow: auto;
}

.pp-list button {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: none;
    padding: 7px 8px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.pp-list button:hover {
    background: #eef4ff;
}

.pp-list small {
    display: block;
    color: #889;
}

/* Numero con − e + */
.stp {
    display: inline-flex;
    align-items: center;
    border: 1px solid #c5ccdb;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
}

.stp button {
    border: 0;
    background: #f1f3f8;
    width: 38px;
    height: 38px;
    cursor: pointer;
    color: var(--navy);
}

.stp button:hover {
    background: #e2e7f2;
}

.stp input {
    border: 0;
    border-radius: 0;
    width: 52px;
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    color: var(--navy);
    -moz-appearance: textfield;
}

.stp input::-webkit-inner-spin-button,
.stp input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* Modale incontro */
.two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.scoreboard {
    display: grid;
    gap: 8px;
    margin: 10px 0;
}

.scoreboard > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f4f6fb;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 700;
}

.ro-pairs {
    display: grid;
    gap: 2px;
    background: #f4f6fb;
    border-radius: 10px;
    padding: 10px 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ro-pairs span {
    font-weight: 400;
    font-size: 12px;
    color: #889;
}

.ro-pairs small {
    font-weight: 400;
    color: #889;
    margin-top: 4px;
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.actions .danger {
    margin-left: auto;
}

.game {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    background: #f4f6fb;
    border-radius: 10px;
    padding: 8px;
    margin: 6px 0;
}

.game > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.game .tb {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--red);
    margin: 0;
}

/* Elenchi (coppie, site, campi) */
.items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 8px;
}

.item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 1px solid #e3e7f0;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
}

.item:hover {
    border-color: var(--navy);
    background: #f8faff;
}

.item small {
    display: block;
    color: #889;
}

table.list td {
    vertical-align: middle;
}

/* Programma: colonna laterale + griglia */
.wrap {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 12px;
    align-items: start;
}

.side {
    position: sticky;
    top: 60px;
    max-height: 80vh;
    overflow: auto;
}

.side input[type=search] {
    width: 100%;
}

.chip2 {
    border: 1px solid #c5ccdb;
    border-radius: 10px;
    padding: 7px 9px;
    margin: 6px 0;
    background: #f8f9fc;
    cursor: grab;
}

.chip2:hover {
    border-color: var(--navy);
}

.chip2.on {
    outline: 3px solid var(--yel);
    background: #fffaf0;
}

.chip2.todo {
    border-left: 4px solid var(--c);
}

.chip2.todo b {
    display: block;
    font-size: 13px;
}

.chip2.warn {
    opacity: .6;
}

.chip2 small {
    display: block;
    color: #778;
}

/* Cella vuota della griglia */
.gt td.free {
    text-align: center;
    vertical-align: middle;
}

.addhint {
    color: #c5ccdb;
    opacity: 0;
}

.gt td.free:hover .addhint {
    opacity: 1;
}

.gm .lab {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 120px;
}

/* Punteggio con − e + nella griglia */
.sc {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.mini {
    border: 1px solid #c5ccdb;
    background: #fff;
    border-radius: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    cursor: pointer;
    color: var(--navy);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mini .ic {
    width: 13px;
    height: 13px;
}

.mini:hover {
    background: var(--navy);
    color: #fff;
}

.sc em {
    min-width: 22px !important;
    text-align: center !important;
}

/* Inizia / Termina */
.qs {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    margin-top: 3px;
}

.act {
    border: 0;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    background: var(--grn);
    color: #fff;
}

.act.stop {
    background: var(--red);
}

#toast.err {
    background: var(--red);
}

/* ==================================================================
   Mobile
   ================================================================== */

@media (max-width: 760px) {
    .wrap {
        grid-template-columns: 1fr;
    }

    .side {
        position: static;
        max-height: 200px;
    }
}

@media (max-width: 520px) {
    .bar {
        flex-direction: column-reverse;
        gap: 6px;
    }

    .seg {
        align-self: flex-end;
    }

    .gridw {
        max-height: none;
    }

    .gt.pub td {
        min-width: 140px;
    }

    .two,
    .game {
        grid-template-columns: 1fr;
    }
}

/* ==================================================================
   Accesso, utenti e registro attività
   ================================================================== */

.card.login {
    max-width: 380px;
    margin: 40px auto;
}

.card.login input {
    width: 100%;
}

header #me {
    margin-left: auto;
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 13px;
}

header #me a {
    margin: 0;
}

header #me + #conn,
header a + #me {
    margin-left: 12px;
}

.item.off {
    opacity: .55;
}

button.sm {
    padding: 4px 10px;
    font-size: 12px;
}

/* Permessi: pulsanti da attivare/disattivare */
.perms {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 6px;
}

.perm {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    border: 1px solid #c5ccdb;
    background: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    color: #556;
}

.perm .ic {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid #c5ccdb;
    stroke: transparent;
    padding: 1px;
}

.perm.on {
    border-color: var(--navy);
    color: var(--navy);
    font-weight: 700;
    background: #f1f5fd;
}

.perm.on .ic {
    background: var(--navy);
    border-color: var(--navy);
    stroke: #fff;
}

.perm[disabled] {
    cursor: not-allowed;
    opacity: .7;
}

/* Registro */
.logtab {
    font-size: 13px;
}

.logtab td {
    vertical-align: top;
}

.logtab td small {
    display: block;
    color: #889;
}

.logtab .det {
    color: #556;
    max-width: 380px;
}

.nowrap {
    white-space: nowrap;
}

.act-badge {
    display: inline-block;
    border-radius: 8px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #889;
}

.act-badge.ok   { background: var(--grn); }
.act-badge.info { background: var(--blue); }
.act-badge.warn { background: #c0602a; }

.wrap.noside {
    grid-template-columns: 1fr;
}

.wrap.noside .side {
    display: none;
}

/* Campo password con pulsante "mostra" */
.pwbox {
    position: relative;
    display: block;
}

.pwbox input {
    padding-right: 40px;
}

.pwbox .ib {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    color: #889;
}

.pwbox .ib.on {
    color: var(--navy);
}

/* Permessi con descrizione */
.perm span b,
.perm span small {
    display: block;
}

.perm span small {
    font-weight: 400;
    font-size: 12px;
    color: #889;
    margin-top: 2px;
}

.perms {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

label small.hint {
    display: block;
    font-weight: 400;
}

/* Sola consultazione (site a cui l'utente non è abilitato) */
.readonly {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f1f3f8;
    border: 1px solid #dde2ec;
    color: #556;
    border-radius: 10px;
    padding: 9px 12px;
    margin: 6px 0 10px;
    font-size: 14px;
}

.readonly .ic {
    flex: none;
    color: #889;
}

.ro-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    background: #f4f6fb;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 8px 0;
    color: #445;
}

.ro-line .pill {
    margin-left: 0;
}

.item.ro,
tr.ro td {
    color: #778;
}

.item.ro b .ic,
tr.ro td .ic,
.pick button .ic-lock {
    color: #99a;
    width: 14px;
    height: 14px;
}

.gt.ro .gm {
    cursor: pointer;
}

.ro-form input:disabled {
    background: #f4f6fb;
    color: #556;
}

.ro-form .pick button {
    pointer-events: none;
}

/* ==================================================================
   Invito a installare l'app (telefono)
   ================================================================== */

.install {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    z-index: 90;    /* sotto i modali (100) */
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px #1c2b5a55;
    padding: 14px;
    animation: slideup .35s ease both;
    max-width: 480px;
    margin: 0 auto;
}

@keyframes slideup {
    from { transform: translateY(30px); opacity: 0; }
}

.install-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.install-head img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    flex: none;
    box-shadow: 0 2px 6px #0002;
}

.install-head b {
    display: block;
    color: var(--navy);
    font-size: 16px;
}

.install-head small {
    color: #667;
}

.install-head .x {
    position: static;
    margin-left: auto;
    align-self: flex-start;
    color: #889;
}

.install-steps {
    margin: 12px 0 0;
    padding-left: 22px;
    color: #334;
    font-size: 15px;
    line-height: 1.7;
}

.install-steps .ic {
    color: var(--blue);
    vertical-align: -3px;
}

.install-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.install-actions button {
    border: 1px solid #c5ccdb;
    background: #fff;
    color: var(--navy);
    border-radius: 10px;
    padding: 9px 16px;
    font-weight: 700;
    cursor: pointer;
}

.install-actions button.p {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

/* ==================================================================
   Gestione: vista "Per campo" (comoda sul telefono)
   ================================================================== */

.gridw.courtview {
    max-height: none;
    overflow: visible;
    padding: 10px;
}

/* scelta del campo */
.court-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.court-tabs button {
    position: relative;
    border: 1px solid #c5ccdb;
    border-top: 4px solid var(--c);
    background: #fff;
    border-radius: 10px;
    padding: 7px 14px;
    cursor: pointer;
    text-align: left;
    min-width: 96px;
}

.court-tabs button b {
    display: block;
    color: var(--navy);
}

.court-tabs button small {
    color: #889;
    font-size: 11px;
}

.court-tabs button.on {
    background: var(--navy);
    border-color: var(--navy);
    border-top-color: var(--c);
}

.court-tabs button.on b,
.court-tabs button.on small {
    color: #fff;
}

/* pallino rosso: partita in corso su quel campo */
.live-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--red);
    box-shadow: 0 0 0 3px #d93a3a33;
    animation: blink 1.2s infinite;
}

/* righe orarie del campo */
.cv-row {
    display: grid;
    grid-template-columns: 58px 1fr;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid #eef;
    align-items: start;
}

.cv-row.now .cv-time {
    color: var(--red);
}

.cv-time {
    font-weight: 800;
    font-size: 17px;
    color: var(--navy);
    padding-top: 8px;
}

.cv-free {
    color: #aab;
    font-style: italic;
    padding: 10px 0;
}

.cv-free.add {
    width: 100%;
    text-align: left;
    border: 1px dashed #c5ccdb;
    border-radius: 10px;
    background: #fafbfd;
    color: #778;
    padding: 12px;
    cursor: pointer;
    font-style: normal;
}

/* schede partita grandi */
.courtview .gm {
    font-size: 15px;
    padding: 10px 12px;
    margin: 0;
    border-left-width: 5px;
    cursor: pointer;
}

.courtview .gm .gh {
    font-size: 12px;
    margin-bottom: 6px;
}

.courtview .gm .lab {
    max-width: none;
    white-space: normal;
}

.courtview .gm .t {
    padding: 4px 0;
}

.courtview .gm .t em {
    font-size: 24px;
}

.courtview .sc {
    gap: 10px;
}

.courtview .mini {
    width: 40px;
    height: 40px;
    border-radius: 10px;
}

.courtview .mini .ic {
    width: 18px;
    height: 18px;
}

.courtview .sc em {
    min-width: 30px !important;
}

.courtview .qs {
    margin-top: 8px;
}

.courtview .act {
    padding: 10px 22px;
    font-size: 15px;
    border-radius: 10px;
}

.courtview button.tm {
    padding: 3px 8px;
    font-size: 14px;
}

/* su schermi touch anche la griglia ha pulsanti un po' più grandi */
@media (pointer: coarse) {
    .mini {
        width: 30px;
        height: 30px;
    }

    .act {
        padding: 6px 14px;
        font-size: 13px;
    }
}

@media (max-width: 760px) {
    .side {
        max-height: 260px;
    }

    #ptool .tb {
        gap: 10px;
    }
}

/* ==================================================================
   Gestione: barra in alto e tabelle su schermi piccoli
   ================================================================== */

/* la pagina non si allarga mai in orizzontale: ciò che è largo scorre dentro il proprio riquadro */
body.admin {
    overflow-x: clip;
}

.tscroll {
    overflow-x: auto;
    scrollbar-width: thin;
}

header .hlink,
header #me a,
header #me b {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

header #me b .ic {
    color: #889;
}

header #me .nm {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 700px) {
    body.admin header {
        gap: 10px;
        padding: 6px 10px;
    }

    body.admin header img {
        height: 30px;
    }

    /* solo icone: le scritte restano come titolo (tooltip) */
    body.admin header .txt {
        display: none;
    }

    body.admin header .hlink {
        margin-left: auto;
    }

    body.admin header #me {
        margin-left: 0;
        gap: 10px;
        min-width: 0;
    }

    body.admin header #me .nm {
        max-width: 90px;
    }

    body.admin header .ic {
        width: 20px;
        height: 20px;
    }
}

@media (max-width: 420px) {
    body.admin header .ttl {
        display: none;
    }
}

/* Programma pubblico con tutti i site */
.gt.pub tr.site-row th {
    background: var(--navy);
    color: #fff;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .03em;
    border-left: 2px solid #fff;
    padding: 5px;
}

.gt.pub tr.site-row th .ic {
    width: 14px;
    height: 14px;
}

/* la riga dei campi resta sotto quella dei site quando si scorre */
.gt.pub tr.site-row + tr th {
    top: 27px;
}

h2.site-h {
    font-size: 16px;
    color: var(--navy);
    margin: 18px 4px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Classifica: ex aequo e coppie senza punti */
.pos-cell {
    text-align: center;
    width: 52px;
}

.pos-cell .eq {
    display: block;
    font-size: 10px;
    color: #889;
    white-space: nowrap;
    margin-top: 2px;
}

details.unranked {
    margin-top: 14px;
    border-top: 1px solid #eef;
    padding-top: 10px;
}

details.unranked summary {
    cursor: pointer;
    color: var(--navy);
    font-weight: 700;
}

.unr {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 4px;
    border-bottom: 1px solid #f0f2f7;
    cursor: pointer;
    font-size: 14px;
}

.unr small {
    color: #889;
}

.unr:hover {
    background: #eef4ff;
}

/* Classifica provvisoria: punti garantiti */
.pts small.gpts {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--grn);
    white-space: nowrap;
}

.pill.live-pill {
    margin-left: 4px;
    background: var(--grn);
    font-style: normal;
}

.gnote {
    background: #e6f4ec;
    border: 1px solid #b7dcc5;
    border-radius: 10px;
    padding: 8px 12px;
    margin: 6px 0 10px;
    font-size: 13px;
    color: #2d5a3f;
}

/* ==================================================================
   Eventi (premiazioni, clinic, ...)
   ================================================================== */

.evs {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
}

.ev {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(90deg, #fff7e0, #fff);
    border: 1px solid #f0d49a;
    border-left: 5px solid #e8b923;
    border-radius: 12px;
    padding: 10px 14px;
}

.ev > .ic {
    width: 26px;
    height: 26px;
    color: #c99a12;
    flex: none;
}

.ev-body {
    flex: 1;
    min-width: 0;
}

.ev-body b {
    display: block;
    color: var(--navy);
    font-size: 15px;
}

.ev-body small {
    display: block;
    color: #667;
}

.ev-body .ev-note {
    color: #889;
    font-style: italic;
}

.ev-actions {
    display: flex;
    gap: 2px;
}

.card.evs h3 {
    margin-bottom: 4px;
}

.admin-evs {
    border-top: 1px solid #eef;
    padding-top: 10px;
    margin-top: 6px;
}

/* Programma pubblico, vista Lista: partite del giorno in righe, raggruppate per orario */
.lgroup {
    display: grid;
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid #dde2ec;
}

.ltime {
    font-weight: 800;
    font-size: 18px;
    color: var(--navy);
    padding-top: 10px;
}

.lgroup.now .ltime {
    color: var(--red);
}

.litems {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 10px;
}

.litem {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px #1c2b5a1a;
    padding: 8px 10px 4px;
}

.litem .m {
    margin: 4px 0;
}

.lcourt {
    display: flex;
    align-items: baseline;
    gap: 6px;
    font-size: 13px;
    color: var(--navy);
    border-bottom: 2px solid var(--c);
    padding-bottom: 4px;
}

.lcourt small {
    margin-left: auto;
    color: #889;
}

@media (max-width: 520px) {
    .lgroup {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .ltime {
        padding-top: 0;
    }

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

.litem.same-time .mh > b:first-child {
    display: none;
}

/* Tabellone in gestione: coppie da spostare */
.bl-s[draggable="true"] {
    cursor: grab;
}

.bl-s .nm.moving {
    background: var(--yel);
    color: #fff;
    border-radius: 6px;
    padding: 0 6px;
}

.bl-s .ib .ic-shuffle {
    width: 14px;
    height: 14px;
}

/* Etichetta della provenienza (sigla dell'iscrizione nel colore della disciplina) */
.otag {
    display: inline-block;
    flex: none;
    min-width: 26px;
    padding: 0 5px;
    border-radius: 6px;
    background: var(--c, #999);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    font-style: normal;
    vertical-align: 1px;
    letter-spacing: .02em;
}

.bl-s .otag {
    margin-right: 2px;
}

/* Pulsante "Importa da Excel" (etichetta con un input file nascosto) */
label.ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 0 auto;
    border: 1px solid #c5ccdb;
    background: #fff;
    color: var(--navy);
    border-radius: 10px;
    padding: 8px 13px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    text-transform: none;
    font-style: normal;
}

.card h3 label.ghost-btn + button {
    margin-left: 0;
}

/* ---------------- Ricerca giocatore / coppia ---------------- */

header .hsearch {
    flex: none;
    border: 0;
    background: #eef1f6;
    color: var(--navy);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    cursor: pointer;
}

header .hguide {
    font: 700 17px/1 system-ui, sans-serif;
    text-decoration: none;
}

header .hsearch:hover {
    background: #dfe5f0;
}

header .hsearch svg {
    width: 18px;
    height: 18px;
}

input.sq {
    width: 100%;
    font: inherit;
    font-size: 16px;
    padding: 10px 12px;
    border: 2px solid #c9d0de;
    border-radius: 10px;
    margin: 6px 0 10px;
}

input.sq:focus {
    outline: none;
    border-color: var(--navy);
}

.sres {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sres .sr {
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    font: inherit;
    border: 1px solid #e1e6ef;
    background: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
}

.sres .sr:hover {
    background: #f1f5fd;
    border-color: #c9d0de;
}

.sres .sr span {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sres .sr small {
    color: #778;
}

/* tabelloni in cui gioca la coppia (nel modale) */
.inbk {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 4px;
}

.inbk button {
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 2px solid var(--c, var(--navy));
    color: var(--navy);
    background: #fff;
    border-radius: 20px;
    padding: 4px 12px;
    cursor: pointer;
}

.inbk button:hover {
    background: #f1f5fd;
}

.inbk svg {
    width: 15px;
    height: 15px;
}

/* coppia evidenziata nel tabellone */
.bl-s.hl {
    background: #d6ecff;
    border-bottom: 3px solid var(--blue);
    box-shadow: inset 4px 0 0 var(--blue);
    border-radius: 4px 4px 0 0;
    font-weight: 800;
}

/* gestione: coppie di una provenienza evidenziate, le altre attenuate */
.bl.dimo .bl-s:not(.hlo) {
    opacity: .3;
}

.bl-s.hlo {
    background: color-mix(in srgb, var(--hc) 22%, transparent);
    box-shadow: inset 4px 0 0 var(--hc);
    border-bottom-color: var(--hc);
    border-radius: 4px 4px 0 0;
    font-weight: 800;
}

.obar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 0 0 10px;
    font-size: 13px;
}

.obar button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid var(--line, #d0d5dd);
    background: none;
    border-radius: 999px;
    padding: 3px 10px;
    font: inherit;
    cursor: pointer;
}

.obar button i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--hc);
}

.obar button.on {
    background: color-mix(in srgb, var(--hc) 22%, transparent);
    border-color: var(--hc);
    font-weight: 700;
}

.obar .odist {
    font-weight: 700;
    margin-left: 6px;
}

.obar button.x {
    border: 0;
    color: var(--navy);
    font-weight: 700;
}

.hlbar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #d6ecff;
    border: 1px solid #9cc7f0;
    border-radius: 10px;
    padding: 6px 10px;
    margin: 0 0 10px;
    font-size: 14px;
}

.hlbar button {
    margin-left: auto;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 700;
    color: var(--navy);
    cursor: pointer;
}

/* Gestione: pubblicazione degli orari */
.pubbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px 14px;
    flex-wrap: wrap;
    background: #eaf6ef;
    border: 1px solid #c4e3d0;
    color: #24543a;
    border-radius: 10px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 14px;
}

.pubbar.warn {
    background: #fff4dc;
    border-color: #f0d494;
    color: #6b4a00;
}

.pubbar .pbt {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 280px;
}

.pubbar .pbt .ic {
    flex: none;
}

.pubbar .pbb {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* un gruppo Annulla / Pubblica per ogni giorno con modifiche */
.pubbar .pbday {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding-left: 10px;
    border-left: 1px solid #f0d494;
}

.gm.draft {
    outline: 2px dashed var(--yel);
    outline-offset: -1px;
}

.gm .dtag {
    background: var(--yel);
    color: #3a2800;
    border-radius: 4px;
    padding: 0 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
}

/* Griglia di gestione compatta */
.gm.cmp {
    padding: 3px 5px;
    font-size: 12px;
    line-height: 1.25;
}

.gm.cmp .gh {
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.gm.cmp .gh .lab {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #667;
    font-size: 11px;
}

.gm.cmp .tm {
    font-size: 11px;
    flex: none;
}

.gm.cmp .cn {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

label.chk {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 0 6px;
    font-size: 13px;
    color: inherit;
    cursor: pointer;
}

label.chk input {
    display: inline;
    width: auto;
    margin: 0;
}

/* Gestione: colonna "Da programmare" (filtri per sport, gruppi per tabellone e turno) */
.sfil {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 8px 0 4px;
}

.sfil button {
    border: 1px solid #c5ccdb;
    background: #fff;
    border-radius: 14px;
    padding: 2px 8px;
    font-size: 12px;
    cursor: pointer;
}

.sfil button.on {
    background: var(--navy);
    border-color: var(--navy);
    color: #fff;
}

.sfil button small {
    opacity: .7;
}

label.sready {
    margin: 4px 0 6px;
    font-size: 12px;
}

.sgr {
    margin-top: 6px;
}

.sgh {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 100%;
    border: 0;
    border-left: 4px solid var(--c);
    background: #eef1f6;
    border-radius: 6px;
    padding: 5px 7px;
    font-size: 12px;
    text-align: left;
    cursor: pointer;
    position: sticky;
    top: 0;
    z-index: 1;
}

.sgh b {
    flex: 1;
    min-width: 0;
}

.sgh small {
    color: #667;
    white-space: nowrap;
}

.chip2.sm {
    padding: 4px 7px;
    margin: 4px 0;
}

.chip2.sm .sh {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #556;
}

.chip2.sm .sh b {
    color: var(--navy);
}

.chip2.sm .sh small {
    display: inline;
}

.chip2.sm .st {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #a66b00;
}

.chip2.sm .st.ok {
    color: var(--grn);
}

.chip2.sm .sp {
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chip2.sm .sp.wait {
    font-weight: 400;
    font-style: italic;
    color: #889;
}

.chip2.sm.notready {
    background: #fbfbfd;
}

/* Trascinamento: campi adatti allo sport dell'incontro in evidenza */
.gt.dragging td[data-disc]:not(.ok) {
    opacity: .35;
}

.gt.dragging td.ok {
    background: #eefaf3;
    box-shadow: inset 0 0 0 2px #9fd8b5;
}

.install-actions a.ilink {
    align-self: center;
    margin-right: auto;
    color: var(--blue);
    font-weight: 600;
}

/* ==================================================================
   Gestione · Simula orari
   ================================================================== */

.simf > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    padding: 6px 0;
    border-top: 1px solid #eef1f6;
}

.simf > div > b {
    min-width: 7em;
}

.simf input[type=number], .simf input[type=time], .simt input[type=time] {
    padding: 4px 6px;
}

label.ck {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.simt {
    width: 100%;
    border-collapse: collapse;
}

.simt td, .simt th {
    padding: 5px 6px;
    border-top: 1px solid #eef1f6;
    text-align: left;
    vertical-align: middle;
}

.simt th {
    background: #f6f8fb;
    font-size: 13px;
}

.simt tr.off td {
    opacity: .55;
}

.simt select {
    padding: 3px 4px;
}

.simprog {
    height: 10px;
    background: #e3e7f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 10px 0 4px;
}

.simprog i {
    display: block;
    height: 100%;
    background: var(--teal);
    transition: width .5s;
}

.simsum {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin: 10px 0;
}

.simsum > div {
    border: 1px solid #e3e7f0;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 13px;
}

.simsum b {
    display: block;
    font-size: 22px;
}

.simsum small {
    display: block;
    color: #5b6273;
}

.simsum .ok b { color: var(--grn); }
.simsum .warn b { color: var(--yel); }
.simsum .bad b { color: var(--red); }

.simlist {
    margin: 0 0 10px;
    font-size: 13px;
}

.simgw {
    overflow-x: auto;
    margin-bottom: 14px;
}

.simg {
    border-collapse: collapse;
    font-size: 12px;
    min-width: 100%;
}

.simg th, .simg td {
    border: 1px solid #e3e7f0;
    padding: 2px 3px;
    white-space: nowrap;
}

.simg th {
    background: #f6f8fb;
}

.simm {
    border-left: 4px solid #999;
    padding-left: 4px;
}

.simm small {
    display: block;
    color: #5b6273;
    font-size: 10px;
}

/* ==================================================================
   Programma: avvisi del giorno e PDF dell'orario di gioco
   ================================================================== */

.dayhead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.dayhead .chips {
    margin: 0;
}

.pdfbtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--navy);
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.pdfbtn:hover {
    background: var(--navy);
    color: #fff;
}

.pdfbtn .ic {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* avvisi: testo nero, bordo doppio in risalto (come nel PDF) */
.notice {
    background: #fff;
    border: 2px solid #1a1f33;
    outline: 1px solid #1a1f33;
    outline-offset: -5px;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 10px;
    text-align: center;
    color: #1a1f33;
    line-height: 1.4;
}

.notice > div + div {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #e3e7f0;
}

.notice .nt-site {
    display: block;
    color: #5b6273;
    font-size: 12px;
}

.notice .nt-site .ic {
    width: 12px;
    height: 12px;
    vertical-align: -2px;
}
