:root { --a-bg: #f4f5f7; --a-panel: #fff; --a-line: #e3e6ea; --a-text: #16191d; --a-mute: #667085; --a-brand: #2b59c3; --a-live: #e5484d; --a-ok: #12805c; --a-warn: #b54708; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --a-bg: #0f1216; --a-panel: #171b21; --a-line: #2a3039; --a-text: #e7eaee; --a-mute: #98a2b3; --a-brand: #6e9bff; color-scheme: dark; } }
:root[data-theme="dark"] { --a-bg: #0f1216; --a-panel: #171b21; --a-line: #2a3039; --a-text: #e7eaee; --a-mute: #98a2b3; --a-brand: #6e9bff; color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
body { background: var(--a-bg); color: var(--a-text); font-family: var(--font-base); font-size: 14px; }
a { color: var(--a-brand); }
.btn { border: 1px solid var(--a-line); background: var(--a-panel); color: var(--a-text); padding: 7px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--a-mute); }
.btn.pri { background: var(--a-brand); border-color: var(--a-brand); color: #fff; }
.btn.live { background: var(--a-live); border-color: var(--a-live); color: #fff; }
.btn.ok { background: var(--a-ok); border-color: var(--a-ok); color: #fff; }
.btn.danger { color: var(--a-live); }
.btn.on { background: color-mix(in srgb, var(--a-brand) 14%, var(--a-panel)); border-color: var(--a-brand); color: var(--a-brand); }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.lg { padding: 11px 16px; font-size: 14px; }
.btn:disabled { opacity: .4; cursor: default; }
input[type=text], input[type=password], input[type=number], input[type=date], textarea, select { border: 1px solid var(--a-line); background: var(--a-panel); color: var(--a-text); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 60px; resize: vertical; }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--a-mute); margin: 12px 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.muted { color: var(--a-mute); }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--a-line); color: var(--a-text); }
.badge.live { background: var(--a-live); color: #fff; } .badge.warn { background: #fdb022; color: #000; } .badge.ok { background: var(--a-ok); color: #fff; }

/* login / elenco */
.wrap { max-width: 920px; margin: 40px auto; padding: 0 16px; }
.card { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 12px; padding: 18px; }
.evlist { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.evitem { display: flex; gap: 12px; align-items: center; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 10px; padding: 12px 14px; }
.evitem .n { font-weight: 700; flex: 1; }

/* console */
#console { display: grid; grid-template-rows: auto 1fr; height: 100vh; }
#bar { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--a-panel); border-bottom: 1px solid var(--a-line); flex-wrap: wrap; }
#bar .title { font-weight: 800; font-size: 15px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#bar .code { font-family: ui-monospace, monospace; font-weight: 700; background: var(--a-bg); padding: 3px 8px; border-radius: 6px; }
.seg { display: inline-flex; border: 1px solid var(--a-line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--a-panel); color: var(--a-text); padding: 6px 12px; font-weight: 700; font-size: 12px; }
.seg button.on.test { background: #fdb022; color: #000; } .seg button.on.live { background: var(--a-live); color: #fff; }
.spacer { flex: 1; }
#grid { display: grid; grid-template-columns: 300px 1fr 380px; min-height: 0; }
.col { overflow: auto; min-height: 0; padding: 14px; }
.col + .col { border-left: 1px solid var(--a-line); }
.col h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--a-mute); display: flex; align-items: center; gap: 8px; }
.acts { display: flex; flex-direction: column; gap: 6px; }
.act { display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--a-line); border-radius: 10px; background: var(--a-panel); cursor: pointer; }
.act:hover { border-color: var(--a-mute); }
.act.sel { border-color: var(--a-brand); box-shadow: 0 0 0 2px color-mix(in srgb, var(--a-brand) 25%, transparent); }
.act.onair { border-left: 4px solid var(--a-live); }
.act .ic { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--a-bg); font-size: 14px; }
.act .q { font-size: 13px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.act .q small { display: block; color: var(--a-mute); font-size: 11px; }
.act .n { font-size: 12px; font-weight: 700; color: var(--a-mute); text-align: right; }
.menu { position: relative; }
.menu .pop { position: absolute; top: 100%; left: 0; z-index: 20; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 10px; box-shadow: 0 10px 30px #0003; padding: 6px; min-width: 220px; display: none; }
.menu.open .pop { display: block; }
.pop button { display: flex; gap: 10px; width: 100%; border: 0; background: none; color: var(--a-text); padding: 8px 10px; border-radius: 6px; text-align: left; }
.pop button:hover { background: var(--a-bg); }

.preview { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: 10px; overflow: hidden; border: 1px solid var(--a-line); }
.preview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.preview .tag { position: absolute; right: 10px; top: 10px; z-index: 2; }
.controls { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.controls .grp { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.controls .grp > span { font-size: 11px; font-weight: 700; color: var(--a-mute); text-transform: uppercase; width: 70px; }
.stat { display: flex; flex-wrap: wrap; gap: 18px; padding: 10px 12px; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 10px; }
.stat b { font-size: 20px; display: block; }
.stat div { font-size: 11px; color: var(--a-mute); }
.live-res { margin-top: 12px; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 10px; padding: 12px; }
.lr-row { display: grid; grid-template-columns: 1fr 60px 44px; gap: 8px; align-items: center; padding: 4px 0; font-size: 13px; }
.lr-row .t { height: 8px; background: var(--a-bg); border-radius: 99px; overflow: hidden; } .lr-row .t i { display: block; height: 100%; background: var(--a-brand); }
.lr-row.ok .t i { background: var(--a-ok); }

.editor { background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 10px; padding: 14px; margin-top: 12px; }
.optrow { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.optrow input[type=radio] { width: 18px; height: 18px; accent-color: var(--a-ok); }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; border-bottom: 1px solid var(--a-line); }
.tabs button { border: 0; background: none; color: var(--a-mute); padding: 8px 10px; font-weight: 700; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--a-text); border-bottom-color: var(--a-brand); }
.mod { display: flex; flex-direction: column; gap: 6px; }
.mi { border: 1px solid var(--a-line); background: var(--a-panel); border-radius: 10px; padding: 9px 10px; font-size: 13px; }
.mi.onair { border-color: var(--a-live); box-shadow: 0 0 0 2px color-mix(in srgb, var(--a-live) 25%, transparent); }
.mi.hidden { opacity: .5; text-decoration: line-through; }
.mi .t { line-height: 1.35; margin-bottom: 6px; word-break: break-word; }
.mi .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.words { display: flex; flex-wrap: wrap; gap: 6px; }
.word { border: 1px solid var(--a-line); background: var(--a-panel); border-radius: 99px; padding: 4px 10px; font-size: 12px; color: var(--a-text); }
.word.flag { border-color: var(--a-live); color: var(--a-live); }
.word.hid { text-decoration: line-through; opacity: .55; }
.sent { display: flex; height: 10px; border-radius: 99px; overflow: hidden; margin: 8px 0; }
.sent i:nth-child(1) { background: var(--a-ok); } .sent i:nth-child(2) { background: #98a2b3; } .sent i:nth-child(3) { background: var(--a-live); }
dialog { border: 1px solid var(--a-line); border-radius: 14px; background: var(--a-panel); color: var(--a-text); width: min(760px, 94vw); max-height: 90vh; padding: 0; }
dialog::backdrop { background: #0007; }
dialog .dh { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--a-line); font-weight: 800; }
dialog .db { padding: 6px 18px 18px; overflow: auto; max-height: calc(90vh - 120px); }
dialog .df { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--a-line); }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.colors label { display: flex; align-items: center; gap: 8px; font-size: 12px; border: 1px solid var(--a-line); border-radius: 8px; padding: 6px 8px; }
.colors input { width: 34px; height: 26px; border: 0; padding: 0; background: none; }
.chk { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; font-size: 13px; }
.chk input { margin-top: 2px; }
.links { display: grid; grid-template-columns: 110px 1fr auto; gap: 6px 10px; align-items: center; font-size: 12px; }
.links code { background: var(--a-bg); padding: 5px 8px; border-radius: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kbd { font-size: 11px; color: var(--a-mute); margin-top: 14px; line-height: 1.7; }
.kbd kbd { border: 1px solid var(--a-line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-family: inherit; }
@media (max-width: 1150px) { #grid { grid-template-columns: 1fr; } .col + .col { border-left: 0; border-top: 1px solid var(--a-line); } #console { height: auto; } }

.stat .sim { margin-left: auto; border-left: 1px solid var(--a-line); padding-left: 16px; }

/* scelta del tema */
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.tcard { display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 10px; border: 2px solid var(--a-line); border-radius: 12px; background: var(--a-panel); color: var(--a-text); }
.tcard:hover { border-color: var(--a-mute); }
.tcard.on { border-color: var(--a-brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a-brand) 22%, transparent); }
.tcard small { color: var(--a-mute); font-size: 11px; line-height: 1.35; font-weight: 400; }
.tpair { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 4px; }
.tmini { height: 54px; border-radius: 7px; padding: 8px; display: flex; flex-direction: column; justify-content: center; gap: 5px; border: 1px solid color-mix(in srgb, currentColor 14%, transparent); }
.tmini i { display: block; height: 7px; border-radius: 99px; }
.modes { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; margin-top: 12px; font-size: 13px; }
.modes .seg { justify-self: start; }
.seg button.plain.on { background: var(--a-brand); color: #fff; }
/* logo positivo/negativo secondo l'aspetto */
.logo img { vertical-align: middle; }
.logo img.logo-pos { display: inline-block; } .logo img.logo-neg { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo img.logo-pos { display: none; } :root:not([data-theme="light"]) .logo img.logo-neg { display: inline-block; } }
:root[data-theme="dark"] .logo img.logo-pos { display: none; } :root[data-theme="dark"] .logo img.logo-neg { display: inline-block; }
.uitoggle { min-width: 36px; justify-content: center; display: inline-flex; align-items: center; padding-left: 8px; padding-right: 8px; }
.uitoggle svg { display: block; }
/* intestazione dell'area riservata */
.apphead { display: flex; align-items: center; gap: 14px; padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); background: var(--a-panel); border-bottom: 1px solid var(--a-line); flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
.apphead nav { display: flex; gap: 4px; }
.apphead nav a { padding: 7px 12px; border-radius: 8px; color: var(--a-text); text-decoration: none; font-weight: 600; }
.apphead nav a.on, .apphead nav a:hover { background: var(--a-bg); }
.userchip { display: flex; flex-direction: column; line-height: 1.15; text-decoration: none; color: var(--a-text); padding: 4px 10px; border-radius: 8px; }
.userchip small { color: var(--a-mute); font-size: 11px; }
.userchip:hover, .userchip.on { background: var(--a-bg); }
.wrap h1 { font-size: 26px; margin: 8px 0 14px; } .wrap h2 { font-size: 17px; margin: 22px 0 10px; }
.wrap.narrow { max-width: 620px; }
.wrap section.card { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.wrap section.card h2 { margin: 0; }
.fld { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.fld small { font-weight: 400; }
.small { font-size: 12px; }
.evitem { flex-wrap: wrap; }
.evitem .n { min-width: 0; flex: 1 1 320px; }
.evitem .evname { font-weight: 700; font-size: 15px; }
.evitem .actions { flex: 0 1 auto; }
.loginwrap { max-width: 440px; margin: 0 auto; padding: 48px max(16px, env(safe-area-inset-right, 0px)) 32px max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 22px; }
.logintop { display: flex; align-items: center; justify-content: space-between; }
.logincard { display: flex; flex-direction: column; gap: 14px; }
.logincard h1 { margin: 0; font-size: 22px; }
.logincard p { margin: 0; }
.err { color: var(--a-live); min-height: 1.2em; font-weight: 600; }
.center { text-align: center; }
.tablewrap { overflow-x: auto; background: var(--a-panel); border: 1px solid var(--a-line); border-radius: 12px; }
table.users { width: 100%; border-collapse: collapse; font-size: 13px; }
table.users th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--a-mute); padding: 10px 12px; border-bottom: 1px solid var(--a-line); }
table.users td { padding: 10px 12px; border-bottom: 1px solid var(--a-line); vertical-align: middle; }
table.users tr:last-child td { border-bottom: 0; }
table.users tr.off td { opacity: .55; }
table.users td.actions { text-align: right; }
.badge.role-admin { background: #7a5af8; color: #fff; } .badge.role-regia { background: var(--a-brand); color: #fff; } .badge.role-relatore { background: #0e9384; color: #fff; }
.checks { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow: auto; padding: 4px 0; }
.quick { margin-top: 12px; padding: 12px; border: 1px dashed var(--a-line); border-radius: 10px; display: flex; flex-direction: column; gap: 8px; }
.quick .row input { flex: 1 1 140px; width: auto; }
@media (max-width: 1560px) { #bar { gap: 8px; } #bar > .btn { padding-left: 10px; padding-right: 10px; } #bar .title { max-width: 240px; } }
/* utenze di prova nella pagina di accesso */
.provacard { display: flex; flex-direction: column; gap: 8px; }
.provacard h2 { margin: 0; font-size: 16px; }
.provacard p { margin: 0 0 4px; }
.provarow { display: grid; grid-template-columns: 112px 82px auto; grid-template-areas: "r u p" "r n n"; gap: 0 10px; align-items: center; text-align: left; background: var(--a-bg); border: 1px solid var(--a-line); border-radius: 10px; padding: 8px 10px; cursor: pointer; color: var(--a-text); font: inherit; font-size: 14px; }
.provarow:hover, .provarow:focus-visible { border-color: var(--a-brand); }
.provarow .badge { grid-area: r; justify-self: start; }
.provarow b { grid-area: u; } .provarow code { grid-area: p; font-size: 13px; } .provarow .muted { grid-area: n; font-size: 12px; }
.provacard p b { white-space: nowrap; }
