/* msg.mesh mobile — exact Windows XP Luna replica of the native client */
/* real TTFs from the native client (assets/fonts): ui text = "fs Tahoma 8px"
   (metrics_.ui_font), captions/dialogs = "Tahoma" */
@font-face{
  font-family:"fs Tahoma 8px";
  src:url("../assets/xp/fonts/fs-tahoma-8px.ttf") format("truetype");
  font-display:swap;
}
@font-face{
  font-family:"Tahoma";
  src:url("../assets/xp/fonts/tahoma.ttf") format("truetype");
  font-display:swap;
}
:root{
  --xp-bg:#d4dbe4;
  --xp-face:#d4dbe4;
  --xp-white:#fff;
  --xp-text:#000;
  --xp-dim:#595959;
  --xp-border:#788cac;
  --xp-title-a:#0a3caa;
  --xp-title-b:#3278dc;
  --xp-title-fg:#fff;
  --xp-accent:#3366cc;
  --xp-accent-dark:#1a5cc8;
  --xp-menu:#eaedf2;
  --xp-menu-bg:#eaedf2;
  --xp-toolbar-a:#eaedf2;
  --xp-toolbar-b:#d4dbe4;
  --xp-toolbar-line:#a0a6b2;
  --xp-sunken-light:#a0a6b2;
  --xp-btn-a:#3c81f3;
  --xp-btn-b:#1e6ee8;
  --xp-btn-border:#0847a2;
  --xp-send-a:#4a88f9;
  --xp-send-b:#0b5ef1;
  --xp-send-border:#043ca8;
  --xp-hl:#ccdffc;
  --xp-sel:#3366cc;
  --xp-online:#6eaf32;
  --xp-online-rim:#4a801e;
  --xp-offline:#a0a0a0;
  --xp-offline-rim:#787878;
  --xp-chat-self:#0a3caa;
  --xp-chat-other:#000;
  --xp-chat-ts:#969696;
  --xp-out-bg:#f2f6ff;
  --xp-group:#0a4092;
  --xp-badge:#c82828;
  --xp-error:#c43d3d;
  --xp-warn:#c89600;
  --xp-header:#2359b7;
  --xp-shadow-in:#a0a6b2;
  --xp-shadow-out:#fff;
  --xp-dark:#404040;
}
*{box-sizing:border-box}
html,body{margin:0;width:100%;height:100%;overflow:hidden}
body{
  background:linear-gradient(180deg,#0a3caa 0%,#3278dc 100%);
  color:var(--xp-text);
  font:13px/1.35 "fs Tahoma 8px","Tahoma","Segoe UI",Verdana,Geneva,sans-serif;
  -webkit-text-size-adjust:100%;
}
button,input,textarea{font:inherit;color:inherit}
button{cursor:pointer}
button:focus-visible,input:focus-visible,textarea:focus-visible,a:focus-visible{
  outline:2px solid var(--xp-accent,#0a5aba);outline-offset:1px;
}
.hidden{display:none!important}

/* reduced motion */
@media(prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;transition-duration:.01ms!important}
}

/* ---------- XP Luna scrollbars (pure CSS: the 15x88 sprite stretched to the
   thumb length deformed into stacked tiles; these colors come from the
   sprite pixels - white body, beige sunken track, blue-gray right bevel) ---------- */
::-webkit-scrollbar{width:16px;height:16px}
::-webkit-scrollbar-track{background:#fff;border-left:1px solid #eeede5;border-right:1px solid #c4c4af}
::-webkit-scrollbar-thumb{
  background:linear-gradient(90deg,#fff 0%,#fdfdfa 55%,#f0f0ea 80%,#e2e2d7 100%);
  border-top:1px solid #d8d8c8;border-bottom:1px solid #d8d8c8;
  box-shadow:inset -1px 0 0 #9fb5d2;
}
::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(90deg,#f2f7ff 0%,#e8f0fe 55%,#d9e6f8 80%,#cbd9ef 100%);
}
::-webkit-scrollbar:horizontal{height:16px}
::-webkit-scrollbar-track:horizontal{background:#fff;border-top:1px solid #eeede5;border-bottom:1px solid #c4c4af}
::-webkit-scrollbar-thumb:horizontal{
  background:linear-gradient(180deg,#fff 0%,#fdfdfa 55%,#f0f0ea 80%,#e2e2d7 100%);
  border-left:1px solid #d8d8c8;border-right:1px solid #d8d8c8;
  box-shadow:inset 0 -1px 0 #9fb5d2;
}
::-webkit-scrollbar-thumb:horizontal:hover{
  background:linear-gradient(180deg,#f2f7ff 0%,#e8f0fe 55%,#d9e6f8 80%,#cbd9ef 100%);
}
::-webkit-scrollbar-corner{background:var(--xp-bg)}
::-webkit-scrollbar-button{display:none}

/* ---------- window chrome (real XP sprites from SOURCE_clean.png atlas) ---------- */
/* semi-transparent sprite edges composite over the wallpaper like native
   fill_background (wallpaper), never over the dark modal backdrop */
.win-frame{
  width:min(420px,calc(100vw - 16px));
  background:url("../assets/xp/bliss.jpg") center top/cover no-repeat var(--xp-bg);
  border:6px solid transparent;
  border-top-width:0;
  border-image:url("../assets/xp/sprites/window_body.png") 6 fill / 6px;
  box-shadow:0 8px 40px rgba(0,0,0,.45);
}
/* XP titlebar = native draw_winxp_title look: title_bar_active sprite drawn
   ONCE stretched full-width (the old 9-layer stack re-scaled the whole sprite
   into every slice box, duplicating the highlight rows at each seam) over an
   opaque backdrop gradient tuned to the sprite's own edge profile (the sprite
   is semi-transparent — wallpaper clouds behind it washed the bands white).
   text Tahoma 14 bold at x+8; caps = h-6 (22px), gap 4, rm 4 (native btn geom) */
.win-titlebar{
  --tb-sprite:url("../assets/xp/sprites/titlebar_active.png");
  --tb-backdrop:linear-gradient(90deg,#001ac6 0%,#0055e6 7%,#0564ef 20%,#0054e7 45%,#0044df 70%,#0039da 91%,#001ac6 100%);
  height:28px;
  display:flex;align-items:center;gap:6px;
  padding:0 4px 0 8px;
  background:var(--tb-sprite) center/100% 100% no-repeat,var(--tb-backdrop);
  color:var(--xp-title-fg);
  font-family:"Tahoma","Segoe UI",Verdana,sans-serif;
  font-weight:700;font-size:14px;
  user-select:none;
}
.win-title-ico{width:16px;height:16px;flex:none;image-rendering:auto}
.win-title{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:1px 1px 0 rgba(0,0,0,.35)}
.win-caps{display:flex;gap:4px;flex:none}
.win-cap{
  width:22px;height:22px;border:0;border-radius:0;
  background-color:transparent;
  display:grid;place-items:center;padding:0;
  background-size:100% 100%;
}
.win-cap.close{
  background-image:url("../assets/xp/sprites/btn_close.png");
  color:transparent;font-size:0;
}
.win-cap.minimize{background-image:url("../assets/xp/sprites/btn_minimize.png")}
.win-cap.maximize{background-image:url("../assets/xp/sprites/btn_maximize.png")}
.win-menubar{
  display:flex;gap:2px;
  padding:2px 4px;
  background:linear-gradient(180deg,var(--xp-toolbar-a) 0%,var(--xp-toolbar-b) 100%);
  border-bottom:1px solid var(--xp-toolbar-line);
  font-size:12px;
}
.menu-slot{position:relative}
.menu-item{padding:4px 10px;border-radius:2px;user-select:none}
.menu-item:hover,.menu-item.open{background:var(--xp-sel);color:#fff}
.menu-dd{
  position:absolute;top:100%;left:0;z-index:70;min-width:180px;
  background:#fff;border:1px solid var(--xp-border);
  box-shadow:4px 4px 12px rgba(0,0,0,.3);
  padding:2px 0;font-size:12px;color:#000;
}
.menu-dd .dd-sep{height:1px;background:#c8cdd4;margin:3px 6px}
.menu-dd button{
  display:flex;align-items:center;gap:6px;
  width:100%;text-align:left;
  border:0;background:none;padding:5px 16px 5px 6px;font-size:12px;color:#000;
}
.menu-dd button:hover{background:var(--xp-sel);color:#fff}
.menu-dd .dd-ico{width:16px;height:16px;flex:none}
/* nested submenu (native File > Theme flyout opens right of the parent row) */
.dd-row-wrap{position:relative;width:100%}
.dd-sub{display:none;top:0;left:100%;margin-left:-2px;min-width:170px;padding:2px 0}
.dd-row-wrap:hover>.dd-sub,.dd-row-wrap.sub-open>.dd-sub{display:block}
.dd-item.has-sub{justify-content:space-between;padding-left:21px}
.dd-sub-arrow{margin-left:auto;font-size:12px;line-height:1;opacity:.85}
.win-toolbar{
  display:flex;gap:4px;flex-wrap:wrap;
  padding:4px 6px;
  background:linear-gradient(180deg,var(--xp-toolbar-a) 0%,var(--xp-toolbar-b) 100%);
  border-bottom:1px solid var(--xp-toolbar-line);
  -webkit-overflow-scrolling:touch;
}
.tb-btn{
  display:inline-flex;align-items:center;gap:5px;
  height:28px;padding:0 10px;flex:none;
  border:1px solid transparent;border-radius:3px;
  background:transparent;font-size:12px;white-space:nowrap;
}
.tb-btn:hover{border-color:var(--xp-border);background:rgba(255,255,255,.45)}
.tb-btn:active{background:rgba(0,0,0,.06)}
.tb-ico{font-size:13px;opacity:.85}

/* ---------- status bar ---------- */
.statusbar{
  display:flex;align-items:center;gap:8px;
  height:24px;padding:0 8px;
  background:linear-gradient(180deg,var(--xp-face) 0%,#c8d0dc 100%);
  border-top:1px solid var(--xp-border);
  font-size:11px;color:var(--xp-text);
  min-width:0;overflow:hidden;
}
.status-right{margin-left:auto;color:var(--xp-dim);white-space:nowrap;flex:none}
.led{width:11px;height:11px;border-radius:50%;flex:none;background:var(--xp-offline);box-shadow:inset 0 0 0 1px rgba(0,0,0,.25)}
.led.on{background:#50af28;box-shadow:inset 0 0 0 1px rgba(0,0,0,.2),0 0 6px rgba(80,175,40,.55)}
.led.warn{background:#d2ae3c}
.connection{display:none}

/* ---------- buttons (real button_blue sprite) ---------- */
.xp-btn{
  height:26px;padding:0 14px;
  border:0;border-radius:3px;
  background:url("../assets/xp/sprites/button_blue.png") no-repeat;
  background-size:100% 100%;
  color:#fff;font-weight:400;font-size:12px;
  text-shadow:0 1px 0 rgba(0,0,0,.25);
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
}
.xp-btn img{width:16px;height:16px;flex:none}
.xp-btn:hover{background:url("../assets/xp/sprites/button_blue_hover.png") no-repeat;background-size:100% 100%}
.xp-btn:active{filter:brightness(.92)}
.xp-btn:disabled{opacity:.55;cursor:default;filter:grayscale(.4)}
.xp-btn.primary{min-width:80px}
.xp-btn.gray{
  border:1px solid #5f5f5f;
  background:linear-gradient(180deg,#fff 0%,#e8e8e8 48%,#e8e8e8 52%,#e1e1e1 100%);
  color:#000;font-weight:400;text-shadow:none;
}
.xp-btn.gray:hover{background:linear-gradient(180deg,#fff 0%,#e6f0fc 48%,#e6f0fc 52%,#d8e8fa 100%);border-color:#2858a0}
.xp-btn.gray:active{background:#d0d0d0}
.xp-btn.small{height:24px;padding:0 12px;font-size:11px;width:auto;margin-top:0}
.icon-btn{
  width:28px;height:28px;border:1px solid transparent;border-radius:3px;
  background:transparent;font-size:15px;color:#333;
}
.icon-btn:hover{border-color:var(--xp-border);background:rgba(255,255,255,.5)}
.icon-btn img{display:block;margin:auto;width:16px;height:16px}
.back-btn{
  display:none;flex:none;
  width:32px;height:32px;margin-right:2px;
  border:1px solid var(--xp-border);border-radius:2px;
  background:linear-gradient(180deg,#fff,#e4e4e4);
  font-size:14px;color:#222;line-height:1;
}
.back-btn:active{background:#d0d0d0}
.back-btn img{display:block;margin:auto;width:16px;height:16px}

/* ---------- sunken / raised boxes ---------- */
.sunken{
  background:var(--xp-white);
  border:1px solid;
  border-color:var(--xp-sunken-light) var(--xp-shadow-out) var(--xp-shadow-out) var(--xp-sunken-light);
}
.raised{
  background:var(--xp-face);
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
}

/* ---------- XP Welcome / Logon (real Background.png + brand.png + avatar.png) ---------- */
.xp-logon{
  position:fixed;inset:0;z-index:40;
  overflow:hidden;
  padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.logon-bg{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;object-position:center;
  user-select:none;pointer-events:none;
}
.logon-root{
  position:absolute;inset:0;
  display:flex;align-items:safe center;justify-content:center;gap:clamp(24px,6vw,80px);
  padding:0 24px;
  overflow-y:auto;
}
.logon-brand{
  width:clamp(160px,22vw,300px);height:auto;
  filter:drop-shadow(0 4px 16px rgba(0,0,30,.35));
  user-select:none;pointer-events:none;
  flex:none;
}
.logon-col{
  display:flex;flex-direction:column;gap:14px;
  width:min(340px,42vw);
}
.logon-tile{
  display:flex;align-items:center;gap:16px;
  padding:6px;border:3px solid transparent;border-radius:4px;
  background:transparent;cursor:pointer;
  transition:border-color .12s,background .12s;
  text-align:left;
}
.logon-tile:hover,.logon-tile.sel{
  border-color:#ffcc00;
  background:rgba(255,255,255,.08);
}
.logon-avatar{
  width:88px;height:88px;flex:none;object-fit:cover;border-radius:2px;
}
.logon-other-box{
  width:88px;height:88px;flex:none;
  background:#fff;border-radius:2px;
  display:grid;place-items:center;
}
.logon-other-box img{width:64px;height:64px;object-fit:contain}
.logon-tile-label{
  font-size:clamp(18px,2.6vw,26px);
  color:#fff;text-shadow:1px 1px 0 rgba(0,0,0,.55);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.logon-fields{
  position:static;transform:none;
  width:100%;
  display:none;flex-direction:column;gap:10px;
}
.logon-fields.show{display:flex}
.logon-f-row{display:flex;flex-direction:column;gap:4px}
.logon-f-label{
  font-size:15px;color:#fff;text-shadow:1px 1px 0 rgba(0,0,0,.5);
}
.logon-f-box{
  position:relative;
  background:#fff;border:1px solid #7f9db9;
  height:36px;display:flex;align-items:center;
}
.logon-f-box input{
  flex:1;min-width:0;height:100%;
  border:0;background:transparent;padding:0 10px;
  font-size:16px;outline:0;
}
.logon-f-box:focus-within{outline:2px solid #0a5aba}
.logon-arrow{
  align-self:flex-end;
  width:36px;height:36px;flex:none;
  border:1px solid #006400;border-radius:2px;
  background:linear-gradient(180deg,#7ed86a 0%,#4caf3c 50%,#3a9228 100%);
  display:grid;place-items:center;padding:0;
}
.logon-arrow:hover{background:linear-gradient(180deg,#9ae88a 0%,#5cbf4c 50%,#4aa238 100%)}
.logon-arrow:active{filter:brightness(.9)}
.logon-error{
  margin:0;font-size:13px;color:#ffb0b0;
  text-shadow:1px 1px 0 rgba(0,0,0,.4);
}
.logon-hint{
  margin:0;font-size:12px;color:#d6eaff;
  text-shadow:1px 1px 0 rgba(0,0,0,.3);
  min-height:1em;
}
.logon-forgot{
  display:block;margin:8px auto 0;
  border:0;background:transparent;padding:2px 6px;
  font:inherit;font-size:12px;color:#d6eaff;
  text-decoration:underline;cursor:pointer;
  text-shadow:1px 1px 0 rgba(0,0,0,.3);
}
.logon-forgot:hover{color:#fff}
.logon-add{
  position:absolute;left:clamp(12px,3vw,36px);bottom:clamp(16px,5vh,48px);
  display:flex;align-items:center;gap:12px;
  border:0;background:transparent;padding:4px 8px;
  cursor:pointer;
}
.logon-add img{width:40px;height:40px}
.logon-add span{
  font-size:clamp(14px,2vw,20px);
  color:#fff;text-shadow:1px 1px 0 rgba(0,0,0,.55);
}
.logon-add:hover span{color:#ffeca0}
/* win98 classic logon chrome — hidden by default, shown by win98.css */
.w98-logon-titlebar,.w98-logon-head,#w98CancelBtn{display:none}
.logon-f-label u{text-decoration:none}
.caps-warn{
  position:absolute;right:8px;top:50%;transform:translateY(-50%);
  font-size:11px;color:#c89600;font-weight:700;
  pointer-events:none;
}
/* mobile logon: stack vertically */
@media(max-width:650px){
  .logon-root{flex-direction:column;justify-content:center;gap:16px;padding:48px 16px 80px}
  .logon-brand{width:min(220px,60vw)}
  .logon-col{width:min(320px,88vw);align-items:stretch}
  .logon-tile-label{font-size:20px}
  .logon-fields{position:static;transform:none;width:100%;margin-top:8px}
  .logon-add{left:16px;bottom:16px}
  .logon-add img{width:32px;height:32px}
  .logon-add span{font-size:14px}
}
/* short windows: tighten the stacked logon so the Other-User rows fit without scrolling */
@media(max-height:560px){
  .logon-col{gap:8px}
  .logon-fields{gap:6px}
}
/* dialog close uses real btn_close sprite */
dialog .win-cap.close{
  background-image:url("../assets/xp/sprites/btn_close.png");
  color:transparent;font-size:0;
}
/* app titlebar caps are decorative window chrome (browser owns real
   minimize/maximize/close) — kill pointer events so they don't fake actions */
.app-caps .win-cap{pointer-events:none;cursor:default}
.app-caps .win-cap:hover{filter:none}
.field{margin-bottom:12px}
.theme-row{display:flex;gap:6px;flex-wrap:wrap}
.theme-opt{flex:1;min-width:110px}
.theme-opt.on{border:2px solid var(--xp-accent);font-weight:700}
.field label{display:block;font-size:11px;color:var(--xp-dim);margin-bottom:4px}
.field-label-row{display:flex;align-items:center;justify-content:space-between;gap:8px}
.caps-warn{font-size:10px;color:var(--xp-warn);font-weight:700}
.sunken input,.sunken textarea{
  display:block;width:100%;height:28px;
  border:0;background:transparent;
  padding:0 8px;font-size:13px;outline:0;
}
.sunken:focus-within{outline:1px solid var(--xp-accent);outline-offset:0}
.error{color:var(--xp-error);font-size:11px;margin:8px 0 0;min-height:14px}
.reg-dialog .note{color:#16a34a;font-size:11px;margin:8px 0 0;min-height:14px}
.note a,#authHint a{color:inherit;text-decoration:underline;cursor:pointer}

/* real XP checkbox sprites (native settings draw_checkbox) */
input[type=checkbox]{
  appearance:none;-webkit-appearance:none;
  width:16px;height:12px;flex:none;margin:0;padding:0;
  background:url("../assets/xp/sprites/checkbox_unchecked.png") no-repeat center/100% 100%;
  cursor:pointer;
}
input[type=checkbox]:checked{background-image:url("../assets/xp/sprites/checkbox_checked.png")}
.field label.chk-row{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--xp-text);cursor:pointer;min-height:24px}
.lbl-ico img{width:16px;height:16px;flex:none}
.field label.lbl-ico,.dlg-body>label.lbl-ico{display:flex;align-items:center;gap:6px}

/* ---------- app shell ---------- */
.win-app{
  display:flex;flex-direction:column;
  height:100vh;height:100dvh;
  background:url("../assets/xp/bliss.jpg") center top/cover no-repeat var(--xp-bg);
  border:6px solid transparent;
  border-top-width:0;
  border-image:url("../assets/xp/sprites/window_body.png") 6 fill / 6px;
}
.win-app.inactive{
  border-image:url("../assets/xp/sprites/window_body_inactive.png") 6 fill / 6px;
}
.win-app.inactive .win-titlebar{
  --tb-sprite:url("../assets/xp/sprites/titlebar_inactive.png");
  --tb-backdrop:linear-gradient(90deg,#5b68cd 0%,#7b99e1 9%,#7ea2e4 20%,#7b99e1 40%,#7992de 61%,#7987dd 82%,#7884dc 91%,#5b68cd 100%);
}
.client-area{
  flex:1;min-height:0;position:relative;
  display:flex;
  padding:4px;
  gap:4px;
  background:url("../assets/xp/bliss.jpg") center/cover no-repeat var(--xp-bg);
}

/* contacts column */
.contacts-col{
  flex:1;min-width:0;
  display:flex;flex-direction:column;
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
  background:var(--xp-face);
}
.contacts-col.contacts-mobile-hidden{display:none!important}
.panel-header{
  height:24px;display:flex;align-items:center;
  padding:0 8px;
  background:var(--xp-header);
  color:#fff;font-weight:700;font-size:12px;
  flex:none;
}
.contacts-sunken{
  flex:1;min-height:0;
  margin:3px;
  overflow:hidden;
  display:flex;flex-direction:column;
}
.contact-list{flex:1;overflow:auto;-webkit-overflow-scrolling:touch;background:#fff}

/* contact rows */
.group-label{
  padding:6px 8px 2px;
  font-size:10px;font-weight:700;color:var(--xp-group);
  background:#fff;letter-spacing:.06em;text-transform:uppercase;
}
.contact-row{
  display:flex;align-items:center;gap:10px;
  width:100%;min-height:40px;
  padding:5px 8px 5px 14px;
  border:0;background:#fff;text-align:left;
  border-bottom:1px solid #f0f2f5;
  transition:background .1s;
}
.contact-row:hover{background:#e8f0fc}
.contact-row.active{background:var(--xp-hl);box-shadow:inset 3px 0 0 var(--xp-sel)}
.dot{width:10px;height:10px;border-radius:50%;flex:none;background:var(--xp-offline);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}
.dot.on{background:var(--xp-online);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),0 0 4px rgba(110,175,50,.4)}
.contact-name{flex:1;min-width:0;font-size:12.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.contact-name-flex{flex:1;min-width:0}
.msg-type-label{color:#969696}
  .contact-time{font-size:10px;color:#6e6e6e;flex:none;align-self:flex-start;margin-top:2px}
.unread{
  min-width:18px;height:18px;padding:0 5px;flex:none;
  background:var(--xp-badge);color:#fff;
  font-size:10px;font-weight:700;
  display:grid;place-items:center;border-radius:9px;
}
.contact-preview{display:block;font-size:11px;color:#6d6d6d;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;margin-top:2px}
.contact-preview .emote{width:14px;height:14px;vertical-align:-3px;margin:0 1px}

/* requests strip */
.requests{padding:4px;display:grid;gap:4px;background:var(--xp-face);flex:none;border-bottom:1px solid var(--xp-border)}
.request-row{display:flex;gap:6px;align-items:center;background:#fff;border:1px solid var(--xp-border);padding:4px 6px}
.req-ico{width:16px;height:16px;flex:none}
.request-row .request-main{min-width:0;flex:1}
.request-row strong{display:block;font-size:11px}
.request-row small{font-size:10px;color:var(--xp-dim)}
.req-btn{width:28px;height:24px;border:1px solid #5f5f5f;background:linear-gradient(180deg,#fff,#e4e4e4);font-size:12px}
.req-btn.accept{color:#0a600a}
.req-btn.decline{color:#a00}

/* chat column */
.chat-col{
  position:absolute;inset:0;z-index:10;
  display:none;flex-direction:column;
  background:transparent;
  padding:4px;
}
.chat-col.mobile-open{display:flex;animation:xpSlide .16s ease}
@keyframes xpSlide{from{transform:translateX(8%);opacity:.6}to{transform:none;opacity:1}}

.conv-header{
  height:52px;flex:none;
  display:flex;align-items:center;gap:10px;
  padding:0 12px;
  background:linear-gradient(180deg,#f8fafc,#e8edf4);
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
  border-bottom:0;
}
.conv-avatar{
  width:40px;height:40px;flex:none;
  background:linear-gradient(180deg,#0c3091,#2359b7);
  color:#fff;font-weight:700;font-size:16px;
  display:grid;place-items:center;
  border:1px solid var(--xp-border);
  border-radius:2px;
}
.conv-id{flex:1;min-width:0}
.conv-id strong{display:block;font-size:14.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.conv-status{display:flex;align-items:center;gap:5px;font-size:11.5px;color:#288c3c;margin-top:2px}
.conv-status .dot{width:8px;height:8px}
.conv-tools{display:flex;flex:none;gap:2px}

.messages-sunken{
  flex:1;min-height:0;
  overflow:auto;-webkit-overflow-scrolling:touch;
  margin:0;
  background:#fff;
  display:flex;flex-direction:column;
}
.message-list{display:flex;flex-direction:column;padding:8px 12px 10px;margin-top:auto}

/* native chat lines */
.msg-line{
  display:block;width:100%;
  padding:4px 8px;
  font-size:13px;line-height:1.5;
  word-wrap:break-word;overflow-wrap:anywhere;
  background:transparent;border:0;text-align:left;color:var(--xp-chat-other);
  min-height:22px;border-radius:2px;
}
.msg-line.mine{background:var(--xp-out-bg)}
.msg-line.selected{background:#fff4c8;box-shadow:inset 2px 0 0 var(--xp-accent)}
.msg-line .ts{color:var(--xp-chat-ts);margin-right:6px;font-size:11px}
.message-list.no-ts .ts{display:none}
.msg-line .who{font-weight:700;margin-right:4px}
.msg-line.mine .who{color:var(--xp-chat-self)}
.msg-line.other .who{color:#b43c28}
.msg-line .st{color:#5a5aa0;margin-left:4px;font-size:11px}
.msg-line.failed .st{color:#b42828}
.msg-line.pending .st{color:#a08020}
.msg-line.jump{animation:xpJump 2s ease}
@keyframes xpJump{0%{box-shadow:inset 0 0 0 2px var(--xp-accent)}100%{box-shadow:none}}
.att-chip{
  display:inline-flex;gap:6px;align-items:center;
  margin:2px 0 2px 18px;padding:4px 10px;
  border:1px solid var(--xp-border);background:#eef4fc;
  font-size:11px;color:#1a3a6a;cursor:pointer;border-radius:2px;
}
.att-chip img{width:14px;height:14px;flex:none}
.att-chip small{color:var(--xp-dim)}
.day-divider{
  text-align:center;color:var(--xp-dim);font-size:10px;font-weight:700;
  letter-spacing:.08em;margin:12px 0 6px;
  display:flex;align-items:center;gap:10px;
}
.day-divider::before,.day-divider::after{
  content:"";flex:1;height:1px;background:#e0e4ea;
}
  .list-empty{padding:24px 12px;text-align:center;color:#6e6e6e;font-size:13px;line-height:1.6}
.load-older{
  align-self:center;margin:0 0 8px;
  border:1px solid #5f5f5f;background:linear-gradient(180deg,#fff,#e4e4e4);
  font-size:11px;padding:4px 12px;border-radius:2px;
}

/* composer */
.composer-strip{
  position:relative;
  flex:none;margin-top:4px;
  padding:8px;
  background:var(--xp-face);
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
}
.composer-row{display:flex;gap:8px;align-items:flex-end}
.composer-sunken{flex:1;min-width:0;display:flex}
.composer-sunken textarea{
  flex:1;min-width:0;resize:none;
  min-height:34px;max-height:110px;
  border:0;background:transparent;padding:7px 10px;
  font-size:13px;outline:0;line-height:20px;overflow:auto;
}
.send-btn{
  width:86px;flex:none;height:34px;border-radius:3px;
  font-weight:700;letter-spacing:.03em;
}
.send-btn:disabled{opacity:.5;cursor:default;filter:grayscale(.4)}
.pending-file{
  display:flex;align-items:center;gap:8px;
  margin-bottom:6px;padding:5px 10px;
  background:#eef4fc;border:1px solid var(--xp-border);
  font-size:11.5px;border-radius:2px;
}
.pending-file img{width:14px;height:14px;vertical-align:-3px;margin-right:4px}
.pending-file button{margin-left:auto;border:0;background:none;color:var(--xp-error);font-size:14px}

/* details slide-over */
.details-panel{
  position:fixed;top:0;right:0;bottom:0;
  width:min(320px,90vw);
  z-index:35;
  background:var(--xp-bg);
  border-left:1px solid var(--xp-dark);
  box-shadow:-12px 0 40px rgba(0,0,0,.35);
  display:flex;flex-direction:column;
  transform:translateX(101%);
  transition:transform .2s ease;
  padding-top:env(safe-area-inset-top);
  padding-bottom:env(safe-area-inset-bottom);
}
.details-panel:not(.hidden){transform:translateX(0)}
.details-title{border-radius:0}
.details-body{flex:1;overflow:auto;padding:16px;text-align:center}
.details-avatar{
  position:relative;
  width:64px;height:64px;margin:-36px auto 12px;
  background:linear-gradient(180deg,#0c3091,#2359b7);
  color:#fff;font-weight:700;font-size:22px;
  display:grid;place-items:center;border:1px solid var(--xp-border);
  border-radius:50%;overflow:hidden;
}
.details-avatar img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.details-banner{
  width:calc(100% + 32px);margin:-16px -16px 0;height:96px;
  overflow:hidden;position:relative;
  background:linear-gradient(180deg,#0c3091,#2359b7);
  display:grid;place-items:center;
  color:rgba(255,255,255,.4);font-weight:700;font-size:28px;
}
.details-banner img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.details-banner.hidden{display:none}
.details-avatar img.hidden,.details-banner img.hidden{display:none}
.details-body h2{margin:0;font-size:15px}
.details-body>p{margin:2px 0 16px;font-size:11px;color:var(--xp-dim)}
.details-body>p.details-peer-status{margin:2px 0 12px;font-style:italic;color:#333}
#detailsAboutRow strong{white-space:pre-wrap;overflow-wrap:anywhere}

/* voice/video call dialog (WebRTC media; XP frame) */
#callDialog{
  /* non-modal floating window: clicks pass through to the app behind */
  position:fixed;top:0;left:0;width:100%;height:100%;
  pointer-events:none;
  z-index:55;
  margin:0;padding:0;border:0;background:transparent;
}
#callDialog::backdrop{background:transparent}
#callDialog .call-frame{
  pointer-events:auto;
  position:absolute;top:52px;right:12px;
  margin:0;
  box-shadow:0 8px 32px rgba(0,0,0,.45);
}
.call-body{display:flex;flex-direction:column;align-items:center;gap:2px;min-width:280px}
.call-avatar{width:64px;height:64px;margin:4px auto 8px;background:linear-gradient(180deg,#0c3091,#2359b7);color:#fff;font-weight:700;font-size:22px;display:grid;place-items:center;border:1px solid var(--xp-border)}
.call-avatar.hidden{display:none}
.call-status{margin:8px 0 2px;font-size:12px;font-weight:700;text-align:center}
.call-timer{margin:0 0 8px;font-size:12px;font-family:Consolas,"Courier New",monospace}
.call-body audio{display:none}
.call-video-stage{position:relative;width:min(320px,100%);max-width:320px;height:auto;aspect-ratio:4/3;margin:4px 0 8px;background:#000;border:2px solid var(--xp-border,#7f9db9);overflow:hidden}
.call-video-stage.hidden{display:none}
.call-video-stage>video#callRemoteVideo{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;background:#000}
.call-video-stage>video#callLocalVideo{position:absolute;right:6px;bottom:6px;width:80px;height:60px;object-fit:cover;border:1px solid #fff;background:#111;z-index:2}
.detail-row{
  border-top:1px solid var(--xp-border);
  padding:10px 0;text-align:left;
}
.detail-row span{display:block;font-size:10px;color:var(--xp-dim);letter-spacing:.08em}
.detail-row strong{display:block;margin-top:3px;font-size:12px}
.file-list{display:grid;gap:4px;margin-top:6px}
.file-row{
  display:flex;gap:6px;align-items:center;width:100%;text-align:left;
  background:#fff;border:1px solid var(--xp-border);
  padding:6px 8px;font-size:11px;
}
.file-row img{width:16px;height:16px;flex:none}
/* profile photo/banner pickers — separate from .file-row shared-file cards */
.picker-row{display:flex;gap:6px;align-items:center;margin-bottom:2px;flex-wrap:wrap}
.picker-row .file-hint{flex:1;min-width:80px;padding:0 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}

/* dialogs */
dialog{
  border:0;padding:0;background:transparent;color:var(--xp-text);
  width:100%;max-width:100%;height:100%;max-height:100%;margin:0;
}
dialog::backdrop{background:rgba(0,0,0,.35)}
.dlg-frame{
  width:min(420px,calc(100vw - 16px));
  margin:auto;
}
.dlg-body{
  display:flex;flex-direction:column;
  padding:12px;
  max-height:calc(100dvh - 60px);
  overflow:auto;-webkit-overflow-scrolling:touch;
}
.dlg-body>label{font-size:10px;color:var(--xp-dim);letter-spacing:.1em;margin:8px 0 4px}
.dlg-body>label:first-child{margin-top:0}
.dlg-actions{display:flex;justify-content:flex-end;margin:10px 0}
/* XP MessageBox: native confirm layout — 32px glyph left of the text,
   OK/Cancel centered as in win32 MessageBox (sprites + sounds, never the
   browser's plain confirm()). */
.msgbox{width:min(400px,calc(100vw - 16px))}
.msgbox-body{display:flex;gap:12px;align-items:flex-start;padding:16px 16px 4px}
.msgbox-ico{width:32px;height:32px;flex:none;image-rendering:auto}
.msgbox-text{flex:1;min-width:0;margin:0;font-size:12px;line-height:1.45;white-space:pre-wrap;word-break:break-word;padding-top:3px}
.msgbox-actions{display:flex;justify-content:center;gap:8px;padding:12px 16px 16px}
.msgbox-actions .xp-btn{min-width:92px}
.user-results,.search-results{max-height:200px;overflow:auto;margin-top:4px;padding:4px;background:#fff}
.user-item{
  display:flex;gap:8px;align-items:center;width:100%;
  border:1px solid transparent;background:#fff;
  padding:6px 8px;margin-bottom:3px;text-align:left;
}
.user-item:hover{background:var(--xp-hl);border-color:var(--xp-border)}
.user-item strong{font-size:12px;display:block}
.user-item small{color:var(--xp-dim);font-size:10px}
.user-item .status{margin-left:auto;font-size:10px;color:var(--xp-dim)}
.user-item .status.on{color:#288c3c}
.user-item-row{display:flex;gap:4px;align-items:center;margin-bottom:4px}
.user-item-row .user-item{margin-bottom:0;min-width:0;flex:1}
.tag-ok{font-size:9px;color:#0a600a;border:1px solid #4a801e;padding:3px 6px;flex:none;background:#f0faf0}
.mini-btn{font-size:9px;border:1px solid #5f5f5f;background:linear-gradient(180deg,#fff,#e4e4e4);padding:4px 8px;flex:none}
.contacts-block{margin-top:10px;border-top:1px solid var(--xp-border);padding-top:8px}
.block-label{display:block;font-size:10px;color:var(--xp-dim);letter-spacing:.08em;margin-bottom:6px}
.block-label img{width:14px;height:14px;vertical-align:-2px;margin-right:4px}
.search-hit{
  display:block;width:100%;border:0;border-bottom:1px solid #e0e4ea;
  background:#fff;text-align:left;padding:8px;font-size:12px;
}
.search-hit:hover{background:var(--xp-hl)}
.search-hit strong{color:#1a3a6a;font-size:11px}
.search-hit p{margin:2px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.search-hit .meta{color:var(--xp-dim);font-size:10px}
.hint{color:var(--xp-dim);font-size:11px;padding:6px;margin:0}
.profile-id{display:flex;gap:12px;align-items:center;margin-bottom:12px}
.profile-id .conv-avatar{width:44px;height:44px;font-size:18px}
.profile-id strong{display:block;font-size:14px}
.profile-id small{color:var(--xp-dim);font-size:11px}
.profile-banner{display:block;height:72px;overflow:hidden;margin:0 0 12px;background:#0c3091;border:1px solid var(--xp-border)}
.profile-banner-img{display:block;width:100%;height:100%;object-fit:cover}
.conv-avatar .avatar-photo{display:block;width:100%;height:100%;object-fit:cover}
.file-row{display:flex;gap:6px;align-items:center;margin-bottom:2px}
.file-row .file-hint{flex:1;min-width:0;padding:0 4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:left}
.self-banner{display:flex;gap:8px;align-items:center;padding:6px 8px;background:var(--xp-face);border-bottom:1px solid var(--xp-border)}
.self-banner-avatar{width:32px;height:32px;font-size:13px;flex:none}
.self-banner-body{min-width:0;flex:1}
  .self-banner-body strong{display:block;font-size:12px;color:#0f5a22;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.self-banner-body .hint{display:block;padding:0;margin:1px 0 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.server-block{border-top:1px solid var(--xp-border);margin-top:12px;padding-top:10px;text-align:left}
.server-row{display:flex;gap:6px;margin-top:4px}
.server-row .sunken{flex:1;min-width:0}
.server-row .sunken input{height:26px;font-size:12px}
.server-block .hint{padding:6px 0 0;font-size:10px;line-height:1.45}

/* about dialog (native render_about_ui card + Windows logo) */
.about-body{align-items:center;text-align:center;padding:20px 16px 14px}
.about-logo{width:72px;height:72px;margin:2px 0 8px;filter:drop-shadow(0 2px 4px rgba(0,0,0,.25))}
.about-brand{margin:0;font-size:24px;font-weight:700;color:var(--xp-title-a)}
.about-ver{margin:2px 0 10px;font-size:11px;color:var(--xp-text)}
.about-line{margin:2px 0;font-size:11px;color:var(--xp-dim)}
.about-body .dlg-actions{justify-content:center;margin-top:14px}

/* toasts */
.toasts{
  position:fixed;bottom:calc(36px + env(safe-area-inset-bottom));
  left:50%;transform:translateX(-50%);
  display:flex;flex-direction:column;gap:6px;z-index:60;pointer-events:none;
  width:max-content;max-width:calc(100vw - 24px);
}
.toast{
  background:var(--xp-face);
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
  padding:6px 14px;font-size:12px;
  box-shadow:0 4px 16px rgba(0,0,0,.3);
  animation:toastIn .15s ease;
  display:flex;align-items:center;gap:8px;
  text-align:left;
}
.toast img{width:16px;height:16px;flex:none}
.toast.error{color:var(--xp-error)}
@keyframes toastIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}

/* empty chat placeholder — native fill_background shows the Bliss wallpaper */
.empty-state{
  flex:1;display:none;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;padding:24px;color:#fff;
}
.empty-state .mesh-mark{
  width:56px;height:56px;margin-bottom:12px;
  filter:drop-shadow(2px 2px 0 rgba(24,34,92,.55));
}
.empty-state h1{margin:0 0 6px;font-size:16px;color:#fff;text-shadow:2px 2px 0 rgba(24,34,92,.55)}
.empty-state p{margin:0 0 16px;font-size:12px;max-width:320px;line-height:1.5;color:#fff;text-shadow:1px 1px 0 rgba(24,34,92,.75)}
.empty-state .empty-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:center}
.empty-state .empty-hint{margin:14px 0 0;font-size:10px;color:rgba(255,255,255,.75);text-shadow:1px 1px 0 rgba(24,34,92,.6)}

/* mobile layout */
@media(max-width:900px){
  /* details-panel keeps display:flex from base; .hidden still wins via
     display:none!important — do NOT force flex here or hidden state breaks */
}
@media(max-width:650px){
  .back-btn{display:grid;place-items:center}
  .win-toolbar{padding:4px 6px}
  .tb-btn{height:34px;padding:0 10px;font-size:11.5px}
  .statusbar{height:calc(26px + env(safe-area-inset-bottom));padding-bottom:env(safe-area-inset-bottom);gap:6px;font-size:10px}
  /* compact: hide the long app-name line, keep LED + counts only */
  .statusbar>span:not(.status-right):not(.led){display:none}
  .status-right{font-size:10px}
  .win-titlebar{padding-top:env(safe-area-inset-top);height:calc(30px + env(safe-area-inset-top))}
  .composer-sunken textarea{min-height:36px}
  .send-btn{min-height:36px}
  .xp-btn{min-height:36px}
  .dlg-frame{width:100%;height:100%;max-height:100%}
  /* call window: keep it a floating compact card on mobile too (not full-screen) */
  #callDialog .call-frame{width:min(340px,calc(100vw - 16px));height:auto;top:auto;bottom:calc(48px + env(safe-area-inset-bottom));right:8px;left:auto}
  .dlg-body{max-height:calc(100dvh - 34px);padding-bottom:calc(12px + env(safe-area-inset-bottom))}
  .user-results,.search-results{max-height:none;flex:1;min-height:80px}
  .conv-header{height:48px;padding:0 8px;gap:8px}
  .conv-avatar{width:36px;height:36px}
  .message-list{padding:6px 8px 8px}
  /* P2: call video stage never exceeds its frame on tiny viewports */
  .call-video-stage{width:100%;max-width:100%}
  .call-body{min-width:0}
}
@media(min-width:651px){
  .chat-col{
    position:relative;inset:auto;
    flex:1;min-width:0;
    display:flex;flex-direction:column;
  }
  .chat-col.hidden{display:none!important}
  .contacts-col{width:280px;flex:none}
  .empty-state{display:flex}
  .empty-state.hidden{display:none!important}
}

/* ---------- emoticon / sticker picker ---------- */
.emoji-btn{width:34px;height:34px;flex:none;align-self:flex-end}
.emoji-panel{
  position:absolute;left:8px;bottom:calc(100% + 2px);
  width:min(304px,calc(100vw - 32px));
  background:var(--xp-face);
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
  box-shadow:0 6px 24px rgba(0,0,0,.35);
  z-index:32;padding:6px;
}
.emoji-tabs{display:flex;gap:4px;margin-bottom:6px}
.emoji-tab{
  flex:1;height:24px;
  border:1px solid var(--xp-border);
  background:linear-gradient(180deg,#fff,#e8e8e8);
  font-size:11px;color:#1a3a6a;
}
.emoji-tab.active{
  background:linear-gradient(180deg,#dcebfc,#c4dcf8);
  border-color:var(--xp-accent);font-weight:700;
}
.emoji-grid{
  display:grid;grid-template-columns:repeat(8,1fr);gap:2px;
  max-height:186px;overflow:auto;padding:2px;
}
.emoji-grid.hidden{display:none}
.sticker-grid{grid-template-columns:repeat(3,1fr);gap:6px}
.emote-grid{grid-template-columns:repeat(9,1fr);max-height:238px}
.emoji-cell{
  border:1px solid transparent;background:transparent;
  font-size:18px;line-height:1;padding:4px 0;
  display:grid;place-items:center;min-height:30px;
}
.emoji-cell:hover{border-color:var(--xp-border);background:#e8f0fc}
.emoji-cell:active{background:#d0e2fa}
.emote-cell{min-height:32px}
.emote-cell img{width:24px;height:24px;display:block;margin:auto}
.sticker-cell{min-height:56px}
.sticker-cell img{width:44px;height:44px;object-fit:contain;display:block}

/* inline native emoticon (:eNNN:) in message text */
.emote{
  width:19px;height:19px;
  vertical-align:-4px;margin:0 1px;
  display:inline-block;
}

/* inline image attachment thumbnail (stays inside the clickable att-chip) */
.att-img-chip{flex-direction:column;align-items:flex-start;gap:4px;max-width:min(250px,72vw)}
.att-chip .att-img{
  width:120px;height:76px;
  object-fit:cover;
  border:1px solid var(--xp-border);background:#e6edf7;
  display:block;
}
.att-chip .att-img.att-img-ready{width:auto;height:auto;max-width:220px;max-height:170px;object-fit:contain}
.att-chip .att-img.att-img-loading{animation:attShimmer 1.1s ease-in-out infinite alternate}
.att-chip .att-img.att-img-failed{
  width:120px;height:24px;
  display:grid;place-items:center;
  font-size:10px;color:#6d7b95;
}
@keyframes attShimmer{from{opacity:.55}to{opacity:1}}

/* hourglass spinner in "Searching…" hints */
.hourglass{
  width:16px;height:16px;vertical-align:-3px;margin-right:4px;
  animation:hourglassBob .9s ease-in-out infinite;
}
@keyframes hourglassBob{0%,100%{transform:translateY(0)}50%{transform:translateY(-2px)}}

/* details rows: small label icons */
.detail-row span img{width:14px;height:14px;vertical-align:-2px;margin-right:5px}

/* ambient motion (all guarded by the global prefers-reduced-motion rule) */
@keyframes badgePulse{0%,100%{transform:scale(1)}50%{transform:scale(1.14)}}
.unread{animation:badgePulse 1.8s ease-in-out infinite}
@keyframes ledPulse{0%,100%{box-shadow:inset 0 0 0 1px rgba(0,0,0,.2),0 0 6px rgba(80,175,40,.55)}50%{box-shadow:inset 0 0 0 1px rgba(0,0,0,.2),0 0 11px rgba(80,175,40,.95)}}
.led.on{animation:ledPulse 2.2s ease-in-out infinite}
@keyframes markFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
.empty-state .mesh-mark{animation:markFloat 3.4s ease-in-out infinite}

/* online GIF search pane */
.gif-pane{display:flex;flex-direction:column;gap:6px}
.gif-pane.hidden{display:none}
.gif-search{
  width:100%;height:24px;padding:2px 6px;font-size:11px;font-family:inherit;
  color:#12141a;background:#fff;
  border:1px solid;border-color:var(--xp-dark) var(--xp-shadow-out) var(--xp-shadow-out) var(--xp-dark);
}
.gif-search:focus{outline:1px dotted #000;outline-offset:-2px}
.gif-results{
  display:grid;grid-template-columns:repeat(4,1fr);gap:4px;
  max-height:214px;overflow:auto;padding:2px;
}
.gif-cell{
  padding:0;line-height:0;aspect-ratio:1/1;overflow:hidden;
  border:1px solid var(--xp-border);background:#e6edf7;
}
.gif-cell:hover{border-color:var(--xp-accent);box-shadow:inset 0 0 0 1px var(--xp-accent)}
.gif-cell img{width:100%;height:100%;object-fit:cover;display:block}
.gif-cat{
  position:relative;padding:0;line-height:0;aspect-ratio:1/1;overflow:hidden;
  border:1px solid var(--xp-border);background:#e6edf7;
}
.gif-cat:hover{border-color:var(--xp-accent);box-shadow:inset 0 0 0 1px var(--xp-accent)}
.gif-cat img{width:100%;height:100%;object-fit:cover;display:block}
.gif-cat-label{
  position:absolute;left:0;right:0;bottom:0;
  padding:2px 4px;font-size:10px;line-height:1.3;color:#fff;text-align:left;
  background:rgba(0,0,0,.55);
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.gif-status{font-size:11px;color:#1a3a6a;min-height:20px;padding:2px}
.gif-status.hidden{display:none}

/* composer character budget (quiet until the last 500) */
.char-count{
  flex:none;min-width:52px;text-align:center;align-self:center;
  font-size:11px;color:#1a3a6a;user-select:none;
}
.char-count.hidden{display:none}
.char-count.warn{color:#a08020;font-weight:700}
.char-count.danger{color:#b42828;font-weight:700}

/* "new messages" pill — sticky inside the scroller */
.new-msgs-pill{
  display:block;width:max-content;margin:4px auto 6px;
  position:sticky;bottom:6px;z-index:5;
  border:1px solid var(--xp-border);
  background:linear-gradient(180deg,#fff,#e8e8e8);
  font-size:11px;color:#1a3a6a;padding:3px 10px;
  box-shadow:0 2px 8px rgba(0,0,0,.25);
}
.new-msgs-pill.hidden{display:none}
.new-msgs-pill:hover{background:#dcebfc;border-color:var(--xp-accent)}

/* right-click message menu */
.ctx-menu{
  position:fixed;z-index:70;min-width:160px;
  background:var(--xp-face);
  border:1px solid;
  border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
  box-shadow:0 4px 14px rgba(0,0,0,.35);padding:2px;
}
.ctx-menu.hidden{display:none}
.ctx-menu button{
  display:block;width:100%;text-align:left;
  border:1px solid transparent;background:transparent;
  font-size:12px;padding:5px 12px;color:#1a3a6a;font-family:inherit;
}
.ctx-menu button:hover{background:#000080;color:#fff;border-color:#000080}
.ctx-ghost{position:fixed;left:-9999px;top:0}

/* message control: reply / edit / reactions / pin / tombstone */
.msg-line.deleted .body{font-style:italic;color:#777}
.msg-line .reply-quote{
  display:block;margin:0 0 3px 0;padding:2px 8px;
  border-left:3px solid var(--xp-accent);
  background:rgba(0,0,0,.05);color:#555;
  font-size:11px;cursor:pointer;max-width:100%;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.msg-line .reply-quote:hover{background:rgba(0,0,0,.1)}
.msg-line .edited-tag{color:var(--xp-chat-ts);font-size:10px;margin-left:5px;font-style:italic}
.msg-line .pinned-tag{margin-left:5px;font-size:11px}
.msg-line .reactions{display:flex;flex-wrap:wrap;gap:4px;margin-top:3px}
.reaction-chip{
  display:inline-flex;gap:4px;align-items:center;
  border:1px solid var(--xp-shadow-out);background:var(--xp-face);
  border-radius:9px;padding:1px 7px;font-size:11px;cursor:pointer;line-height:1.5;
}
.reaction-chip:hover{border-color:var(--xp-accent)}
.reaction-chip.mine{border-color:var(--xp-accent);box-shadow:inset 0 0 0 1px var(--xp-accent)}
.reaction-count{font-size:10px;color:#555}
.ctx-react{display:grid;grid-template-columns:repeat(3,1fr);gap:2px;padding:4px 2px;border-top:1px solid var(--xp-shadow-out);margin-top:2px}
.ctx-react.hidden{display:none}
.ctx-react button{
  display:block;width:auto;text-align:center;
  font-size:15px;padding:4px;
}
.ctx-react button:hover{background:#000080;color:#fff;border-color:#000080}
.reply-bar,.edit-bar{
  display:flex;gap:8px;align-items:center;
  padding:4px 8px;font-size:12px;
  background:var(--xp-face);
  border:1px solid;border-color:var(--xp-shadow-out) var(--xp-dark) var(--xp-dark) var(--xp-shadow-out);
}
.reply-bar.hidden,.edit-bar.hidden{display:none}
.reply-bar-ico{font-size:13px}
.reply-bar-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#444}
.reply-bar-text b{color:#1a3a6a}
.edit-bar-label{flex:1;color:#1a3a6a;font-weight:600}
.reply-bar-x{border:1px solid transparent;background:transparent;cursor:pointer;font-size:12px;padding:1px 6px}
.reply-bar-x:hover{background:#000080;color:#fff;border-color:#000080}
.pinned-strip{
  display:flex;gap:6px;align-items:center;
  padding:3px 8px;font-size:11px;
  background:rgba(255,244,200,.65);
  border-bottom:1px solid var(--xp-shadow-out);
}
.pinned-strip.hidden{display:none}
.pinned-ico{font-size:11px}
.pinned-jump{flex:1;min-width:0;text-align:left;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border:1px solid transparent;background:transparent;font-size:11px;color:#1a3a6a;cursor:pointer;padding:2px 4px}
.pinned-jump:hover{background:#000080;color:#fff;border-color:#000080}
.pinned-x{border:1px solid transparent;background:transparent;cursor:pointer;font-size:11px;padding:2px 6px}
.pinned-x:hover{background:#000080;color:#fff;border-color:#000080}

/* failed messages read as clickable retry targets */
.msg-line.failed{cursor:pointer}
.msg-line.failed:hover .st{text-decoration:underline}

/* ---------------- roles: badges + Admin Panel ---------------- */
.role-badge{
  display:inline-block;margin:0 4px;padding:0 5px;border-radius:2px;
  font-size:9px;line-height:14px;vertical-align:middle;text-transform:uppercase;
  letter-spacing:.3px;color:#fff;border:1px solid rgba(0,0,0,.35);
}
.badge-owner{background:#8a2be2}
.badge-admin{background:#c0392b}
.badge-moderator{background:#1f6fb2}
.badge-muted{background:#b9770e}
.badge-banned{background:#6e2b2b}
.badge-online{background:#1e7d32}
.admin-frame{width:min(720px,94vw)}
.admin-tabs{display:flex;gap:6px;margin-bottom:6px}
.admin-tab.sel{font-weight:700;box-shadow:inset 0 0 0 1px var(--xp-dark)}
.admin-pane{max-height:46vh;min-height:180px;overflow:auto;padding:2px}
.admin-pane.hidden{display:none}
.admin-user-row,.admin-msg-row,.admin-audit-row{
  display:flex;gap:8px;align-items:center;padding:5px 6px;
  border-bottom:1px solid var(--xp-shadow-out);
}
.admin-user-row:last-child,.admin-msg-row:last-child,.admin-audit-row:last-child{border-bottom:none}
.admin-user-id{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:4px}
.admin-user-id small{width:100%}
.admin-user-acts{display:flex;gap:4px;flex-shrink:0}
.admin-role{font-size:12px;max-width:110px}
.admin-msg-row{flex-wrap:wrap}
.admin-msg-meta{display:flex;gap:8px;align-items:baseline;width:100%}
.admin-msg-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
.admin-edit-input{flex:1;min-width:120px;font-size:12px;padding:2px 4px}
.admin-audit-row{flex-direction:column;align-items:stretch;gap:1px}
