/* Regia: righe in stile console (tile di stato + meter verticale + nome + azioni) */
.studio { --row: rgba(0, 18, 13, .55); --row-h: 76px; --tile-ok: #1f9d63; }
i[data-icon] { display: inline-grid; place-items: center; width: 22px; height: 22px; }
i[data-icon] svg { width: 100%; height: 100%; }

/* topbar + toolbar */
.studio .topbar { gap: 8px 12px; }
.toolbar { display: flex; gap: 4px; order: 3; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.tb { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 12px; background: rgba(255,255,255,.06); border-color: transparent; font-weight: 600; }
.tb i[data-icon] { width: 18px; height: 18px; }
.tb.on { background: var(--ginestra); color: var(--ardesia); }
.topbar .right { display: flex; gap: 6px; align-items: center; margin-left: auto; }
.room-pill code { background: none; padding: 0; color: var(--fg); }
@media (max-width: 520px) { .room-pill { display: none; } }

/* layout */
.console { display: block; padding: 12px; }
.rows { max-width: 760px; margin: 0 auto; display: grid; gap: 8px; }
@media (min-width: 1100px) {
  .console { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; padding: 18px; align-items: start; max-width: 1360px; margin: 0 auto; }
  .rows { max-width: none; margin: 0; }
  .toolbar { order: 0; flex: 0 1 auto; margin-left: 12px; }
}

/* riga */
.crow { display: flex; align-items: stretch; gap: 10px; min-height: var(--row-h); padding: 6px; padding-right: 8px; border-radius: 14px; background: var(--row); border: 1px solid var(--line); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tile { flex: none; width: 76px; min-height: 62px; border-radius: 10px; display: grid; place-items: center; border: 0; padding: 0; color: #fff; background: rgba(255,255,255,.14); cursor: pointer; transition: background .15s, transform .1s; }
.tile i[data-icon] { width: 34px; height: 34px; }
.tile.green { background: var(--tile-ok); }
.tile.grey { background: rgba(255,255,255,.18); cursor: default; }
.tile.amber { background: var(--ginestra); color: var(--ardesia); }
.tile.red { background: var(--live); }
.tile.off { background: rgba(255,255,255,.1); color: var(--dim); }
.tile.pulse { animation: blink 1.4s infinite; }
.vmeter { flex: none; width: 12px; height: auto; align-self: stretch; border-radius: 4px; background: var(--meter-bg); }
.cmain { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ctitle { font: 600 1.35rem/1.15 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.ctitle .name { overflow: hidden; text-overflow: ellipsis; }
.csub { color: var(--mute); font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.csub b { color: var(--fg); }
.crow.guest .csub .lat b { color: var(--ok); }
.crow.guest.lat-warn .csub .lat b { color: var(--ginestra); }
.crow.guest.lat-err .csub .lat b { color: var(--live); }
.csub .route { margin-left: 6px; font-size: .75rem; color: var(--dim); }
.cact { display: flex; align-items: center; gap: 2px; flex: none; }
.cact .yellow, .cact .ghost { min-height: 40px; }
.ib { min-height: 44px; min-width: 44px; padding: 0; border-radius: 12px; background: transparent; border-color: transparent; color: var(--fg); display: grid; place-items: center; }
.ib:hover { background: rgba(255,255,255,.1); }
.ib[aria-pressed=true] { color: var(--ginestra); }
.ib[aria-pressed=false] { color: var(--dim); }
.ib:disabled { opacity: .35; }
.ib.open { background: rgba(255,255,255,.12); }
.vthumb { flex: none; width: 96px; border-radius: 8px; overflow: hidden; background: #000; align-self: center; aspect-ratio: 16/9; cursor: pointer; }
.vthumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 480px) {
  .studio { --row-h: 68px; }
  .tile { width: 62px; min-height: 56px; } .tile i[data-icon] { width: 28px; height: 28px; }
  .ctitle { font-size: 1.15rem; } .csub { font-size: .82rem; }
  .vthumb { width: 64px; }
}

/* pannello impostazioni della riga */
.cpanel { margin: -4px 0 4px 18px; padding: 14px 16px; border-radius: 0 0 14px 14px; background: rgba(0, 12, 9, .55); border: 1px solid var(--line); border-top: 0; }
.guest-wrap { display: grid; gap: 0; }
.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline input { margin: 0; flex: 1; min-width: 0; }
.spacer { flex: 1; }
.lat-detail { font-size: .75rem; color: var(--dim); white-space: pre-line; }
button.yellow, label.yellow { background: var(--ginestra); color: var(--ardesia); border-color: transparent; }
button.danger { color: #ffb4a6; }
button.wide, label.wide { width: 100%; }
.sep { border: 0; border-top: 1px solid var(--line2); margin: 8px 0; }

/* registrazione */
.rec-tile { background: rgba(255,90,60,.22); color: var(--live); }
.rec-tile i[data-icon] { width: 30px; height: 30px; }
.crow.rec.on .rec-tile { background: var(--live); color: #fff; animation: pulse 1.4s infinite; }
.crow.rec.on .ctitle { color: #fff; }
.tracks { margin: -4px 0 4px 34px; border: 1px solid rgba(246,247,244,.22); border-radius: 0 0 12px 12px; background: rgba(0, 12, 9, .55); overflow: hidden; }
.tracks ul { list-style: none; margin: 0; padding: 0; }
.tracks li { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 10px; border-top: 1px solid var(--line); font-weight: 600; font-size: .92rem; }
.tracks li:first-child { border-top: 0; }
.tracks li canvas { width: 8px; height: 28px; flex: none; border-radius: 3px; }
.tracks li .tn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tracks li .sz { color: var(--dim); font: .72rem var(--mono); }
.tracks li a, .tracks li .tdot { display: grid; place-items: center; width: 36px; height: 36px; color: var(--fg); }
.tracks li .tdot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--dim); }
.tracks li.live .tdot::before { background: var(--live); animation: blink 1.2s infinite; }
.markers { border-top: 1px solid var(--line2); }
.markers:empty { display: none; }
.markers li { font-weight: 400; }
.markers li .mt { font: .8rem var(--mono); color: var(--ginestra); flex: none; }
.markers li input { margin: 0; min-height: 34px; padding: 4px 10px; font-size: 15px; }

/* collega ospite + barra in basso */
.connect { min-height: 64px; border-radius: 14px; border: 1px dashed var(--line2); background: rgba(0,0,0,.15); color: var(--mute); letter-spacing: .2em; font-weight: 600; font-size: 1rem; }
.connect:hover { color: var(--fg); border-color: var(--ginestra); }
.cpanel.invite { margin: -4px 0 4px; border-radius: 0 0 14px 14px; }
.addline { justify-self: start; min-height: 34px; font-size: .82rem; padding: 0 14px; background: transparent; border-style: dashed; color: var(--mute); }
.bottombar { display: flex; align-items: center; gap: 8px; padding: 6px 2px 2px; }
.bottombar .admission { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--fg); font-weight: 600; }
.bottombar .admission select { margin: 0; width: auto; min-height: 38px; padding: 4px 10px; }
.crow.pending { border-color: rgba(242,194,48,.5); }
.crow.pending .cact { gap: 6px; }
.studio .empty { display: grid; justify-items: center; }

/* dock (clips, player, audio, chat) */
.dock { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: rgba(0, 30, 22, .97); padding: max(10px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); overflow: hidden; }
@media (min-width: 1100px) {
  .dock, .dock[hidden] { display: flex !important; position: sticky; top: 84px; inset: auto; height: calc(100dvh - 104px); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 16px; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .dock-close { display: none !important; }
}
.dock-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.dock-tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.dock-tabs button { min-height: 38px; padding: 0 14px; border-radius: 10px; background: transparent; border-color: transparent; color: var(--mute); }
.dock-tabs button.on { background: rgba(255,255,255,.1); color: var(--fg); }
.dpanel { display: none; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.dpanel.on { display: block; }
.dpanel.chat.on { display: flex; flex-direction: column; }
.dpanel.chat .chat-log { flex: 1; max-height: none; }
.dpanel h2 { margin-top: 1.2em; } .dpanel h2:first-child { margin-top: 0; }
.filebtn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; cursor: pointer; margin: 0; color: var(--ardesia); }
.clips-bar { display: flex; gap: 8px; margin-bottom: 10px; }

/* clips: griglia di pad */
.clips-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; margin: 10px 0; }
.pad { --c: var(--verde); position: relative; min-height: 76px; border-radius: 12px; padding: 8px 10px 10px; text-align: left; display: flex; flex-direction: column; justify-content: space-between; background: color-mix(in srgb, var(--c) 55%, transparent); border: 1px solid color-mix(in srgb, var(--c) 80%, white 10%); white-space: normal; overflow: hidden; }
.pad.j { grid-column: span 2; min-height: 110px; font-size: 1.1rem; }
.pad[data-color=ginestra] { --c: var(--ginestra); color: var(--ardesia); }
.pad[data-color=golfo] { --c: var(--golfo); }
.pad[data-color=live] { --c: var(--live); }
.pad[data-color=ardesia] { --c: #4d5a65; }
.pad .pn { font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.pad .pm { font: .7rem var(--mono); opacity: .8; display: flex; justify-content: space-between; gap: 6px; }
.pad .pp { position: absolute; left: 0; bottom: 0; height: 4px; width: 0; background: currentColor; opacity: .9; }
.pad.playing { box-shadow: 0 0 0 2px #fff inset; }
.pad .pe { position: absolute; top: 2px; right: 2px; min-height: 28px; min-width: 28px; padding: 0; border: 0; background: transparent; opacity: .7; font-size: .9rem; color: inherit; }
.cpanel.clip-edit { margin: 8px 0 0; border-radius: 14px; border-top: 1px solid var(--line); }

/* player */
.player { margin-top: 14px; padding: 16px; border-radius: 16px; background: rgba(0,0,0,.25); border: 1px solid var(--line); }
.p-title { font: 700 1.1rem var(--font-display); margin-bottom: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-times { display: flex; justify-content: space-between; font-size: .8rem; color: var(--mute); }
.p-ctl { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 10px 0 14px; }
.round { width: 52px; height: 52px; min-height: 0; padding: 0; border-radius: 50%; display: grid; place-items: center; font: 600 .8rem var(--mono); }
.round.big { width: 72px; height: 72px; background: var(--ginestra); color: var(--ardesia); border: 0; }
.round.big i[data-icon] { width: 30px; height: 30px; }

/* video ospite nel pannello */
.gpanel .vid { margin: 0 0 10px; }

/* mostra/nascondi dettagli tecnici */
body:not(.show-stats) .crow .route { display: none; }
body.show-stats .gpanel .stats { display: flex; }
.pad .pn { padding-right: 18px; }
@media (max-width: 440px) {
  .toolbar { gap: 6px; }
  .tb { flex: 1; justify-content: center; padding: 0 10px; }
  .tb span { display: none; }
  .tb i[data-icon] { width: 20px; height: 20px; }
}
