:root {
  --bg: #f4f6f8; --card: #ffffff; --text: #16202a; --muted: #5b6b7b;
  --primary: #1b5fb4; --primary-text: #fff; --danger: #b3261e; --ok: #1b7f3b;
  --warn-bg: #fff4d6; --warn-border: #e0a800; --border: #d5dbe2;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--border); }
h1 { font-size: 22px; margin: 0; }
h1 .sub { font-weight: 400; color: var(--muted); font-size: 15px; margin-left: 6px; }
h2 { font-size: 20px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
main { padding: 20px; max-width: 1400px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
label { display: block; font-weight: 600; margin: 12px 0 4px; }
input { width: 100%; font-size: 16px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; }
input:focus, button:focus-visible, .stage:focus-visible { outline: 3px solid #7fb3ff; outline-offset: 2px; }
button { font-size: 15px; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); background: #fff; cursor: pointer; }
button:hover { background: #eef2f6; }
button.primary { background: var(--primary); color: var(--primary-text); border-color: var(--primary); font-size: 17px; padding: 12px 18px; margin-top: 16px; }
button.danger { background: var(--danger); color: #fff; border-color: var(--danger); width: 100%; margin-top: 8px; font-size: 16px; }
button.link { background: none; border: none; color: var(--primary); text-decoration: underline; padding: 0; font-size: inherit; }
.msg { min-height: 1.4em; color: var(--muted); }
.msg.error { color: var(--danger); font-weight: 600; }
.pill { padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.pill.off { background: #e7ebef; color: var(--muted); }
.pill.wait { background: #fff4d6; color: #7a5a00; }
.pill.on { background: #dff5e5; color: var(--ok); }
.session { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; }
@media (max-width: 900px) { .session { grid-template-columns: 1fr; } }
.stage { position: relative; background: #111; border-radius: 12px; overflow: hidden; height: 78vh; min-height: 420px; touch-action: none; user-select: none; cursor: crosshair; }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px; background: rgba(0,0,0,.55); pointer-events: none; }
.navbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.navbar button { flex: 1 1 auto; min-width: 120px; padding: 12px; font-size: 16px; }
.navbar.apps button { background: #eaf1fb; border-color: #b9cdf0; font-weight: 600; }
.row { display: flex; gap: 8px; margin-bottom: 8px; }
.row input { flex: 1; }
.col { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.info { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0 0 8px; }
.info dt { color: var(--muted); }
.info dd { margin: 0; font-weight: 600; }
.log-tech pre { max-height: 180px; overflow: auto; background: #0f172a; color: #c8d3e0; padding: 10px; border-radius: 8px; font-size: 12px; margin: 0; white-space: pre-wrap; }

/* ---- schermo in testo ---- */
.row.between { justify-content: space-between; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.treecard { margin-top: 12px; }
.treecard h3 .hint { font-weight: 400; margin-left: 6px; }
.tree { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.tree li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-bottom: 1px solid #eef1f4; font-size: 15px; }
.tree li:last-child { border-bottom: none; }
.tree li .lbl { flex: 1; text-align: left; background: none; border: none; padding: 6px 4px; font-size: 15px; cursor: pointer; border-radius: 6px; }
.tree li .lbl:hover { background: #eef2f6; }
.tree li.r-text .lbl { color: var(--muted); cursor: default; }
.tree li.r-text .lbl:hover { background: none; }
.tree li.r-button .lbl, .tree li.r-item .lbl { color: var(--primary); font-weight: 600; }
.tree li.r-check .lbl::before { content: "☐ "; }
.tree li.r-check.on .lbl::before { content: "☑ "; }
.tree li.r-edit { background: #fffbe6; }
.tree li .mini { font-size: 12px; padding: 4px 8px; }
.tree li input { max-width: 220px; font-size: 14px; padding: 6px 8px; }
.tree .badge { font-size: 11px; color: #fff; background: var(--muted); border-radius: 4px; padding: 1px 5px; }
.locked { background: var(--warn-bg); border: 1px solid var(--warn-border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
/* ---- rubrica ---- */
.contacts { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.contacts li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid #eef1f4; font-size: 14px; }
.contacts li .who { flex: 1; }
.contacts li .who b { display: block; }
.contacts li button { padding: 6px 8px; font-size: 13px; }

/* ---- schede dati ---- */
.navbar.apps button.tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabpane { margin-top: 12px; }
.threads { list-style: none; margin: 0; padding: 0; max-height: 55vh; overflow: auto; border: 1px solid var(--border); border-radius: 8px; }
.threads li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid #eef1f4; cursor: pointer; }
.threads li:hover { background: #eef2f6; }
.threads li:last-child { border-bottom: none; }
.threads li .who { flex: 1; min-width: 0; }
.threads li .who b { display: block; }
.threads li .who span { color: var(--muted); font-size: 14px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.threads li .when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.threads li.unread .who b::before { content: "● "; color: var(--primary); }
.threads li .type { width: 22px; text-align: center; }
.messages { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow: auto; padding: 10px; background: #f4f6f8; border-radius: 8px; margin: 8px 0; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 15px; white-space: pre-wrap; word-wrap: break-word; }
.bubble.in { align-self: flex-start; background: #fff; border: 1px solid var(--border); }
.bubble.out { align-self: flex-end; background: var(--primary); color: #fff; }
.bubble .when { display: block; font-size: 11px; opacity: .7; margin-top: 3px; }

/* ---- galleria ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; max-height: 60vh; overflow: auto; padding: 4px; }
.grid figure { margin: 0; cursor: pointer; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #fff; }
.grid figure:hover { border-color: var(--primary); }
.grid figure .ph { width: 100%; aspect-ratio: 1; background: #e7ebef; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; overflow: hidden; }
.grid figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid figcaption { font-size: 12px; padding: 4px 6px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photoview img { max-width: 100%; max-height: 60vh; display: block; margin: 8px auto; border-radius: 8px; }
.filebtn { display: inline-block; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; font-size: 15px; }
.filebtn:hover { background: #eef2f6; }
.btnlink { display: inline-block; padding: 10px 14px; border: 1px solid var(--ok); border-radius: 8px; background: var(--ok); color: #fff; text-decoration: none; font-size: 15px; }

/* ---- voce e guida ---- */
.navbar.voice input { flex: 2 1 220px; }
.navbar.voice button.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.filebtn.small { padding: 6px 10px; font-size: 14px; }
select { font-size: 14px; padding: 8px; border: 1px solid var(--border); border-radius: 8px; }
.threads li .body { color: var(--text); font-size: 14px; white-space: pre-wrap; }
.threads li.notif { flex-wrap: wrap; cursor: default; }
.threads li.notif .who { flex: 1 1 60%; }
.threads li.notif .replybox { flex-basis: 100%; display: flex; gap: 6px; margin-top: 6px; }
.threads li.notif .replybox input { flex: 1; }

/* ---- permessi ---- */
button.primary.small { font-size: 14px; padding: 8px 12px; margin: 0; }
.setup { list-style: none; margin: 8px 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 14px; }
.setup li.ok::before { content: "✅ "; }
.setup li.no::before { content: "❌ "; }
#xrayBtn.on { background: var(--ok); color: #fff; border-color: var(--ok); }

/* ---- strisce di pulsanti sopra il video ---- */
.strip { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-bottom: 3px; }
.strip button { flex: 0 0 auto; padding: 2px 6px; font-size: 11.5px; min-width: 0; height: 24px; border-radius: 6px; line-height: 1; }
.strip button.tab.active, .strip button.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.strip input { width: auto; padding: 2px 6px; font-size: 11.5px; height: 24px; }
.strip .sep { width: 1px; height: 20px; background: var(--border); margin: 0 3px; }
.menu { position: relative; }
.menu-list { position: absolute; top: 38px; left: 0; z-index: 20; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 4px; min-width: 240px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.menu-list button { text-align: left; }
details.card summary { cursor: pointer; font-weight: 600; }
.stage { height: 72vh; }

/* strisce a tutta larghezza, sopra le due colonne */
.strips { grid-column: 1 / -1; }
.strips .strip { gap: 4px 5px; }

/* ---- schermo virtuale (replica cliccabile) ---- */
.wire { position: absolute; pointer-events: none; }
/* ---- layout protetto (disegno su canvas, stile MyRemote) e vista grande: stanno sopra il video, sotto lo schermo virtuale ---- */
#layview, #boardview { position: absolute; cursor: pointer; border-radius: 4px; }
.wire .el { position: absolute; box-sizing: border-box; overflow: hidden; font-size: 11px; line-height: 1.1; padding: 1px 3px; pointer-events: auto; cursor: pointer; border-radius: 3px; white-space: nowrap; text-overflow: ellipsis; }
.wire .el.text { color: #e8eef5; border: 1px dashed rgba(255,255,255,.25); cursor: default; }
.wire .el.item, .wire .el.button { color: #fff; background: rgba(27,95,180,.45); border: 1px solid #8ab4f8; }
.wire .el.edit { color: #16202A; background: rgba(255,244,214,.9); border: 1px solid #e0a800; }
.wire .el.check { color: #fff; background: rgba(27,127,59,.45); border: 1px solid #7fd19a; }
.wire .el.ime { background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.6); color: #fff; text-align: center; font-weight: 700; font-size: 13px; }
.wire .el:hover { outline: 2px solid #fff; }
.stage.wireon { background: #0f172a; }

.wire .el.pattern { background: rgba(255,255,255,.06); border: 1px dashed rgba(255,255,255,.5); cursor: crosshair; }
.wire .el.pattern .dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: #fff; opacity: .85; pointer-events: none; box-shadow: 0 0 0 4px rgba(255,255,255,.15); }
.wire .el.pattern .dot.on { background: #ff3b30; opacity: 1; }
.wire .el.pattern .phint { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 11px; color: #cfd8e3; pointer-events: none; }
.wire .el.text { border: none; color: #c8d3e0; }
.wire .el.ime { border-radius: 5px; }

.wire .el.image { color: #ffd27f; border: 1px dashed rgba(255,210,127,.8); background: rgba(255,210,127,.08); cursor: default; }
#openInHb { background: var(--ok); color: #fff; border-color: var(--ok); }

/* ---- schermo virtuale: stati e leggibilità ---- */
.wire .el { display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.15; }
.wire .el.text { justify-content: flex-start; text-align: left; }
.wire .el.wrap { white-space: normal; overflow: hidden; }
.wire .el.dis { opacity: .45; filter: grayscale(1); cursor: not-allowed; }
.wire .el.sel { border-width: 2px; border-color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,.35) inset; }
.wire .el.foc { outline: 2px solid #ffd27f; outline-offset: 1px; animation: focblink 1s infinite; }
.wire .el.checked::before { content: "☑ "; }
.wire .el.check:not(.checked)::before { content: "☐ "; }
.wire .el.under { opacity: .28; }
.wire .backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); pointer-events: none; }
/* contenitore cliccabile (barra, riga con pulsanti dentro): solo un bordo tenue dietro ai testi */
.wire .el.ct { background: rgba(255,255,255,.04); border: 1px solid rgba(138,180,248,.35); }
/* interruttore senza scritta (la scritta è accanto): forma a pillola con pomello, verde se acceso */
.wire .el.check.sw { background: transparent; border: none; }
.wire .el.check.sw::before { content: ""; position: absolute; left: 12%; right: 12%; top: 50%; height: 46%; max-height: 22px; transform: translateY(-50%); border-radius: 999px; background: #4b5563; transition: background .15s; }
.wire .el.check.sw.checked::before { background: #34c759; }
.wire .el.check.sw .knob { position: absolute; top: 50%; left: 16%; width: 20%; aspect-ratio: 1; max-width: 18px; transform: translateY(-50%); border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.wire .el.check.sw.checked .knob { left: auto; right: 16%; }
@keyframes focblink { 50% { outline-color: transparent; } }


/* ---- Sblocco manuale (PIN / sequenza): come il blocco schermo Samsung (sfondo pastello, cerchi bianchi trasparenti) ---- */
.unlock { position: absolute; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 5; }
.unlock .uphone { position: relative; width: min(88%, 290px); height: min(96%, 600px); border-radius: 22px; padding: 12px 14px 18px; color: #fff; text-align: center; display: flex; flex-direction: column; overflow: hidden;
  /* stessi toni del blocco Samsung ma più profondi al centro: prima giallo/rosa chiarissimi e testo bianco illeggibile */
  background: linear-gradient(160deg, #6ea7d8 0%, #b9a679 28%, #c47f95 50%, #6c5fd0 74%, #2c3cb8 100%); box-shadow: 0 12px 40px rgba(0,0,0,.6); text-shadow: 0 1px 3px rgba(0,0,0,.55); }
.unlock .uclose { position: absolute; top: 8px; right: 8px; background: rgba(255,255,255,.25); color: #fff; border: none; border-radius: 50%; width: 28px; height: 28px; padding: 0; font-size: 13px; }
.unlock .ulock { font-size: 14px; opacity: .9; margin: 0 0 auto; }
.unlock .upane { display: flex; flex-direction: column; align-items: center; margin-top: auto; }
.unlock .utitle { font-size: 16px; color: #fff; margin: 0 0 4px; }
.unlock .udisp { min-height: 20px; font-size: 13px; color: #fff; opacity: .95; letter-spacing: 5px; margin: 0 0 14px; }
.unlock .udisp:empty::before { content: attr(data-empty); letter-spacing: 0; }
.unlock .udisp.err { color: #fff; background: #d92638; border-radius: 12px; padding: 3px 12px; font-weight: 600; letter-spacing: 0; text-shadow: none; } /* «PIN errato»: prima rosa chiarissimo, invisibile */
.unlock .ukeys { display: grid; grid-template-columns: repeat(3, 58px); justify-content: center; gap: 10px 22px; }
.unlock .ukeys button { width: 58px; height: 58px; border-radius: 50%; border: none; background: rgba(255,255,255,.24); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0; line-height: 1; text-shadow: inherit; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28); }
.unlock .ukeys button:hover { background: rgba(255,255,255,.5); }
.unlock .ukeys button .d { font-size: 22px; font-weight: 400; }
.unlock .ukeys button .l { font-size: 8px; letter-spacing: 1px; color: #fff; margin-top: 2px; min-height: 8px; }
.unlock .ukeys button.soft, .unlock .ukeys button.go { background: transparent; }
.unlock .ukeys button.go .d { font-size: 18px; font-weight: 400; }
.unlock .uchk { color: #fff; font-size: 11px; justify-content: center; margin-top: 10px; opacity: .85; }
.unlock .upad { position: relative; width: 200px; height: 200px; margin: 6px auto 10px; touch-action: none; }
.unlock .upad .ulines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.unlock .upad .ulines line { stroke: rgba(255,255,255,.85); stroke-width: 2; stroke-linecap: round; }
.unlock .upad .dot { position: absolute; width: 12px; height: 12px; transform: translate(-50%,-50%); border-radius: 50%; background: #fff; }
.unlock .upad .dot::before { content: ""; position: absolute; inset: -22px; border-radius: 50%; }
.unlock .upad .dot.on { box-shadow: 0 0 0 10px rgba(255,255,255,.35); }
.unlock .upad .num { position: absolute; transform: translate(-50%,-50%); font-size: 9px; font-weight: 700; color: #3b4fd6; pointer-events: none; }
.unlock .uhint { display: none; }
.unlock .usaved { display: flex; flex-direction: column; gap: 6px; align-items: center; margin-top: 4px; color: #fff; font-size: 12px; }
.unlock .usaved .go { background: rgba(255,255,255,.35); color: #fff; border: none; border-radius: 18px; padding: 8px 14px; font-size: 13px; }
.acclogo { width: 56px; height: 56px; object-fit: contain; border-radius: 10px; border: 1px solid var(--border); background: #fff; }
.pinbox { max-width: 360px; }
/* ---- Sincronizzazione (cassaforte unica) ---- */
/* «Sincronizzazione» come un vero pulsante: clic apre, clic chiude */
#syncCard { padding: 10px 16px; }
#syncCard summary { list-style: none; display: inline-block; cursor: pointer; font-weight: 600; font-size: 15px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--border); background: #fff; user-select: none; }
#syncCard summary::-webkit-details-marker { display: none; }
#syncCard summary:hover { background: #eef2f6; }
#syncCard[open] summary { background: var(--primary); color: #fff; border-color: var(--primary); }
#syncCard[open] { padding-bottom: 16px; }
.vault { width: 100%; border-collapse: collapse; font-size: 14px; }
.vault th, .vault td { text-align: left; padding: 4px 6px; border-bottom: 1px solid var(--border); }
.vault td.v { color: #16A34A; font-weight: 600; }
.vault td button { padding: 2px 6px; font-size: 12px; margin-right: 2px; }
.vpad { position: relative; width: 120px; height: 120px; background: #0b1428; border-radius: 12px; touch-action: none; }
.vpad .ulines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.vpad .ulines line { stroke: rgba(255,255,255,.85); stroke-width: 2; stroke-linecap: round; }
.vpad .dot { position: absolute; width: 10px; height: 10px; transform: translate(-50%,-50%); border-radius: 50%; background: #fff; }
.vpad .dot.on { box-shadow: 0 0 0 6px rgba(255,255,255,.35); }
.vpad .num { position: absolute; transform: translate(-50%,-50%); font-size: 8px; font-weight: 700; color: #0b1428; pointer-events: none; }
.vmodel { padding: 8px 12px; font-size: 14px; }
.vmodel.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.vault td img { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; border-radius: 6px; border: 1px solid var(--border); }
/* scritta più larga del riquadro: si taglia a destra (prima spariva l'inizio, es. «ndietro») */
.wire .el { justify-content: safe center; }
.wire .el.text { justify-content: flex-start; }
/* pulsante a sola icona: simbolo come sul telefono, nome completo al passaggio del mouse */
.wire .el.icon { justify-content: center; font-weight: 400; line-height: 1; }
/* pulsante senza alcun nome: riquadro tratteggiato (si può toccare, ma non si sa cosa fa) */
.wire .el.bare { border-style: dashed; background: rgba(27,95,180,.18); }
/* al passaggio del mouse: il pulsante sale sopra gli altri ed è evidenziato in giallo, così si sa cosa si sta per toccare */
.wire .el:hover { outline: 3px solid #ffd27f; outline-offset: 0; z-index: 40; box-shadow: 0 0 0 9999px rgba(0,0,0,.25); }
.wire .wtip { position: absolute; z-index: 60; max-width: 90%; padding: 4px 8px; border-radius: 6px; background: #ffd27f; color: #111; font-size: 13px; font-weight: 600; line-height: 1.25; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.5); white-space: normal; }
/* campi di testo e barra indirizzi: si legge l'inizio (es. «google.com/search…»), non la fine */
.wire .el.edit { justify-content: flex-start; text-align: left; }
/* schermo virtuale allargato: non combacia più con il video, che si nasconde */
.stage.wirewide video { visibility: hidden; }
/* dialogo dentro la pagina (avviso cookie, ecc.): foglio in rilievo che copre la pagina, come sul telefono */
.wire .el.dlg { background: #243042; border: 1px solid #9fb3c8; border-radius: 10px; box-shadow: 0 -6px 24px rgba(0,0,0,.65); cursor: default; }
.wire .el.dlg:hover { outline: none; box-shadow: 0 -6px 24px rgba(0,0,0,.65); }
/* livelli: foglio del dialogo sopra la pagina, i suoi pulsanti e testi sopra il foglio */
.wire .el.dlg { z-index: 5; }
.wire .el.indlg { z-index: 6; }
/* pulsante «ricco»: scritta e icona nella loro posizione vera dentro il riquadro, come sul telefono */
.wire .el.rich .lbl { position: absolute; right: 4px; bottom: 2px; display: block; text-align: left; white-space: normal; overflow: hidden; line-height: 1.2; }
.wire .el .ico { position: absolute; display: flex; align-items: center; justify-content: center; line-height: 1; pointer-events: none; }
/* icona doppione della scritta accanto: solo il simbolo, non cliccabile (si clicca la riga) */
.wire .el.icoonly { pointer-events: none; display: flex; align-items: center; justify-content: center; opacity: .9; border: none; background: none; }
/* link dentro un paragrafo: zona cliccabile invisibile, la scritta sottolineata è in testa al paragrafo */
.wire .el.inl { background: transparent; border: 1px dashed rgba(138,180,248,.35); }
.wire .el .lnk { color: #8ab4f8; text-decoration: underline; }
.wire .el.icoonly, .wire .el .ico { color: #e8eef5; }
/* paragrafo con link in testa: testo continuo (non colonne affiancate) */
.wire .el.haslnk { display: block; text-align: left; }

/* ===== schermo virtuale «come il telefono»: fondo bianco, testo scuro, righe senza riquadri (stile app Android) ===== */
.stage.wirephone.wireon { background: #2a2f36; }
.wire.phone { background: #ffffff; border-radius: 14px; color: #1f1f1f; font-family: "Roboto", "Segoe UI", system-ui, sans-serif; }
.wire.phone .el { color: #1f1f1f; border: none; background: transparent; border-radius: 10px; }
.wire.phone .el.text { color: #1f1f1f; }
/* voci di lista e righe di menu: nessun riquadro, solo il testo (si colorano al passaggio del mouse) */
.wire.phone .el.item { background: transparent; border: none; color: #1f1f1f; }
/* pulsanti: forma tondeggiante grigio chiaro, come Material */
.wire.phone .el.button { background: #eef0f3; border: 1px solid #d5d9df; color: #1f1f1f; border-radius: 999px; }
.wire.phone .el.button.icon, .wire.phone .el.item.icon { background: transparent; border: none; border-radius: 50%; color: #3c4043; }
/* campi di testo */
.wire.phone .el.edit { background: #f1f3f4; border: 1px solid #c4c7c5; color: #1f1f1f; border-radius: 12px; }
/* interruttori Android */
.wire.phone .el.check { background: transparent; border: none; color: #1f1f1f; }
.wire.phone .el.check.sw::before { background: #c4c7c5; }
.wire.phone .el.check.sw.checked::before { background: #1a73e8; }
/* contenitori (barre): solo una linea sottile in alto, come le barre di navigazione delle app */
.wire.phone .el.ct { background: #f8f9fa; border: none; border-top: 1px solid #e3e5e8; border-radius: 0; }
/* pulsante senza nome: puntini tenui, si può toccare ma non si sa cosa fa */
.wire.phone .el.bare { border: 1px dashed #b8bec6; background: #f1f3f4; color: #5f6368; }
/* dialoghi e fogli: bianchi con ombra, la pagina dietro scurita */
.wire.phone .el.dlg { background: #ffffff; border: none; border-radius: 18px; box-shadow: 0 0 0 9999px rgba(0,0,0,.32), 0 -4px 18px rgba(0,0,0,.25); }
.wire.phone .el.dlg:hover { box-shadow: 0 0 0 9999px rgba(0,0,0,.32), 0 -4px 18px rgba(0,0,0,.25); }
.wire.phone .backdrop { background: rgba(0,0,0,.32); }
/* icone e link */
.wire.phone .el .ico, .wire.phone .el.icoonly { color: #444746; }
.wire.phone .el .lnk { color: #1a0dab; }
.wire.phone .el.inl { border: none; }
/* barra di stato e barra di navigazione del sistema: scritte piccole grigie */
.wire.phone .el.dis { opacity: .5; filter: none; }
/* tastiera */
.wire.phone .el.ime { background: #e8eaed; border: none; color: #1f1f1f; font-weight: 500; }
/* al passaggio del mouse: azzurro, così si vede bene cosa si sta per toccare */
.wire.phone .el:hover { outline: 3px solid #1a73e8; background-color: rgba(26,115,232,.12); box-shadow: none; z-index: 40; }
.wire.phone .el.dlg:hover { outline: none; background-color: #fff; }
.wire.phone .wtip { background: #1a73e8; color: #fff; }
.wire.phone .el.sel { border: none; box-shadow: inset 0 -3px 0 #1a73e8; }
/* icone come sul telefono: grigie e monocromatiche, non emoji colorate */
.wire.phone .el .ico, .wire.phone .el.icoonly, .wire.phone .el.icon { filter: grayscale(1) contrast(.9); opacity: .8; }
/* pulsanti dentro un avviso/dialogo: pulsanti di testo blu, come in Android («OK», «Annulla», «Non mostrare più») */
.wire.phone .el.item.indlg, .wire.phone .el.button.indlg { color: #1a73e8; font-weight: 600; background: transparent; border: none; }

/* ===== livelli al passaggio del mouse =====
   Prima l'elemento sotto il mouse saliva a z-index 40: il foglio di un menu passava SOPRA le sue voci (menu «sì/no/sempre»
   vuoto) e una barra sopra le sue scritte. Fogli e barre non salgono; un elemento della pagina resta sotto i fogli aperti. */
.wire .el:hover, .wire.phone .el:hover { z-index: 4; }
.wire .el.indlg:hover, .wire.phone .el.indlg:hover { z-index: 7; }
.wire .el.dlg:hover, .wire.phone .el.dlg:hover { z-index: 5; }
.wire .el.ct:hover, .wire.phone .el.ct:hover { z-index: auto; outline-width: 1px; }
/* menu a tendina: solo ombra, la pagina non si scurisce */
.wire.phone .el.dlg.pop, .wire.phone .el.dlg.pop:hover { box-shadow: 0 4px 18px rgba(0,0,0,.28); border-radius: 14px; }
.wire .el.dlg.pop, .wire .el.dlg.pop:hover { box-shadow: 0 4px 18px rgba(0,0,0,.5); }
/* voci di un menu a tendina: testo scuro, non pulsanti blu */
.wire.phone .el.item.indlg.inpop { color: #1f1f1f; font-weight: 400; }
.unlock .ukeys button.soft, .unlock .ukeys button.go { box-shadow: none; } /* ⌫ e OK senza cerchio, come sul blocco vero */
/* altezza del riquadro telefono calcolata da fitStage() (spazio rimasto nella finestra); questo è solo il valore iniziale */
.stage { max-height: none; }

/* ---- fotocamera del paziente: riquadro che galleggia sopra il video ---- */
.cambox { position: absolute; right: 10px; bottom: 10px; width: 34%; min-width: 180px; max-width: 420px; aspect-ratio: 3/4;
  background: #000; border: 2px solid #8ab4f8; border-radius: 12px; overflow: hidden; z-index: 30; box-shadow: 0 6px 24px rgba(0,0,0,.55); }
.cambox.big { width: 72%; max-width: none; }
.cambox video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.cambox .camwait { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #cfd8e3; font-size: 13px; text-align: center; padding: 8px; }
.cambox.live .camwait { display: none; }
.cambox .camtools { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; }
.cambox .camtools button { padding: 3px 8px; font-size: 12px; background: rgba(15,23,42,.8); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 7px; }
.cambox .camtools button.danger { background: rgba(185,28,28,.9); border-color: #fca5a5; }
.cambox .camlabel { position: absolute; left: 6px; bottom: 5px; font-size: 11px; color: #fff; background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 7px; }
/* pulsante «⏎ Invio» della striscia: verde (richiesta dell'utente) */
.strip button[data-key="enter"] { background: var(--ok); color: #fff; border-color: var(--ok); }
.strip button[data-key="enter"]:hover { filter: brightness(1.1); }

/* ===== schermo virtuale: cliccabile ≠ testo, immagini ===== */
/* aspetto «come il telefono»: ciò che si può toccare è scritto in BLU, il testo normale resta scuro */
.wire.phone .el.item, .wire.phone .el.check { color: #0b57d0; }
.wire.phone .el.item.icon { color: #3c4043; }
.wire.phone .el.item.indlg.inpop { color: #1f1f1f; }
/* segnaposto di una foto della pagina (il nome del file non si scrive): riquadro tenue con 🖼 */
.wire .el.img { background: rgba(255,255,255,.06); border: 1px dashed rgba(255,255,255,.3); }
.wire.phone .el.img { background: #f1f3f4; border: none; border-radius: 12px; }
.wire.phone .el.img.icon { opacity: .45; }
/* pulsante «🔒 Blocca» della striscia: arancione (richiesta dell'utente) */
.strip button[data-key="lock"] { background: #e8710a; color: #fff; border-color: #e8710a; }
.strip button[data-key="lock"]:hover { filter: brightness(1.1); }

/* ---------- Diario del paziente ---------- */
.diary-hint { color: var(--muted); font-size: 14px; margin: 0 0 10px; }
.diary-add { display: flex; gap: 8px; margin-bottom: 10px; }
.diary-add input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; }
.diary-add button { padding: 9px 14px; border: 1px solid var(--primary); background: var(--primary); color: var(--primary-text); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.diary-add button:hover { filter: brightness(1.08); }
.diary-list { max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #fbfcfd; }
.diary-empty { color: var(--muted); font-size: 14px; padding: 16px; text-align: center; }
.diary-item { display: flex; gap: 10px; padding: 8px 11px; border-bottom: 1px solid var(--border); }
.diary-item:last-child { border-bottom: 0; }
.diary-item time { color: var(--muted); font-size: 12px; flex: 0 0 auto; min-width: 74px; padding-top: 1px; }
.diary-item .diary-body { font-size: 14.5px; word-break: break-word; }
/* note scritte a mano dall'assistente: in evidenza; azioni automatiche: più tenui */
.diary-item.auto .diary-body { color: var(--muted); }
.diary-foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.diary-foot .ghost { padding: 7px 12px; border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 13px; }
.diary-foot .ghost:hover { background: #eef1f4; color: var(--text); }
.log-tech { margin-top: 12px; }
.log-tech summary { color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 0; }

/* voci del diario scritte dal PAZIENTE sul telefono (cosa cerca/scrive): accento a sinistra */
.diary-item.patient { border-left: 3px solid var(--primary); background: #f3f8ff; }
.diary-item.patient .diary-body { color: var(--text); }

/* pulsante «💾 Salva accesso» della striscia: sempre visibile (custodisce l'accesso dell'app rilevata) */

/* Vista affiancata: schermo virtuale a sinistra, video a destra alla stessa altezza (app.js layoutSide) */
.stage.wireside video { position: absolute; visibility: visible; }
.vmark { position: absolute; border: 3px solid #ffd27f; border-radius: 8px; box-shadow: 0 0 0 2px rgba(0,0,0,.55); pointer-events: none; z-index: 30; }
.wire .el.hl { outline: 3px solid #ffd27f; outline-offset: 0; z-index: 40; }
/* indicatore delle pagine («Pagina 3 di 3»): pallini come sul telefono */
.wire .el.pager { display: flex; gap: 7px; align-items: center; justify-content: center; background: transparent !important; border: none !important; }
.wire .el.pager .pdot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.35); flex: none; }
.wire .el.pager .pdot.on { background: #fff; }
.wire.phone .el.pager .pdot { background: #c4c7c5; }
.wire.phone .el.pager .pdot.on { background: #1f1f1f; }
/* link-immagine grande (foto prodotto): riquadro grigio grande quanto la foto, 🖼 tenue al centro, didascalia in basso */
.wire .el.pic { display: block; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.35); border-radius: 6px; }
.wire.phone .el.pic { background: #eceff1; border: 1px solid #d5d9df; border-radius: 6px; }
.wire .el.pic .picico { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-size: 30px; line-height: 1; opacity: .55; pointer-events: none; }
.wire .el .cap { position: absolute; left: 6px; right: 6px; bottom: 4px; font-size: 12px; line-height: 1.2; max-height: 2.4em; overflow: hidden; text-align: center; white-space: normal; color: #c8d3e0; pointer-events: none; }
.wire.phone .el .cap { color: #5f6368; }
/* griglia PIN presunta (tastiere disegnate dalle app, invisibili all'accessibilità) */
.wire .pgrid { position: absolute; display: flex; flex-direction: column; border: 2px dashed #e8a200; border-radius: 10px; background: rgba(232,162,0,.06); z-index: 20; pointer-events: auto; box-sizing: border-box; }
.wire .pgrid .prow { display: flex; flex: 1 1 0; }
.wire .pgrid .pc { display: flex; align-items: center; justify-content: center; min-width: 0; border: 1px dashed rgba(232,162,0,.55); color: #b87400; font-size: 18px; font-weight: 600; cursor: pointer; }
.wire .pgrid .pc:hover { background: rgba(232,162,0,.28); }
.wire .pgrid .ph { position: absolute; left: 0; right: 0; top: -22px; height: 20px; background: #e8a200; color: #fff; font-size: 12px; font-weight: 600; border-radius: 6px 6px 0 0; display: flex; align-items: center; justify-content: center; cursor: move; user-select: none; }
.wire .pgrid .pr { position: absolute; right: -7px; bottom: -7px; width: 18px; height: 18px; background: #e8a200; border-radius: 4px; cursor: nwse-resize; }
.wire .pgrid.kbd .pc { font-size: 14px; }
