/* LAN Control — Social chats: Messenger, Instagram, TikTok, YouTube and X layouts (public/lan-social-chat.js) */
.sx { --bg:#fff; --side:#fff; --ink:#050505; --sub:#65676b; --line:#e4e6eb; --hover:#f2f2f2; --active:#ebf5ff; --search:#f0f2f5;
  --in:#e4e6eb; --in-ink:#050505; --out:#0084ff; --out2:#0084ff; --out-ink:#fff; --accent:#0866ff; --radius:18px; --font:inherit;
  display:flex; height:calc(100dvh - var(--hdr, 50px)); background:var(--bg); color:var(--ink); font-size:14.5px; overflow:hidden; font-family:var(--font); }
@media (min-width: 821px) { .col > main.full > .chat-host .sx { height:100%; } }
.sx * { box-sizing:border-box; }
.sx button { font:inherit; color:inherit; background:none; border:0; cursor:pointer; padding:0; }
.sx svg { width:20px; height:20px; display:block; flex:none; }
.sx [hidden] { display:none !important; }

/* Messenger (default) — light and dark */
@media (prefers-color-scheme: dark) { .sx-messenger { --bg:#242526; --side:#242526; --ink:#e4e6eb; --sub:#b0b3b8; --line:#3e4042; --hover:#3a3b3c; --active:#263951; --search:#3a3b3c; --in:#303030; --in-ink:#e4e6eb; } }
.sx-messenger { --out:#0a7cff; --out2:#a033ff; }
.sx-messenger .sx-m.out .sx-b { background:linear-gradient(180deg, #0a7cff, #6b3cff 180%); background-attachment:fixed; }

/* Instagram */
.sx-instagram { --bg:#fff; --side:#fff; --ink:#000; --sub:#737373; --line:#dbdbdb; --hover:#fafafa; --active:#efefef; --search:#efefef; --in:#efefef; --in-ink:#000; --out:#3797f0; --out2:#a033ff; --accent:#0095f6; --radius:22px; }
@media (prefers-color-scheme: dark) { .sx-instagram { --bg:#000; --side:#000; --ink:#f5f5f5; --sub:#a8a8a8; --line:#262626; --hover:#121212; --active:#262626; --search:#262626; --in:#262626; --in-ink:#f5f5f5; } }
.sx-instagram .sx-m.out .sx-b { background:linear-gradient(180deg, #a033ff 0%, #6c5cf5 40%, #3797f0 100%); background-attachment:fixed; }
.sx-instagram .sx-comp { border:1px solid var(--line); border-radius:22px; margin:10px 16px 14px; padding:4px 6px; }
.sx-instagram .sx-comp textarea { background:none; }

/* TikTok */
.sx-tiktok { --bg:#121212; --side:#121212; --ink:#fff; --sub:rgba(255,255,255,.55); --line:rgba(255,255,255,.12); --hover:rgba(255,255,255,.06); --active:rgba(255,255,255,.1);
  --search:rgba(255,255,255,.1); --in:#2f2f2f; --in-ink:#fff; --out:#fe2c55; --out-ink:#fff; --accent:#fe2c55; --radius:8px; }
.sx-tiktok .sx-sh h1::after { content:""; display:inline-block; width:8px; height:8px; margin-left:8px; border-radius:50%; background:#25f4ee; box-shadow:3px 0 0 #fe2c55; vertical-align:middle; }

/* YouTube — comments */
.sx-youtube { --bg:#fff; --side:#fff; --ink:#0f0f0f; --sub:#606060; --line:#e5e5e5; --hover:#f2f2f2; --active:#f2f2f2; --search:#f2f2f2; --accent:#065fd4; --radius:12px; }
@media (prefers-color-scheme: dark) { .sx-youtube { --bg:#0f0f0f; --side:#0f0f0f; --ink:#f1f1f1; --sub:#aaa; --line:#303030; --hover:#272727; --active:#272727; --search:#272727; --accent:#3ea6ff; } }
.sx-youtube .sx-sh h1::before { content:""; display:inline-block; width:22px; height:15px; border-radius:4px; background:#f00; margin-right:8px; vertical-align:-1px;
}

/* X */
.sx-x { --bg:#000; --side:#000; --ink:#e7e9ea; --sub:#71767b; --line:#2f3336; --hover:#080808; --active:#16181c; --search:#202327; --in:#2f3336; --in-ink:#e7e9ea; --out:#1d9bf0; --out-ink:#fff; --accent:#1d9bf0; --radius:22px; }
.sx-x .sx-m .sx-b { border-radius:22px 22px 22px 22px; }
.sx-x .sx-m.in.last .sx-b { border-bottom-left-radius:4px; }
.sx-x .sx-m.out.last .sx-b { border-bottom-right-radius:4px; }

/* List */
.sx-side { width:30%; min-width:320px; max-width:420px; display:flex; flex-direction:column; border-right:1px solid var(--line); background:var(--side); }
.sx-sh { display:flex; align-items:center; gap:6px; padding:14px 12px 8px 16px; }
.sx-sh h1 { flex:1; margin:0; font-size:24px; font-weight:700; letter-spacing:-.01em; }
.sx-ib { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; color:var(--ink); background:var(--search) !important; }
.sx-ib:hover { filter:brightness(.95); }
.sx-ib:disabled { opacity:.4; cursor:default; }
.sx-ib.spin svg { animation:sxspin .9s linear infinite; }
@keyframes sxspin { to { transform:rotate(360deg); } }
.sx-search { display:flex; align-items:center; gap:8px; margin:4px 16px 8px; padding:0 12px; height:36px; border-radius:999px; background:var(--search); color:var(--sub); }
.sx-search input { flex:1; border:0; outline:0; background:none; color:var(--ink); font:inherit; min-width:0; }
.sx-filters { display:flex; gap:6px; padding:2px 16px 8px; }
.sx-filters button { padding:6px 12px; border-radius:999px; font-size:13.5px; font-weight:600; color:var(--sub); }
.sx-filters button.on { background:var(--active); color:var(--accent); }
.sx-tiktok .sx-filters button.on, .sx-x .sx-filters button.on { color:var(--ink); }
.sx-note { margin:0 16px 8px; padding:8px 10px; border-radius:10px; font-size:12.5px; line-height:1.45; color:var(--sub); background:var(--search); }
.sx-note.bad { color:#e5484d; }
.sx-list { flex:1; overflow-y:auto; padding:0 8px 8px; }
.sx-row { display:flex; align-items:center; gap:12px; width:100%; padding:8px; border-radius:10px; text-align:left; }
.sx-row:hover { background:var(--hover); }
.sx-row.on { background:var(--active); }
.sx-row:disabled { opacity:.5; cursor:default; }
.sx-rt { flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.sx-rn { font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sx-rs { font-size:13px; color:var(--sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sx-rs i { font-style:normal; }
.sx-row.unread .sx-rn, .sx-row.unread .sx-rs { font-weight:700; color:var(--ink); }
.sx-rm { display:flex; flex-direction:column; align-items:flex-end; gap:6px; font-size:12px; color:var(--sub); }
.sx-dot { width:10px; height:10px; border-radius:50%; background:var(--accent); display:block; }
.sx-lock svg { width:14px; height:14px; opacity:.6; }
.sx-empty { padding:40px 16px; text-align:center; color:var(--sub); }

/* Avatars */
.sx-av { position:relative; flex:none; border-radius:50%; overflow:hidden; display:grid; place-items:center; }
.sx-av.m { width:48px; height:48px; } .sx-av.s { width:28px; height:28px; font-size:11px; }
.sx-av b { width:100%; height:100%; display:grid; place-items:center; font-weight:600; color:#fff; background:hsl(var(--h) 45% 48%); }
.sx-av img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.sx-av.ghost { visibility:hidden; }
.sx-instagram .sx-av.m { box-shadow:0 0 0 2px var(--bg), 0 0 0 4px #d6249f; margin:3px; }

/* Thread */
.sx-main { flex:1; min-width:0; display:flex; flex-direction:column; background:var(--bg); }
.sx-th { display:flex; align-items:center; gap:10px; padding:10px 16px; border-bottom:1px solid var(--line); min-height:64px; }
.sx-th .sx-av.m { width:40px; height:40px; }
.sx-tt { flex:1; min-width:0; display:flex; flex-direction:column; }
.sx-tt b { font-size:16px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sx-tt span { font-size:12.5px; color:var(--sub); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.sx-back { display:none; }
.sx-msgs { flex:1; overflow-y:auto; padding:16px 16px 8px; display:flex; flex-direction:column; gap:2px; }
.sx-time { align-self:center; font-size:12px; color:var(--sub); margin:14px 0 8px; font-weight:500; }
.sx-m { display:flex; align-items:flex-end; gap:8px; max-width:72%; }
.sx-m.in { align-self:flex-start; } .sx-m.out { align-self:flex-end; flex-direction:column; align-items:flex-end; }
.sx-b { position:relative; padding:8px 12px; border-radius:var(--radius); line-height:1.4; white-space:pre-wrap; word-wrap:break-word; overflow-wrap:anywhere; }
.sx-m.in .sx-b { background:var(--in); color:var(--in-ink); }
.sx-m.out .sx-b { background:var(--out); color:var(--out-ink, #fff); }
.sx-m.in:not(.first) .sx-b { border-top-left-radius:4px; } .sx-m.in:not(.last) .sx-b { border-bottom-left-radius:4px; }
.sx-m.out:not(.first) .sx-b { border-top-right-radius:4px; } .sx-m.out:not(.last) .sx-b { border-bottom-right-radius:4px; }
.sx-x .sx-m .sx-b { border-radius:22px; }
.sx-img { display:block; max-width:240px; max-height:260px; border-radius:12px; margin:-4px -8px 4px; }
.sx-file { display:block; text-decoration:underline; color:inherit; }
.sx-aim { font-style:normal; font-size:9.5px; font-weight:700; letter-spacing:.04em; margin-left:6px; opacity:.75; }
.sx-st, .sx-fail { font-size:11.5px; color:var(--sub); margin:2px 4px 0; }
.sx-fail { color:#e5484d; cursor:help; }

/* YouTube comment thread */
.sx-msgs.yt { gap:18px; padding:20px 24px; }
.sx-c { display:flex; gap:12px; align-items:flex-start; }
.sx-c.reply { margin-left:52px; }
.sx-c .sx-av.s { width:40px; height:40px; font-size:14px; }
.sx-c.reply .sx-av.s { width:24px; height:24px; font-size:10px; }
.sx-ch { display:flex; gap:8px; align-items:baseline; font-size:13px; }
.sx-ch b { font-weight:500; } .sx-ch time { color:var(--sub); font-size:12px; }
.sx-tag { background:var(--search); color:var(--sub); border-radius:999px; padding:1px 8px; font-size:11px; }
.sx-c p { margin:4px 0 0; line-height:1.45; white-space:pre-wrap; }
.sx-c.me .sx-ch b { background:var(--sub); color:var(--bg); padding:0 6px; border-radius:999px; }

/* Reply window, AI note, composer */
.sx-win { display:flex; align-items:center; gap:8px; margin:0 16px; padding:6px 10px; font-size:12px; color:var(--sub); border-radius:8px; }
.sx-win svg { width:14px; height:14px; }
.sx-win.warn { color:#b7791f; background:rgba(245,166,35,.12); }
.sx-win.bad { color:#e5484d; background:rgba(229,72,77,.1); }
.sx-ai { margin:6px 16px 0; padding:8px 10px; border-radius:8px; font-size:12.5px; background:var(--search); color:var(--sub); }
.sx-ai.warn { color:#b7791f; } .sx-ai.bad { color:#e5484d; }
.sx-comp { display:flex; align-items:flex-end; gap:8px; padding:10px 16px 14px; }
.sx-comp textarea { flex:1; resize:none; border:0; outline:0; font:inherit; color:var(--ink); background:var(--search); border-radius:20px; padding:9px 14px; min-height:38px; max-height:140px; line-height:1.4; }
.sx-comp textarea:disabled { opacity:.6; }
.sx-comp .sx-ib { background:none !important; color:var(--accent); }
.sx-aib svg { width:22px; height:22px; }
.sx-youtube .sx-comp { border-top:1px solid var(--line); }
.sx-youtube .sx-comp textarea { background:none; border-bottom:1px solid var(--line); border-radius:0; padding:8px 2px; }

/* Welcome */
.sx-welcome { margin:auto; text-align:center; max-width:420px; padding:24px; color:var(--sub); }
.sx-welcome h2 { color:var(--ink); font-size:22px; margin:12px 0 8px; }
.sx-welcome p { line-height:1.5; margin:0; }
.sx-wi { width:88px; height:88px; margin:0 auto; border-radius:50%; border:2px solid var(--ink); display:grid; place-items:center; font-size:38px; color:var(--ink); }

/* Channel switch in Communications → Chats (a .seg pill row, like the other page switches) */
.cx-seg button i { width:8px; height:8px; border-radius:50%; background:var(--c); display:block; flex:none; }
.cx-seg .n { font-style:normal; font-weight:600; font-size:11px; background:var(--accent, #4f46e5); color:#fff; border-radius:999px; padding:0 6px; line-height:16px; }

@media (max-width: 820px) {
  .sx-side { width:100%; max-width:none; min-width:0; border-right:0; }
  .sx-main { display:none; }
  .sx.open .sx-side { display:none; } .sx.open .sx-main { display:flex; }
  .sx-back { display:grid; }
  .sx-m { max-width:86%; }
}
