/* Crystal Messenger — grafica in stile anni 2000 (originale), impostazioni in stile moderno. */
:root {
  --t1: #3d95ff; --t2: #0a5ce6; --t3: #0049d6; --t4: #2a7af0; --tb: #0b3fa8; --tline: #002a8f;
  --b1: #f4f9ff; --b2: #d6e7fb; --acc: #2a64c8; --acc2: #ffb000; --ink: #1b2433; --muted: #5e6b80;
  --frame-on1: #b9f59b; --frame-on2: #2fa31f; --frame-busy1: #ffb1a3; --frame-busy2: #d0221a; --frame-away1: #ffe3a1; --frame-away2: #e08a00; --frame-off1: #eef0f4; --frame-off2: #9aa1b0;
  --ui: Tahoma, "Segoe UI", Verdana, "DejaVu Sans", Arial, sans-serif;
  --title: "Trebuchet MS", Tahoma, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="verde"] { --t1: #59c95a; --t2: #23962a; --t3: #167a1f; --t4: #3db544; --tb: #136b1b; --tline: #0c4d12; --b1: #f6fff3; --b2: #d7f2cf; --acc: #23862a; }
:root[data-theme="rosa"] { --t1: #ff8ec2; --t2: #e0408a; --t3: #c42572; --t4: #f06aa8; --tb: #a3195d; --tline: #7d1047; --b1: #fff6fa; --b2: #fbdbea; --acc: #c42572; }
:root[data-theme="viola"] { --t1: #b28cff; --t2: #7b46e0; --t3: #6230c4; --t4: #9a6af0; --tb: #4f2399; --tline: #3a1675; --b1: #faf7ff; --b2: #e6dcfb; --acc: #6a3bd0; }
:root[data-theme="arancio"] { --t1: #ffb35c; --t2: #f07a12; --t3: #d9620a; --t4: #ff9a35; --tb: #b04e05; --tline: #8a3b02; --b1: #fffaf3; --b2: #fde5c9; --acc: #d9620a; }
:root[data-theme="grafite"] { --t1: #8e9bb0; --t2: #4f5b70; --t3: #3a4456; --t4: #6c7a91; --tb: #2c3442; --tline: #1c222c; --b1: #f8f9fb; --b2: #dfe3ea; --acc: #3f4b60; }
:root[data-theme="oliva"] { --t1: #b7c76a; --t2: #7f912c; --t3: #69791f; --t4: #9aac45; --tb: #556316; --tline: #3f4a0e; --b1: #fbfcf3; --b2: #e8edcf; --acc: #69791f; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 13px/1.4 var(--ui); color: var(--ink); overflow: hidden; background-color: #6fa8e8;
  background-image: radial-gradient(ellipse 120% 60% at 20% 110%, #9fe08a 0 30%, transparent 31%), linear-gradient(180deg, #2c6fd6 0%, #67a5ee 45%, #b9dbfa 100%); background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(ellipse 60% 25% at 70% 20%, rgba(255,255,255,.45), transparent 70%), radial-gradient(ellipse 40% 14% at 25% 30%, rgba(255,255,255,.35), transparent 70%), radial-gradient(ellipse 90% 30% at 50% 120%, rgba(60,170,60,.55), transparent 70%); }
a { color: #0645ad; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.hp { position: absolute !important; left: -5000px; width: 1px; height: 1px; overflow: hidden; }
#app { position: relative; z-index: 1; height: 100%; }

/* ---------------------------------------------------------------- finestre */
.xwin { background: linear-gradient(180deg, var(--b1), var(--b2)); border: 1px solid var(--tline); border-radius: 8px 8px 3px 3px; box-shadow: 0 6px 22px rgba(0,20,70,.35), inset 0 0 0 1px rgba(255,255,255,.6); display: flex; flex-direction: column; overflow: hidden; }
.xwin-title { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 4px 0 7px; flex: none; color: #fff; font: bold 13px var(--title); text-shadow: 1px 1px 0 rgba(0,0,0,.45); user-select: none;
  background: linear-gradient(180deg, var(--t1) 0%, var(--t2) 12%, var(--t3) 55%, var(--t4) 92%, var(--t3) 100%); border-bottom: 1px solid var(--tline); cursor: default; touch-action: none; }
.app-win:not(.front) .xwin-title { filter: saturate(.55) brightness(1.12); }
.xwin-t { flex: 1; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.xwin-ic { display: inline-flex; } .xwin-ic img, .xwin-logo { width: 18px; height: 18px; }
.xwin-btns { display: flex; gap: 2px; }
.xbtn { width: 22px; height: 22px; border: 1px solid #fff; border-radius: 4px; padding: 0; position: relative; cursor: pointer; background: linear-gradient(180deg, #7fb2ff, #2263e6 60%, #3d7ef2); box-shadow: inset 0 0 2px rgba(0,0,0,.3); }
.xbtn:hover { filter: brightness(1.15); }
.x-close { background: linear-gradient(180deg, #ff9b80, #d9431c 60%, #e45a30); }
.x-close::before, .x-close::after { content: ""; position: absolute; left: 4px; right: 4px; top: 9px; height: 2.4px; background: #fff; border-radius: 1px; transform: rotate(45deg); }
.x-close::after { transform: rotate(-45deg); }
.x-min::before { content: ""; position: absolute; left: 5px; bottom: 5px; width: 8px; height: 3px; background: #fff; }
.x-max::before { content: ""; position: absolute; inset: 4px; border: 2px solid #fff; border-top-width: 3px; }
.xback { display: none; background: none; border: 0; padding: 0 4px 0 0; cursor: pointer; } .xback .ico { width: 20px; height: 20px; }
.xwin-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.xgrip { position: absolute; right: 0; bottom: 0; width: 14px; height: 14px; cursor: nwse-resize; background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,.25) 50% 58%, transparent 58% 70%, rgba(0,0,0,.25) 70% 78%, transparent 78%); touch-action: none; }
.app-win { position: absolute; min-width: 260px; min-height: 220px; }
.app-win.min { display: none; }
.app-win.max { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 40px) !important; border-radius: 0; }
.app-win.flash .xwin-title { animation: tflash 1s steps(2) 6; }
@keyframes tflash { 50% { background: linear-gradient(180deg, #ffd27a, #ff9d00 55%, #ffb733); } }
.shake { animation: shake .8s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake { 10%, 90% { transform: translate(-3px, 2px); } 20%, 80% { transform: translate(6px, -4px); } 30%, 50%, 70% { transform: translate(-10px, 5px); } 40%, 60% { transform: translate(10px, -5px); } }

/* ---------------------------------------------------------------- pulsanti, campi */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 74px; padding: 4px 12px; border: 1px solid #003c74; border-radius: 3px; cursor: pointer; text-decoration: none; color: #000;
  background: linear-gradient(180deg, #fff 0%, #f1efe6 60%, #dcd8c8 100%); box-shadow: inset 0 -1px 0 rgba(0,0,0,.08); font-size: 12px; }
.btn:hover { box-shadow: inset 0 0 0 2px #fbc76a, inset 0 -2px 0 #e69b1a; }
.btn:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
.btn.primary { border-color: #00317a; box-shadow: inset 0 0 0 1px #8fb6f5; font-weight: bold; }
.btn.danger { color: #a01010; }
.btn:disabled { color: #9a9a9a; border-color: #b9b9b9; cursor: default; box-shadow: none; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid #8fb6f5; border-top-color: #00317a; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.sm { min-width: 0; padding: 2px 8px; font-size: 11px; }
.btn.wide { width: 100%; padding: 6px; margin-top: 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: #0645ad; text-decoration: underline; cursor: pointer; font-size: inherit; }
input, select, textarea { font: inherit; border: 1px solid #7f9db9; background: #fff; color: #000; border-radius: 0; padding: 3px 5px; }
input:focus, select:focus, textarea:focus { outline: 1px solid #3c7fb1; }
input.bad, textarea.bad { outline: 2px solid #e0284c; }
.fld { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; font-size: 12px; }
.fld > input, .fld > select, .fld textarea { width: 100%; padding: 5px 6px; }
.chk { display: flex; align-items: flex-start; gap: 6px; margin: 6px 0; font-size: 12px; cursor: pointer; }
.chk input { margin-top: 2px; }
.hint { font-size: 11px; color: var(--muted); margin: 4px 0; } .hint.warn { color: #8a4a00; }
.note { background: #fffbe0; border: 1px solid #e7d27a; padding: 7px 9px; font-size: 12px; margin: 6px 0; }
.note.ok { background: #eaffea; border-color: #8fd18f; }
.form-err { background: #ffeaea; border: 1px solid #e08a8a; color: #8a0000; padding: 6px 9px; margin: 6px 0; font-size: 12px; }
.ico { width: 20px; height: 20px; vertical-align: middle; flex: none; } .ico.sm { width: 16px; height: 16px; } .ico.md { width: 28px; height: 28px; } .ico.lg { width: 32px; height: 32px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* cornice dell'immagine personale: colore secondo lo stato */
.frame { display: inline-block; padding: 4px; border-radius: 9px; background: linear-gradient(160deg, var(--frame-off1), var(--frame-off2)); box-shadow: 0 1px 3px rgba(0,0,0,.35), inset 0 1px 1px #fff; border: 0; line-height: 0; flex: none; }
.frame img { width: 48px; height: 48px; border-radius: 5px; object-fit: cover; background: #fff; border: 1px solid rgba(0,0,0,.25); }
.frame.big img { width: 84px; height: 84px; } .frame.sm { padding: 2px; border-radius: 5px; } .frame.sm img { width: 26px; height: 26px; border-radius: 3px; }
.frame.st-on { background: linear-gradient(160deg, var(--frame-on1), var(--frame-on2)); }
.frame.st-busy { background: linear-gradient(160deg, var(--frame-busy1), var(--frame-busy2)); }
.frame.st-away { background: linear-gradient(160deg, var(--frame-away1), var(--frame-away2)); }
button.frame { cursor: pointer; }

/* ---------------------------------------------------------------- accesso e registrazione */
.auth-desk { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px; overflow: auto; height: 100%; }
.auth-win { width: 100%; max-width: 380px; flex: none; }
.auth-win.reg-win { max-width: 440px; }
.auth-body { padding: 12px 16px 16px; }
.auth-body h1 { font: bold 20px var(--title); color: var(--tb); margin: 4px 0 8px; }
.auth-body ul { padding-left: 18px; }
.signin-pic { text-align: center; margin: 4px 0 10px; }
.status-sel { display: flex; align-items: center; gap: 4px; } .status-sel img { width: 16px; } .status-sel select { flex: 1; padding: 4px; }
.links { text-align: center; font-size: 12px; margin: 10px 0 0; line-height: 1.8; }
.auth-foot { margin-top: 14px; font-size: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); text-align: center; }
.auth-foot a { color: #fff; }
.code-steps ol { padding-left: 20px; margin: 6px 0; font-size: 12px; }
.code-in { font: bold 26px/1 "Courier New", monospace; letter-spacing: 8px; text-align: center; padding: 8px !important; }
.big-code { font: bold 44px/1.1 "Courier New", monospace; letter-spacing: 6px; text-align: center; color: var(--tb); background: #fff; border: 2px dashed #7f9db9; padding: 14px; margin: 10px 0; user-select: all; }
.spinner-box { text-align: center; padding: 20px; } .spin-gem { width: 64px; animation: spin 2.4s linear infinite; }
.pw-wrap { display: flex; } .pw-wrap input { flex: 1; } .pw-eye { border: 1px solid #7f9db9; border-left: 0; background: #f4f4f4; cursor: pointer; padding: 0 8px; }
.pw-meter { height: 6px; background: #dde3ec; border: 1px solid #b9c3d3; margin: 3px 0; }
.pw-bar { display: block; height: 100%; width: 0; transition: width .2s; } .pw-bar.weak { background: #d9431c; } .pw-bar.mid { background: #f0a000; } .pw-bar.strong { background: #2fa31f; }
.pw-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 8px; font-size: 11px; color: var(--muted); }
.pw-rules .ok { color: #1d7a22; } .pw-rules .bad { color: #b00; font-weight: bold; grid-column: 1 / -1; }
.pw-match { font-size: 11px; min-height: 14px; } .pw-match.ok { color: #1d7a22; } .pw-match.bad { color: #b00; }
.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.seo h1 { margin-top: 0; }

/* ---------------------------------------------------------------- scrivania e barra in basso */
.desk { position: absolute; inset: 0 0 40px 0; overflow: hidden; }
#taskbar { position: fixed; left: 0; right: 0; bottom: 0; height: 40px; display: flex; align-items: center; gap: 4px; padding: 0 4px; z-index: 50000;
  background: linear-gradient(180deg, #4c8df5 0%, var(--t2) 8%, var(--t3) 50%, var(--t2) 92%, var(--tline) 100%); border-top: 1px solid rgba(255,255,255,.4); }
.tb-start { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 16px 0 8px; border: 1px solid rgba(255,255,255,.55); border-radius: 16px; cursor: pointer; color: #fff; font: italic bold 15px var(--title); text-shadow: 1px 1px 1px rgba(0,0,0,.5);
  background: linear-gradient(180deg, #9cd2ff, #2f8fe8 45%, #1564c8 55%, #3d9af0); box-shadow: inset 0 0 3px rgba(0,0,0,.25); }
.tb-start img { width: 24px; height: 24px; }
#taskbar-wins { flex: 1; display: flex; gap: 3px; overflow: hidden; }
.tb-btn { display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 180px; flex: 0 1 180px; height: 30px; padding: 0 8px; border-radius: 3px; border: 1px solid rgba(0,0,0,.3); color: #fff; cursor: pointer; font-size: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.12)); text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.tb-btn.on { background: linear-gradient(180deg, rgba(0,0,0,.25), rgba(0,0,0,.1)); box-shadow: inset 0 1px 3px rgba(0,0,0,.5); }
.tb-btn.flash { animation: tbflash 1s steps(2) infinite; }
@keyframes tbflash { 50% { background: linear-gradient(180deg, #ffd27a, #f59a00); color: #3a2000; text-shadow: none; } }
.tb-ic img { width: 16px; height: 16px; display: block; } .tb-t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-tray { display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 12px; color: #fff; font-size: 12px; background: linear-gradient(180deg, #1aa1f0, #0c7fd8); border-left: 1px solid rgba(0,0,0,.3); }
.net-dot { width: 10px; height: 10px; border-radius: 50%; background: #f0a000; box-shadow: 0 0 3px #000; } .net-dot.ok { background: #3fdf3f; }

/* ---------------------------------------------------------------- finestra dei contatti */
.clist-body { background: linear-gradient(180deg, #fff, var(--b1)); }
.menubar { display: flex; flex: none; background: #f3f6fb; border-bottom: 1px solid #c9d4e4; padding: 1px 2px; }
.menubar button { background: none; border: 1px solid transparent; padding: 2px 7px; cursor: pointer; font-size: 12px; }
.menubar button:hover { background: #316ac5; color: #fff; }
.me-panel { display: flex; gap: 8px; align-items: center; padding: 8px; flex: none; background: linear-gradient(180deg, var(--b2), var(--b1)); border-bottom: 1px solid #c6d6ec; }
.me-panel .frame img { width: 56px; height: 56px; }
.me-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-name { text-align: left; background: none; border: 1px solid transparent; padding: 1px 3px; cursor: pointer; font-weight: bold; font-size: 14px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #000; }
.me-name:hover { border-color: #7f9db9; background: #fff; } .me-name .st { font-weight: normal; color: var(--muted); font-size: 12px; }
.me-name .emo { width: 18px; height: 18px; }
.me-psm { border: 1px solid transparent; background: transparent; font-size: 12px; color: #444; padding: 2px 3px; }
.me-psm:hover, .me-psm:focus { border-color: #7f9db9; background: #fff; }
.list-tools { display: flex; gap: 4px; align-items: center; padding: 5px 6px; flex: none; border-bottom: 1px solid #dbe4f1; background: #f7faff; }
.srch { flex: 1; display: flex; align-items: center; gap: 3px; border: 1px solid #7f9db9; background: #fff; padding: 0 4px; }
.srch input { border: 0; flex: 1; min-width: 0; outline: 0; padding: 4px 2px; }
.tool-btn { background: none; border: 1px solid transparent; border-radius: 3px; padding: 2px; cursor: pointer; display: flex; }
.tool-btn:hover { border-color: #7f9db9; background: linear-gradient(#fff, #e6eefb); }
.requests:empty { display: none; }
.req { display: flex; gap: 8px; padding: 8px; background: #fffbe0; border-bottom: 1px solid #e7d27a; font-size: 12px; }
.req .ico { width: 36px; height: 36px; border-radius: 4px; } .req-btns { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.clist { flex: 1; overflow: auto; padding: 4px 0 10px; }
.grp-h { display: flex; align-items: center; gap: 4px; width: 100%; text-align: left; background: none; border: 0; padding: 4px 8px; font-weight: bold; color: #1f3f86; cursor: pointer; font-size: 12px; }
.grp-h.static { cursor: default; } .grp-h:hover { text-decoration: underline; } .tw { font-size: 9px; width: 10px; }
.crow { display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 20px; cursor: pointer; border: 1px solid transparent; white-space: nowrap; overflow: hidden; font-size: 12px; user-select: none; }
.crow:hover, .crow:focus { background: #e3efff; border-color: #9fc0ef; outline: 0; }
.crow .st-ic { width: 16px; height: 16px; } .crow .cname { overflow: hidden; text-overflow: ellipsis; flex: none; max-width: 70%; }
.crow .cname .emo, .crow .cpsm .emo { width: 16px; height: 16px; }
.crow .cpsm, .crow .cst { color: #7a8597; overflow: hidden; text-overflow: ellipsis; font-style: italic; flex: 1 1 auto; min-width: 0; }
.crow .cst { flex: none; font-style: normal; }
.crow.off .cname { color: #6b7385; } .crow.unread .cname { font-weight: bold; }
.badge { margin-left: auto; background: #e0284c; color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11px; font-weight: bold; flex: none; }
.empty-list { text-align: center; padding: 20px 14px; }
.list-foot { flex: none; padding: 5px 8px; font-size: 11px; color: var(--muted); border-top: 1px solid #dbe4f1; background: #f7faff; }

/* ---------------------------------------------------------------- menu */
.xmenu { position: fixed; background: #fff; border: 1px solid #8d8d8d; box-shadow: 2px 3px 6px rgba(0,0,0,.35); padding: 2px; min-width: 190px; max-height: 80vh; overflow: auto; }
.xmenu button { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; padding: 4px 14px 4px 4px; text-align: left; cursor: pointer; font-size: 12px; }
.xmenu button:hover, .xmenu button:focus { background: #316ac5; color: #fff; outline: 0; }
.xmenu button:disabled { color: #999; background: none; }
.xmenu button.chk span::before { content: "✔ "; } .xmenu button.danger { color: #b00; } .xmenu button.danger:hover { color: #fff; }
.xmenu hr { border: 0; border-top: 1px solid #ccc; margin: 2px 2px; }
.xpop { position: fixed; z-index: 99998; background: #fff; border: 1px solid #7f9db9; box-shadow: 2px 3px 8px rgba(0,0,0,.35); padding: 4px; }
.emo-pop { display: grid; grid-template-columns: repeat(8, 32px); gap: 2px; }
.emo-pop button, .rx-pop button { width: 32px; height: 32px; border: 1px solid transparent; background: none; cursor: pointer; padding: 3px; }
.emo-pop button:hover, .rx-pop button:hover { border-color: #316ac5; background: #e3efff; }
.emo-pop img { width: 24px; height: 24px; } .rx-pop { display: flex; } .rx-pop button { font-size: 18px; }
.wink-pop { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3px; width: 300px; }
.wink-pop button { display: flex; align-items: center; gap: 6px; border: 1px solid #dbe4f1; background: linear-gradient(#fff, #eef4fc); padding: 6px; cursor: pointer; font-size: 12px; text-align: left; }
.wink-pop button:hover { border-color: #316ac5; }
.wk { width: 22px; height: 22px; border-radius: 4px; flex: none; background: linear-gradient(135deg, #ff7aa2, #ffd21f); }
.wk-bacio { background: radial-gradient(circle at 50% 60%, #e0103a 40%, #ffd0dc 42%); } .wk-fuochi { background: radial-gradient(circle, #ffd21f 10%, #e0284c 30%, #1b2350 60%); }
.wk-torta { background: linear-gradient(#ff7ab0 40%, #f7d6a8 40%); } .wk-stelle { background: radial-gradient(circle at 70% 30%, #ffd21f 20%, #1b2350 22%); }
.wk-risata { background: radial-gradient(circle, #ffd21f 60%, #b77800 62%); } .wk-fiori { background: radial-gradient(circle, #ffd21f 22%, #ff6fa8 24%); } .wk-coriandoli { background: conic-gradient(#e0284c, #ffd21f, #3fae49, #2a7bd0, #b98cff, #e0284c); }

/* ---------------------------------------------------------------- conversazione */
.chat { background: linear-gradient(180deg, var(--b1), var(--b2)); }
.chat-tools { display: flex; gap: 2px; padding: 4px 6px; flex: none; background: linear-gradient(180deg, #fff, var(--b2)); border-bottom: 1px solid #b9cbe4; overflow-x: auto; }
.chat-tools button { display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 58px; padding: 3px 4px; background: none; border: 1px solid transparent; border-radius: 3px; cursor: pointer; font-size: 11px; color: #1f3f86; }
.chat-tools button:hover { border-color: #9fc0ef; background: linear-gradient(#fff, #e3efff); }
.chat-to { flex: none; padding: 5px 9px; font-size: 12px; border-bottom: 1px solid #c6d6ec; background: #fff; }
.chat-to .mail { color: var(--muted); } .chat-to .psm { color: #555; font-style: italic; margin-top: 1px; } .chat-to .psm .emo { width: 16px; height: 16px; }
.st-on { color: #1d7a22; } .st-busy { color: #c62f2f; } .st-away { color: #b36b00; } .st-off { color: #777; }
.key-warn { background: #fff4d6; border: 1px solid #f0c060; padding: 4px 6px; margin-top: 4px; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.chat-search { flex: none; display: flex; gap: 6px; align-items: center; padding: 4px 8px; background: #fffbe0; border-bottom: 1px solid #e7d27a; } .chat-search input { flex: 1; }
.chat-main { flex: 1; min-height: 0; display: flex; gap: 8px; padding: 8px; }
.chat-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; position: relative; }
.chat-log { flex: 1; min-height: 80px; overflow-y: auto; background: #fff; border: 1px solid #7f9db9; padding: 6px 10px; font-size: 13px; word-wrap: break-word; position: relative; }
.chat-side { width: 108px; flex: none; display: flex; flex-direction: column; justify-content: space-between; align-items: center; gap: 8px; }
.chat-side .members { display: flex; flex-direction: column; gap: 5px; width: 100%; overflow: auto; font-size: 11px; }
.chat-side .mem { display: flex; align-items: center; gap: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.typing-line { min-height: 16px; font-size: 11px; color: var(--muted); font-style: italic; flex: none; }
.fmt-bar { display: flex; gap: 2px; align-items: center; flex: none; }
.fmt-bar button { background: none; border: 1px solid transparent; border-radius: 3px; padding: 2px 3px; cursor: pointer; display: flex; }
.fmt-bar button:hover { border-color: #9fc0ef; background: linear-gradient(#fff, #e3efff); }
.e2e-badge { margin-left: auto; font-size: 11px; color: #1d7a22; display: flex; align-items: center; gap: 2px; }
.reply-box { flex: none; display: flex; gap: 6px; justify-content: space-between; font-size: 11px; background: #eef4fc; border-left: 3px solid var(--acc); padding: 3px 6px; }
.compose { display: flex; gap: 6px; flex: none; }
.compose textarea { flex: 1; resize: none; min-height: 52px; font-size: 13px; }
.send-btn { min-width: 64px; align-self: stretch; font-weight: bold; }
.voice-bar { display: flex; gap: 6px; align-items: center; font-size: 12px; background: #fff0f0; border: 1px solid #f0b0b0; padding: 4px 8px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: #e0103a; animation: blink 1s steps(2) infinite; } @keyframes blink { 50% { opacity: .2; } }
.chat-status { flex: none; font-size: 11px; color: var(--muted); padding: 2px 9px 4px; border-top: 1px solid #c6d6ec; min-height: 20px; }
.chat.drop .chat-log { outline: 3px dashed var(--acc); }
.m-day { text-align: center; margin: 10px 0 6px; font-size: 11px; color: #7a8597; } .m-day span { background: #f0f4fa; border: 1px solid #dbe4f1; border-radius: 9px; padding: 1px 10px; }
.m-who { color: #6b6b6b; margin-top: 6px; font-size: 12px; } .m-time { color: #9aa1b0; font-size: 11px; }
.m-line { position: relative; padding: 1px 26px 1px 14px; border-radius: 3px; }
.m-line:hover { background: rgba(49,106,197,.06); }
.m-txt { white-space: pre-wrap; } .m-txt.b { font-weight: bold; } .m-txt.i { font-style: italic; }
.emo { width: 19px; height: 19px; vertical-align: -4px; }
.m-act { position: absolute; right: 0; top: 0; border: 0; background: none; cursor: pointer; opacity: 0; font-size: 16px; line-height: 1; padding: 0 5px; color: #555; }
.m-line:hover .m-act, .m-act:focus { opacity: 1; }
.m-sys { color: #6b6b6b; font-size: 12px; margin: 6px 0; font-style: italic; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; } .m-sys.nudge { color: #b35a00; font-style: normal; font-weight: bold; }
.m-del { color: #8a8a8a; }
.m-ed { color: #9aa1b0; }
.m-quote { font-size: 11px; color: #555; border-left: 3px solid #b9cbe4; padding: 0 6px; margin: 2px 0; background: #f6f9fd; }
.m-react { display: flex; gap: 3px; margin: 2px 0; } .rx { border: 1px solid #dbe4f1; background: #f6f9fd; border-radius: 10px; padding: 0 6px; cursor: pointer; font-size: 12px; } .rx.mine { border-color: var(--acc); background: #e3efff; }
.m-state { display: block; font-size: 10px; color: #8a93a3; text-align: right; } .m-state.bad { color: #b00; }
.m-file { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #c6d6ec; background: #f6f9fd; padding: 6px 8px; border-radius: 4px; margin: 2px 0; }
.m-img { display: inline-flex; flex-direction: column; gap: 2px; margin: 3px 0; } .m-img .cap { font-size: 11px; color: var(--muted); }
.thumb { max-width: min(280px, 100%); max-height: 240px; border: 1px solid #c6d6ec; border-radius: 3px; cursor: zoom-in; background: #f0f0f0; min-width: 60px; min-height: 40px; }
.m-voice { display: inline-flex; flex-direction: column; gap: 3px; } .m-voice audio { height: 34px; max-width: 260px; }
.m-more, .m-empty { text-align: center; padding: 8px; font-size: 12px; color: var(--muted); }
.up-prog { font-size: 11px; color: var(--muted); display: flex; gap: 6px; align-items: center; padding: 4px 14px; }
.wink-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.ff-segoe { font-family: var(--ui); } .ff-tahoma { font-family: Tahoma, Verdana, sans-serif; } .ff-verdana { font-family: Verdana, "DejaVu Sans", sans-serif; }
.ff-comic { font-family: "Comic Sans MS", "Comic Neue", "Chalkboard SE", cursive; } .ff-times { font-family: "Times New Roman", Times, serif; } .ff-courier { font-family: "Courier New", Courier, monospace; }
.ff-georgia { font-family: Georgia, serif; } .ff-trebuchet { font-family: "Trebuchet MS", sans-serif; }
/* sfondi della conversazione (disegnati con i gradienti, originali) */
.scene-cielo { background: radial-gradient(ellipse 30% 9% at 20% 18%, #fff 60%, transparent 62%), radial-gradient(ellipse 22% 7% at 70% 30%, #fff 60%, transparent 62%), linear-gradient(#bfe3ff, #f2f9ff) fixed; }
.scene-mare { background: linear-gradient(180deg, #e9f8ff 0 55%, #9fdcff 55%, #4fb2e8 100%); }
.scene-prato { background: radial-gradient(ellipse 120% 40% at 50% 115%, #8fd46a 60%, transparent 61%), linear-gradient(#e7f6ff, #fdfff4); }
.scene-tramonto { background: linear-gradient(180deg, #ffe7c2, #ffc6a0 45%, #ffd8e8); }
.scene-notte { background: radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent), radial-gradient(1.5px 1.5px at 70% 20%, #fff, transparent), radial-gradient(1px 1px at 40% 70%, #fff, transparent), radial-gradient(1.5px 1.5px at 85% 60%, #fff, transparent), linear-gradient(#1b2350, #3a2f6b); color: #f0f0ff; }
.scene-notte .m-who, .scene-notte .m-sys, .scene-notte .m-day { color: #cfd6ff; } .scene-notte a { color: #9fd0ff; }
.scene-bolle { background: radial-gradient(circle at 15% 25%, rgba(120,190,255,.25) 0 22px, transparent 23px), radial-gradient(circle at 75% 60%, rgba(120,190,255,.2) 0 36px, transparent 37px), radial-gradient(circle at 45% 85%, rgba(160,220,255,.25) 0 16px, transparent 17px), #fbfdff; }
.scene-cuori { background: radial-gradient(circle at 10% 20%, rgba(255,120,160,.18) 0 18px, transparent 19px), radial-gradient(circle at 85% 70%, rgba(255,120,160,.16) 0 28px, transparent 29px), #fff7fa; }
.scene-neve { background: radial-gradient(3px 3px at 20% 30%, #c9dcf2, transparent), radial-gradient(4px 4px at 60% 50%, #c9dcf2, transparent), radial-gradient(3px 3px at 80% 20%, #c9dcf2, transparent), linear-gradient(#f4f9ff, #fff); }

/* ---------------------------------------------------------------- dialoghi */
.dlg-back { position: fixed; inset: 0; background: rgba(0,25,70,.25); display: flex; align-items: center; justify-content: center; padding: 16px; }
.dlg { width: min(460px, 100%); max-height: 92vh; position: relative; background: #ece9d8; }
.dlg .xwin-title { cursor: default; } .dlg-body { padding: 12px 14px; overflow: auto; flex: 1; }
.dlg-btns { display: flex; gap: 8px; justify-content: flex-end; padding: 8px 12px 12px; flex-wrap: wrap; }
.dlg-msg { display: flex; gap: 12px; align-items: flex-start; } .dlg-msg p { margin: 4px 0; }
.big-ic { width: 32px; height: 32px; flex: none; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #4c9bf0 40%, #1f5fc4); }
.big-ic.ic-question::after { content: "?"; display: block; text-align: center; color: #fff; font: bold 22px/32px Arial; }
.big-ic.ic-info::after { content: "i"; display: block; text-align: center; color: #fff; font: bold italic 22px/32px Georgia; }
.pick-list { max-height: 50vh; overflow: auto; border: 1px solid #7f9db9; background: #fff; padding: 4px 8px; }
.viewer-dlg { width: min(900px, 100%); } .viewer { display: block; max-width: 100%; max-height: 75vh; margin: auto; }
.ink-dlg { width: min(620px, 100%); } .ink canvas { width: 100%; height: auto; border: 1px solid #7f9db9; background: #fff; touch-action: none; cursor: crosshair; }
.ink-tools { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.sw { width: 22px; height: 22px; border: 1px solid #555; cursor: pointer; padding: 0; } .sw.on { outline: 2px solid #316ac5; outline-offset: 1px; }
.swatches { display: grid; grid-template-columns: repeat(8, 24px); gap: 4px; margin: 8px 0; }
.font-prev { border: 1px solid #7f9db9; background: #fff; padding: 10px; font-size: 15px; margin-top: 6px; }
.av-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0; }
.av-grid button { border: 2px solid transparent; background: #fff; padding: 2px; cursor: pointer; border-radius: 6px; line-height: 0; } .av-grid button.on { border-color: #316ac5; }
.av-grid img { width: 100%; border-radius: 4px; }
.cinfo-top { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; } .cinfo h4 { margin: 10px 0 2px; display: flex; gap: 4px; align-items: center; }
.safety { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px 10px; font: bold 15px "Courier New", monospace; background: #fff; border: 1px solid #7f9db9; padding: 8px; text-align: center; }
.help p { margin: 6px 0; } .about { text-align: center; } .about h3 { margin: 4px 0; font-family: var(--title); color: var(--tb); }
#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 100000; display: flex; flex-direction: column; gap: 6px; width: min(440px, calc(100% - 32px)); }
.toast { background: #ffffe1; border: 1px solid #000; padding: 8px 12px; box-shadow: 2px 2px 6px rgba(0,0,0,.35); font-size: 12px; transition: opacity .4s; }
.toast.ok { background: #eaffea; } .toast.bad { background: #ffeaea; } .toast.out { opacity: 0; }

/* avvisi in basso a destra */
#notifs { position: fixed; right: 10px; bottom: 50px; z-index: 60000; display: flex; flex-direction: column; gap: 8px; }
.notif { width: 230px; cursor: pointer; animation: slideup .35s ease-out; } .notif.out { animation: slidedown .4s ease-in forwards; }
.notif .xwin-title { height: 24px; font-size: 11px; } .notif .xbtn { width: 18px; height: 18px; } .notif .x-close::before, .notif .x-close::after { top: 7px; }
.notif-b { display: flex; gap: 8px; align-items: center; padding: 10px; font-size: 12px; } .notif-b img { width: 40px; height: 40px; border-radius: 4px; border: 1px solid #9fb6d6; }
@keyframes slideup { from { transform: translateY(120%); opacity: 0; } } @keyframes slidedown { to { transform: translateY(120%); opacity: 0; } }

/* chiamate */
.call-ov { position: fixed; z-index: 70000; right: 20px; bottom: 60px; width: min(560px, calc(100% - 20px)); height: min(440px, calc(100% - 80px)); }
.call-body { flex: 1; position: relative; background: #0d1a33; display: flex; align-items: center; justify-content: center; min-height: 0; }
.call-remote { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #0d1a33; }
.call-body:not(.video) .call-remote, .call-body:not(.video) .call-local { opacity: 0; pointer-events: none; }
.call-local { position: absolute; right: 8px; bottom: 8px; width: 28%; max-width: 160px; border: 2px solid #fff; border-radius: 4px; background: #000; }
.call-who { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; color: #fff; text-shadow: 0 1px 2px #000; }
.call-body.video .call-who { position: absolute; top: 8px; left: 8px; flex-direction: row; } .call-body.video .call-who .frame { display: none; }
.call-btns { display: flex; justify-content: center; gap: 14px; padding: 10px; background: linear-gradient(#2a3550, #141c2e); }
.cbtn { width: 50px; height: 50px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); background: linear-gradient(#5b6b8a, #2c3650); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cbtn.red { background: linear-gradient(#ff6a5a, #c01a10); } .cbtn .ico { width: 26px; height: 26px; }
.call-in { position: fixed; z-index: 70001; right: 20px; bottom: 60px; width: 280px; animation: slideup .35s; } .call-in .xwin-body { padding: 12px; align-items: center; text-align: center; }

/* ---------------------------------------------------------------- impostazioni (stile moderno) */
.mset-back { position: fixed; inset: 0; z-index: 80000; background: rgba(10,20,40,.45); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.mset { width: min(880px, 100%); height: min(640px, 100%); background: #fff; color: #111827; border-radius: 16px; box-shadow: 0 24px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden; font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.mset header { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid #eef0f3; } .mset h2 { margin: 0; font-size: 18px; }
.mx { border: 0; background: #f1f3f6; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 14px; }
.mset-in { flex: 1; display: flex; min-height: 0; }
.mset nav { width: 220px; flex: none; padding: 10px; border-right: 1px solid #eef0f3; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.mset nav button { text-align: left; border: 0; background: none; padding: 9px 12px; border-radius: 9px; cursor: pointer; font-size: 14px; color: #374151; }
.mset nav button:hover { background: #f3f4f6; } .mset nav button.on { background: #e8f0fe; color: #1a56db; font-weight: 600; }
.mset-c { flex: 1; overflow: auto; padding: 18px 24px 30px; } .mset h3 { margin: 0 0 12px; font-size: 20px; } .mset h4 { margin: 0 0 8px; font-size: 15px; }
.card { border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; background: #fff; }
.card.info { background: #f8fafc; } .card.info p { margin: 6px 0; } .card.prof { display: flex; gap: 14px; align-items: center; } .card.prof img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; }
.muted { color: #6b7280; font-size: 13px; }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid #f1f3f6; cursor: pointer; } .sw-row:last-child { border-bottom: 0; }
.sw-row small { display: block; color: #6b7280; font-size: 12px; font-weight: normal; }
.sw-row input { appearance: none; width: 42px; height: 24px; border-radius: 12px; background: #d1d5db; position: relative; cursor: pointer; flex: none; border: 0; padding: 0; transition: background .2s; }
.sw-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .2s; }
.sw-row input:checked { background: #1a56db; } .sw-row input:checked::after { left: 21px; }
.m-fld { display: flex; flex-direction: column; gap: 4px; margin: 0 0 12px; font-size: 13px; color: #374151; }
.m-fld input, .m-fld select, .m-in, .mset textarea { border: 1px solid #d1d5db; border-radius: 9px; padding: 9px 11px; font: inherit; background: #fff; width: 100%; }
.mset .fld input, .mset .pw-wrap input { border-radius: 9px; padding: 9px 11px; border: 1px solid #d1d5db; }
.mset .pw-eye { border-radius: 0 9px 9px 0; border: 1px solid #d1d5db; border-left: 0; } .mset .pw-wrap input { border-radius: 9px 0 0 9px; }
.mbtn { border: 1px solid #d1d5db; background: #fff; border-radius: 9px; padding: 8px 14px; cursor: pointer; font: inherit; font-weight: 500; }
.mbtn:hover { background: #f9fafb; } .mbtn.primary { background: #1a56db; border-color: #1a56db; color: #fff; } .mbtn.primary:hover { background: #1e429f; }
.mbtn.danger { color: #c81e1e; border-color: #f8b4b4; } .mbtn.sm { padding: 5px 10px; font-size: 13px; }
.sess-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f3f6; } .sess-row.col { flex-direction: column; align-items: stretch; }
.sess-row form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; } .sess-row form textarea, .sess-row form input { flex: 1 1 200px; }
.pill { display: inline-block; background: #e8f0fe; color: #1a56db; border-radius: 99px; padding: 0 8px; font-size: 11px; font-weight: 600; } .pill.bad { background: #fde8e8; color: #c81e1e; }
.themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.th, .sc { display: flex; flex-direction: column; align-items: stretch; gap: 6px; border: 2px solid #e5e7eb; border-radius: 10px; padding: 6px; background: #fff; cursor: pointer; font-size: 12px; }
.th.on, .sc.on { border-color: #1a56db; } .th span, .sc span { display: block; height: 34px; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); }
.th-blu span { background: linear-gradient(#3d95ff, #0049d6); } .th-verde span { background: linear-gradient(#59c95a, #167a1f); } .th-rosa span { background: linear-gradient(#ff8ec2, #c42572); }
.th-viola span { background: linear-gradient(#b28cff, #6230c4); } .th-arancio span { background: linear-gradient(#ffb35c, #d9620a); } .th-grafite span { background: linear-gradient(#8e9bb0, #3a4456); } .th-oliva span { background: linear-gradient(#b7c76a, #69791f); }
.sc span { background: #fff; } .sc.scene-cielo, .sc.scene-mare, .sc.scene-prato, .sc.scene-tramonto, .sc.scene-notte, .sc.scene-bolle, .sc.scene-cuori, .sc.scene-neve { background: #fff; color: #111; }
.sc.scene-cielo span { background: linear-gradient(#bfe3ff, #f2f9ff); } .sc.scene-mare span { background: linear-gradient(#e9f8ff 50%, #4fb2e8 50%); } .sc.scene-prato span { background: linear-gradient(#e7f6ff 60%, #8fd46a 60%); }
.sc.scene-tramonto span { background: linear-gradient(#ffe7c2, #ffd8e8); } .sc.scene-notte span { background: linear-gradient(#1b2350, #3a2f6b); } .sc.scene-bolle span { background: radial-gradient(circle at 30% 40%, #bfe0ff 8px, #fbfdff 9px); }
.sc.scene-cuori span { background: radial-gradient(circle at 30% 40%, #ffc0d4 8px, #fff7fa 9px); } .sc.scene-neve span { background: radial-gradient(circle at 30% 40%, #c9dcf2 3px, #f4f9ff 4px); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.stats div { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px; text-align: center; } .stats b { display: block; font-size: 20px; } .stats small { color: #6b7280; }

/* ---------------------------------------------------------------- telefono */
@media (max-width: 899px) {
  .desk { bottom: 0; }
  #taskbar { display: none; }
  .app-win { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; border: 0; }
  .app-win .xwin-title { height: calc(44px + env(safe-area-inset-top)); padding-top: env(safe-area-inset-top); font-size: 15px; }
  .app-win .xback { display: inline-flex; } .list-win .xback { display: none; } .app-win .xwin-btns, .xgrip { display: none; }
  .chat-win .xwin-body { padding-bottom: env(safe-area-inset-bottom); }
  .chat-tools button { min-width: 50px; } .chat-tools button span { display: none; }
  .chat-side { display: none; } .chat-main { padding: 6px; }
  .compose textarea { font-size: 16px; min-height: 44px; }
  .crow { padding: 8px 10px 8px 22px; font-size: 14px; } .crow .st-ic { width: 18px; height: 18px; }
  .grp-h { padding: 8px 10px; font-size: 13px; }
  .list-foot { padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  #notifs { bottom: auto; top: calc(50px + env(safe-area-inset-top)); right: 8px; left: 8px; } .notif { width: auto; animation: none; } .call-ov { inset: 0; width: 100%; height: 100%; right: 0; bottom: 0; border-radius: 0; } .call-in { right: 8px; left: 8px; width: auto; bottom: 12px; }
  .mset-back { padding: 0; } .mset { height: 100%; border-radius: 0; }
  .mset-in { flex-direction: column; } .mset nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid #eef0f3; flex: none; }
  .mset nav button { white-space: nowrap; }
  input, select, textarea { font-size: 16px; }
  .emo-pop { grid-template-columns: repeat(7, 36px); } .emo-pop button { width: 36px; height: 36px; }
  .wink-pop { width: calc(100vw - 16px); }
}
@media (prefers-reduced-motion: reduce) { .shake, .notif, .tb-btn.flash, .app-win.flash .xwin-title, .spin-gem { animation: none !important; } }
