* { box-sizing: border-box; }
html, body { max-width: 100%; }
body { margin: 0; background: #f4f5f1; color: #373737; font-family: Poppins, Arial, sans-serif; font-size: 14px; line-height: 1.4; overflow-x: hidden; }
.wrap { max-width: 920px; margin: 0 auto; padding: 18px 14px 40px; }
.card { background: #fff; border: 1px solid #e6e6e6; border-radius: 16px; padding: 18px; }
h1 { margin: 0 0 14px; font-size: 22px; font-weight: 700; color: #3c3c3c; }
.toprow { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.who { text-align: right; font-size: 13px; color: #6d6d6d; }
.who b { display: block; color: #3c3c3c; font-size: 15px; }
.who a { color: #3c3c3c; }
.grid { display: grid; grid-template-columns: 250px 1fr; gap: 14px; }
.phase, .wait, .panel { background: #f4f5f1; border: 1px solid #e6e6e6; border-radius: 12px; padding: 12px; }
.phase strong, .wait strong { display: block; margin-top: 4px; font-size: 18px; letter-spacing: 0.04em; color: #3c3c3c; }
.k { color: #6d6d6d; font-size: 11px; letter-spacing: 0.08em; font-weight: 600; }
.wait { margin-top: 10px; }
.wait .clock { display: flex; gap: 10px; margin-top: 8px; }
.wait .clock b { display: block; color: #3c3c3c; font-size: 22px; }
.wait .clock span { color: #6d6d6d; font-size: 10px; font-weight: 600; }
button.act, button.ghost, button.go, button.stop { border-radius: 999px; font: inherit; font-weight: 600; cursor: pointer; }
button.act { width: 100%; margin-top: 10px; background: #cbd530; color: #3c3c3c; border: 0; padding: 10px; letter-spacing: 0.04em; }
button.ghost { width: 100%; margin-top: 8px; background: #fff; color: #3c3c3c; border: 1px solid #e6e6e6; padding: 8px; }
button.ghost.on { background: #3c3c3c; color: #fff; border-color: #3c3c3c; }
button.go { background: #cbd530; color: #3c3c3c; border: 0; padding: 8px 14px; }
button.stop { background: #fff; color: #c62828; border: 1px solid #c62828; padding: 8px 14px; }
button:disabled { opacity: 0.45; cursor: default; }
.panel { min-height: 180px; background: #fff; }
.panel h2 { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: #3c3c3c; }
.vuoto { color: #6d6d6d; text-align: center; padding: 28px 8px; }
.busta { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.busta button { background: transparent; color: #c62828; border: 0; cursor: pointer; font: inherit; font-weight: 600; }
.prev { margin-top: 16px; }
.prev select { width: 100%; margin-top: 8px; background: #fff; color: #3c3c3c; border: 1px solid #e6e6e6; border-radius: 999px; padding: 8px 12px; font: inherit; font-weight: 600; }
.panel h3 { margin: 12px 0 4px; font-size: 15px; color: #3c3c3c; }
.panel h4 { margin: 14px 0 4px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: #6d6d6d; }
.esito { padding: 8px 0; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
.esito.vinta { border-left: 3px solid #4d5c12; padding-left: 8px; }
.up { color: #1f8a4c; }
.down { color: #c62828; }
.mask { position: fixed; inset: 0; background: rgba(55, 55, 55, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 16px; overflow: auto; }
.modal { width: min(980px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); background: #fff; border: 1px solid #e6e6e6; border-radius: 16px; padding: 16px 16px 12px; color: #373737; display: flex; flex-direction: column; overflow: hidden; }
.mhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.modal h2 { margin: 0; font-size: 18px; font-weight: 700; color: #3c3c3c; }
button.x { border: 0; background: transparent; color: #3c3c3c; font-size: 28px; line-height: 1; cursor: pointer; padding: 0 4px; }
.mbody { overflow-y: auto; min-height: 0; padding-right: 2px; }
.line { display: grid; grid-template-columns: 210px 1fr; gap: 10px; align-items: center; margin: 10px 0; font-size: 14px; }
.lab { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: #3c3c3c; }
.line select, .line input, .line textarea, .scelto { width: 100%; background: #fff; color: #373737; border: 1px solid #e6e6e6; border-radius: 8px; padding: 8px 10px; font: inherit; }
.line.top { align-items: start; }
.line textarea { min-height: 72px; resize: vertical; }
.scelto { min-height: 38px; font-weight: 700; }
.ruoli { display: flex; flex-wrap: nowrap; gap: 12px 16px; }
.ruoli label { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; white-space: nowrap; }
.ruoli input { accent-color: #cbd530; width: 16px; height: 16px; }
.credits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.credits span { display: block; color: #6d6d6d; font-size: 12px; font-weight: 600; margin-bottom: 4px; }
.commento, .nota { margin-top: 8px; width: 100%; border: 1px solid #e6e6e6; border-radius: 8px; background: #f4f5f1; color: #373737; padding: 8px 10px; font-size: 13px; line-height: 1.4; }
.actions { display: flex; justify-content: space-between; gap: 12px; flex: 0 0 auto; margin-top: 8px; padding-top: 12px; border-top: 1px solid #f0f0f0; background: #fff; }
button.go, button.stop { min-height: 44px; }
.login { max-width: 420px; margin: 40px auto; }
.login label { display: block; margin: 10px 0; font-weight: 600; color: #3c3c3c; }
.login select, .login input { width: 100%; margin-top: 4px; background: #fff; color: #373737; border: 1px solid #e6e6e6; border-radius: 8px; padding: 8px; font: inherit; font-weight: 400; }
.err { color: #c62828; }
.note { color: #6d6d6d; font-size: 12px; line-height: 1.4; font-weight: 400; }
@media (max-width: 760px) {
  .grid, .line, .credits { grid-template-columns: 1fr; }
  .toprow { flex-direction: column; align-items: flex-start; }
  .who { text-align: left; }
  .wait strong { overflow-wrap: anywhere; }
  .wait .clock { flex-wrap: wrap; }
  .mask { padding: 8px; }
  .modal { width: 100%; max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 12px 12px 10px; border-radius: 12px; }
  .modal h2 { font-size: 16px; }
  .line select, .line input, .line textarea, .scelto { font-size: 16px; }
  .ruoli { flex-wrap: wrap; }
  .actions { flex-direction: column; }
  button.go, button.stop { width: 100%; min-height: 48px; }
}
