:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #1b1b1d;
  --muted: #6b6b70;
  --line: #e2e2de;
  --brand: #1a7aa3;
  --brand-ink: #ffffff;
  --dark: #162238;
  --ok: #1f7a3d;
  --ok-bg: #e5f4ea;
  --warn: #9a5b00;
  --warn-bg: #fdf1dc;
  --ko: #b3141f;
  --ko-bg: #fde6e7;
  --radius: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
small, .muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }

/* barra superiore */
.top { background: var(--dark); color: #fff; position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; gap: 1rem; padding-top: .6rem; padding-bottom: .6rem; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: .5rem; font-size: .95rem; }
.brand img { height: 22px; width: auto; }
.brand span { color: #5cc3ea; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; flex: 1; }
.nav a { color: #d6d6d6; text-decoration: none; padding: .35rem .6rem; border-radius: 8px; font-size: .95rem; }
.nav a.on, .nav a:hover { background: #24365a; color: #fff; }
.top form { margin: 0; }
.linkbtn { background: none; border: 0; color: #bdbdbd; cursor: pointer; font: inherit; padding: .35rem .5rem; }

.wrap { max-width: 1100px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
main.wrap { padding-top: 1.25rem; padding-bottom: 3rem; }

/* card e griglie */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 760px) {
  .grid.two { grid-template-columns: 1fr 1fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  .grid.side { grid-template-columns: 1fr 1.4fr; }
}
.stat { font-size: 1.6rem; font-weight: 700; }

/* moduli */
label { display: block; font-size: .9rem; font-weight: 600; margin: .6rem 0 .25rem; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid #cfcfca; border-radius: 9px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 500; margin: .4rem 0; }
.check input { width: 1.15rem; height: 1.15rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .shrink { flex: 0 0 auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem 1rem 1rem; margin: 0 0 1rem; }
legend { font-weight: 700; padding: 0 .4rem; }

.btn { display: inline-block; border: 0; border-radius: 9px; padding: .65rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  background: var(--brand); color: var(--brand-ink); }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #ececea; color: var(--ink); }
.btn.dark { background: var(--dark); color: #fff; }
.btn.ok { background: var(--ok); color: #fff; }
.btn.small { padding: .35rem .65rem; font-size: .9rem; }
.btn.big { padding: .9rem 1.3rem; font-size: 1.1rem; width: 100%; }
.btn.satispay { background: #e2352c; color: #fff; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: 1rem; }
form.inline { display: inline; margin: 0; }

/* messaggi */
.flash { padding: .8rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }
.flash.ko { background: var(--ko-bg); color: var(--ko); }

/* semaforo */
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.ko { background: var(--ko-bg); color: var(--ko); }
.badge.grey { background: #ececea; color: var(--muted); }
.checks { list-style: none; padding: 0; margin: .5rem 0; }
.checks li { display: flex; gap: .6rem; align-items: baseline; padding: .4rem 0; border-bottom: 1px solid var(--line); }
.checks li:last-child { border-bottom: 0; }
.checks b { min-width: 9.5rem; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--ok); } .dot.warn { background: #e09200; } .dot.ko { background: var(--ko); }
.bigstatus { border-radius: var(--radius); padding: 1rem; font-size: 1.25rem; font-weight: 800; text-align: center; margin-bottom: .75rem; }
.bigstatus.ok { background: var(--ok); color: #fff; }
.bigstatus.warn { background: #e09200; color: #fff; }
.bigstatus.ko { background: var(--ko); color: #fff; }

/* tabelle */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #f7f9fb; }
tr:hover td { background: #fbfbf9; }
td a.rowlink { color: var(--ink); font-weight: 600; text-decoration: none; }

/* filtri */
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { padding: .35rem .75rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: .9rem; }
.chip.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.chip .n { color: var(--muted); margin-left: .25rem; }
.chip.on .n { color: #bbb; }

/* risultati ricerca reception */
.results { list-style: none; padding: 0; margin: 0; }
.results a { display: flex; justify-content: space-between; gap: 1rem; align-items: center; padding: .75rem; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.results a:hover { background: #fafaf8; }
.search { display: flex; gap: .5rem; }
.search input { font-size: 1.15rem; padding: .8rem; }

/* lezioni */
.day { margin-bottom: 1rem; }
.lesson { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lesson:last-child { border-bottom: 0; }
.lesson .when { font-weight: 700; min-width: 6.5rem; }
.lesson .info { flex: 1 1 180px; }
.lesson form { display: flex; gap: .4rem; align-items: center; margin: 0; flex-wrap: wrap; }
.lesson select { width: auto; padding: .35rem .5rem; }

/* link da copiare */
.invite { background: #fffbea; border: 1px dashed #d9b400; border-radius: var(--radius); padding: 1rem; margin: 1rem 0; }
.invite input { font-family: ui-monospace, monospace; font-size: .85rem; }

/* login */
.auth { max-width: 420px; margin: 8vh auto; }
.auth .logo { text-align: center; margin: 0 auto 1.25rem; }
.auth .logo img { width: 220px; max-width: 70%; height: auto; }

/* barre del bilancio */
.bar { height: .6rem; background: var(--brand); border-radius: 4px; min-width: 2px; }
.w0{width:0}.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w35{width:35%}.w40{width:40%}.w45{width:45%}.w50{width:50%}
.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}

/* ricevuta stampabile */
.receipt { max-width: 720px; margin: 1.5rem auto; background: #fff; padding: 2rem; border: 1px solid var(--line); border-radius: var(--radius); }
.receipt h1 { font-size: 1.3rem; margin-bottom: .25rem; }
.receipt .rlogo { width: 120px; height: auto; float: right; margin-left: 1rem; }
.receipt .amount { font-size: 1.6rem; font-weight: 800; }
.receipt table td { border: 0; padding: .3rem 0; }
.receipt .sign { margin-top: 3rem; display: flex; justify-content: flex-end; }
.receipt .sign div { border-top: 1px solid #999; padding-top: .3rem; width: 220px; text-align: center; color: var(--muted); font-size: .85rem; }
@media print {
  body { background: #fff; }
  .noprint, .top { display: none !important; }
  .receipt { border: 0; margin: 0; padding: 0; max-width: none; }
}
.btn.whatsapp { background: #1fa855; color: #fff; }
details.pay summary { font-weight: 700; cursor: pointer; padding: .6rem 0; }
.auth.wide { max-width: 640px; }
.center { text-align: center; }
.actions.center { justify-content: center; }
.qr-box svg { width: 220px; height: 220px; }
body.poster { background: #fff; text-align: center; padding: 2rem 16px; }
.poster-logo { width: 260px; max-width: 70%; }
body.poster h1 { font-size: 2.2rem; margin: 1.5rem 0 .5rem; }
.poster-qr svg { width: 420px; max-width: 90%; height: auto; margin: 1.5rem auto; display: block; }
