:root { --bg:#0f1115; --panel:#181c24; --border:#2a3040; --text:#e6e8ee; --muted:#8b93a7; --accent:#3b82f6; --ok:#22c55e; --warn:#f59e0b; --err:#ef4444; --onair:#dc2626; }
* { box-sizing: border-box; }
body { margin:0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background:var(--bg); color:var(--text); }
header { display:flex; align-items:center; justify-content:space-between; padding:12px 20px; border-bottom:1px solid var(--border); background:var(--panel); }
header h1 { font-size:18px; margin:0; }
header .who { color:var(--muted); font-size:14px; }
header .who a { color:var(--accent); margin-left:10px; }
main { padding:20px; max-width:1500px; margin:0 auto; }
.grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(460px, 1fr)); gap:18px; }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }
.card { background:var(--panel); border:1px solid var(--border); border-radius:10px; padding:16px; }
.card h2 { font-size:15px; margin:0 0 12px; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; }
label { display:block; font-size:13px; color:var(--muted); margin:8px 0 4px; }
input, select { width:100%; padding:8px 10px; border-radius:6px; border:1px solid var(--border); background:#0f1218; color:var(--text); font-size:14px; }
input[type=number] { width:100%; }
.row { display:flex; gap:10px; align-items:end; flex-wrap:wrap; }
.row > * { flex:1 1 150px; min-width:0; }
button { padding:9px 14px; border-radius:6px; border:none; background:var(--accent); color:#fff; font-size:14px; cursor:pointer; }
button.secondary { background:#2a3040; }
button.danger { background:var(--err); }
button.ok { background:var(--ok); color:#06220f; }
button:disabled { opacity:.5; cursor:default; }
table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { text-align:left; padding:8px 6px; border-bottom:1px solid var(--border); vertical-align:middle; }
td code { white-space:normal; word-break:break-all; }
td:last-child { white-space:nowrap; }
th { color:var(--muted); font-weight:500; }
code { background:#0f1218; padding:2px 6px; border-radius:4px; font-size:13px; }
.status { display:inline-block; padding:3px 9px; border-radius:999px; font-size:12px; font-weight:600; }
.status.on { background:#14532d; color:#86efac; }
.status.off { background:#3f1d1d; color:#fca5a5; }
.status.warn { background:#422006; color:#fcd34d; }
pre.log { background:#0a0c10; border:1px solid var(--border); border-radius:6px; padding:10px; font-size:12px; max-height:320px; overflow:auto; white-space:pre-wrap; color:#b8c0d4; }
.msg { font-size:13px; margin-top:8px; min-height:18px; }
.msg.err { color:var(--err); } .msg.ok { color:var(--ok); }
.player { width:100%; aspect-ratio:16/9; background:#000; border-radius:8px; border:1px solid var(--border); }
.login { max-width:360px; margin:12vh auto; }
.login h1 { text-align:center; }
/* Tecnico */
.onair { width:100%; padding:28px; font-size:28px; font-weight:800; letter-spacing:.1em; border-radius:12px; background:#2a3040; color:#fff; transition:.15s; }
.onair.live { background:var(--onair); box-shadow:0 0 40px rgba(220,38,38,.6); animation:pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow:0 0 12px rgba(220,38,38,.3); } }
.meter { height:14px; background:#0f1218; border-radius:7px; overflow:hidden; border:1px solid var(--border); }
.meter > div { height:100%; width:0; background:linear-gradient(90deg,#22c55e,#eab308 70%,#ef4444); transition:width .05s; }
.hint { color:var(--muted); font-size:13px; }
/* PTZ */
.ptz { display:flex; gap:14px; align-items:center; justify-content:center; margin-bottom:10px; }
.pad { display:grid; grid-template-columns:repeat(3,64px); grid-auto-rows:64px; gap:6px; }
.zoom { display:flex; flex-direction:column; gap:6px; }
.zoom .k { width:64px; height:64px; line-height:1.1; }
.k { font-size:26px; background:#2a3040; border-radius:10px; user-select:none; touch-action:none; -webkit-user-select:none; }
.k:active { background:var(--accent); }
.k.home { background:#1f2937; color:var(--muted); }
.k small { font-size:11px; }

/* gruppi di pulsanti nelle righe: larghezza naturale, mai schiacciati, vanno a capo come blocco */
.row > .actions { flex:0 0 auto; display:flex; gap:8px; flex-wrap:nowrap; margin-left:auto; }
.row > .actions button { white-space:nowrap; }
