/* ─── BASIS://CHAT — Redesigned to match databasis.info ──────────────────── */
/* Refined data terminal aesthetic — warm olive green on black              */

:root {
  --g:    #78b15a;
  --g90:  rgba(120, 177, 90, .92);
  --g70:  rgba(120, 177, 90, .70);
  --g55:  rgba(120, 177, 90, .55);
  --g40:  rgba(120, 177, 90, .40);
  --g25:  rgba(120, 177, 90, .25);
  --g15:  rgba(120, 177, 90, .15);
  --g10:  rgba(120, 177, 90, .10);
  --g06:  rgba(120, 177, 90, .06);

  --bg:      #000;
  --bg2:     #060d04;
  --bg3:     #0a1408;
  --surface: rgba(20, 35, 18, .55);

  --border:     rgba(120, 177, 90, .18);
  --border-hi:  rgba(120, 177, 90, .30);
  --border-act: rgba(120, 177, 90, .50);

  --text:      rgba(120, 177, 90, .92);
  --text-dim:  rgba(120, 177, 90, .60);
  --text-soft: rgba(120, 177, 90, .82);
  --text-mute: rgba(120, 177, 90, .30);

  --pos:  #78b15a;
  --neg:  #dc5a46;
  --warn: #c8a832;

  --glow:    0 0 6px rgba(120, 177, 90, .20);
  --glow-lg: 0 0 18px rgba(120, 177, 90, .55);
  --shadow:  inset 0 0 14px rgba(120, 177, 90, .04);

  --r:    14px;
  --r-sm: 10px;
  --mono: 'IBM Plex Mono', monospace;

  --input-bg:    rgba(0,0,0,.28);
  --input-bg-fo: rgba(0,0,0,.45);
  --scanline:    rgba(120, 177, 90, .018);
  --head-bg:     rgba(120, 177, 90, .09);
  --head-border: rgba(120, 177, 90, .12);
  --dot-color:   rgba(120, 177, 90, .35);

  --g-title:     rgba(120, 177, 90, .80);
  --g-title-glow: 0 0 10px rgba(120, 177, 90, .18);
  --g-btn-border: rgba(120, 177, 90, .38);
  --g-btn-hover:  rgba(120, 177, 90, .11);
  --g-sep:        rgba(120, 177, 90, .16);
  --g-bub-mi:     rgba(120, 177, 90, .05);
  --g-bub-mi-bdr: rgba(120, 177, 90, .22);
  --ov-bg:        rgba(0,0,0,.70);

  color-scheme: dark;
}

/* ─── Light theme ────────────────────────────────────────────────────────── */
[data-theme="light"] {
  --g:    #3a7a28;
  --g90:  rgba(58, 122, 40, .92);
  --g70:  rgba(58, 122, 40, .70);
  --g55:  rgba(58, 122, 40, .55);
  --g40:  rgba(58, 122, 40, .40);
  --g25:  rgba(58, 122, 40, .25);
  --g15:  rgba(58, 122, 40, .15);
  --g10:  rgba(58, 122, 40, .10);
  --g06:  rgba(58, 122, 40, .06);

  --bg:      #e8e8e0;
  --bg2:     #deded6;
  --bg3:     #d4d4cc;
  --surface: rgba(200, 210, 195, .55);

  --border:     rgba(58, 122, 40, .20);
  --border-hi:  rgba(58, 122, 40, .35);
  --border-act: rgba(58, 122, 40, .55);

  --text:      rgba(20, 40, 15, .88);
  --text-dim:  rgba(20, 40, 15, .60);
  --text-soft: rgba(20, 40, 15, .75);
  --text-mute: rgba(20, 40, 15, .35);

  --pos:  #3a7a28;
  --neg:  #c04030;
  --warn: #8a7020;

  --glow:    0 0 6px rgba(58, 122, 40, .10);
  --glow-lg: 0 0 18px rgba(58, 122, 40, .25);
  --shadow:  inset 0 0 14px rgba(58, 122, 40, .03);

  --input-bg:    rgba(255,255,255,.5);
  --input-bg-fo: rgba(255,255,255,.7);
  --scanline:    rgba(58, 122, 40, .025);
  --head-bg:     rgba(58, 122, 40, .07);
  --head-border: rgba(58, 122, 40, .12);
  --dot-color:   rgba(58, 122, 40, .35);

  --g-title:     rgba(30, 70, 20, .85);
  --g-title-glow: 0 0 10px rgba(58, 122, 40, .08);
  --g-btn-border: rgba(58, 122, 40, .40);
  --g-btn-hover:  rgba(58, 122, 40, .12);
  --g-sep:        rgba(58, 122, 40, .18);
  --g-bub-mi:     rgba(58, 122, 40, .06);
  --g-bub-mi-bdr: rgba(58, 122, 40, .25);
  --ov-bg:        rgba(0,0,0,.50);

  color-scheme: light;
}
[data-theme="light"] ::selection { background: rgba(58, 122, 40, .22); color: #000; }
[data-theme="light"] .pfp { color: rgba(255,255,255,.9); }
[data-theme="light"] .m-bub.ot { background: rgba(255,255,255,.5); }
[data-theme="light"] .m-bub.mi { background: rgba(58, 122, 40, .08); border-color: rgba(58, 122, 40, .22); }
[data-theme="light"] .m-txt code { background: rgba(0,0,0,.08); }
[data-theme="light"] .npill { background: rgba(255,255,255,.9); }
[data-theme="light"] .sb-ov { background: rgba(0,0,0,.35); }
[data-theme="light"] .u-popup { box-shadow: var(--shadow), 0 8px 32px rgba(0,0,0,.18); }
[data-theme="light"] .confirm-box,
[data-theme="light"] .prof-box { box-shadow: var(--shadow), 0 12px 48px rgba(0,0,0,.18); }
[data-theme="light"] .crop-box { box-shadow: var(--shadow), 0 12px 48px rgba(0,0,0,.18); }
[data-theme="light"] .m-txt { color: rgba(20, 40, 15, .92); }
[data-theme="light"] .badge-dev,
[data-theme="light"] .badge-bot { background: rgba(58, 122, 40, .12); }
[data-theme="light"] .badge-admin { background: rgba(200, 160, 40, .15); }
[data-theme="light"] .badge-mod { background: rgba(80, 160, 220, .15); }

/* Light mode: turn off fluorescent glow, no brightness boost needed */
[data-theme="light"] .sb-u-name { text-shadow: none; }
[data-theme="light"] .sb-u-name span { filter: none; }
[data-theme="light"] .dm-conv-name { text-shadow: none; filter: none; }
[data-theme="light"] .m-au { text-shadow: none; filter: none; }
[data-theme="light"] .mc-h-name { text-shadow: none; filter: none; }
[data-theme="light"] .u-popup-name { text-shadow: none; }
[data-theme="light"] .u-popup-name span { filter: none; }
[data-theme="light"] .prof-name { text-shadow: none; filter: none; }

/* Light mode: green-tinted background with thermal particles */
[data-theme="light"] body { background: #e4ebe0; }
[data-theme="light"] #S_chat::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 120px 120px at 15% 25%, rgba(58, 122, 40, .06) 0%, transparent 70%),
    radial-gradient(ellipse 90px 90px at 75% 15%, rgba(58, 122, 40, .05) 0%, transparent 70%),
    radial-gradient(ellipse 140px 140px at 60% 70%, rgba(58, 122, 40, .05) 0%, transparent 70%),
    radial-gradient(ellipse 100px 100px at 30% 80%, rgba(58, 122, 40, .04) 0%, transparent 70%),
    radial-gradient(ellipse 80px 80px at 85% 55%, rgba(58, 122, 40, .05) 0%, transparent 70%),
    radial-gradient(ellipse 110px 110px at 45% 40%, rgba(58, 122, 40, .04) 0%, transparent 70%);
  animation: thermalDrift 20s ease-in-out infinite alternate;
}
[data-theme="light"] .chat-wrap { position: relative; }

@keyframes thermalDrift {
  0%   { opacity: .6; transform: scale(1) translate(0, 0); }
  25%  { opacity: .9; transform: scale(1.05) translate(8px, -6px); }
  50%  { opacity: .7; transform: scale(.98) translate(-5px, 10px); }
  75%  { opacity: 1;  transform: scale(1.03) translate(6px, 4px); }
  100% { opacity: .8; transform: scale(1) translate(-3px, -8px); }
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: .94rem;
  line-height: 1.75;
  letter-spacing: .2px;
}

/* No body-level scanlines — scanlines are on panels only */
body::before, body::after { display: none; }

::selection { background: var(--g25); color: inherit; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--g15); border-radius: 2px; }

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes spin       { to { transform: rotate(360deg); } }
@keyframes blinkSlow  { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes fadeUp     { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn     { from { opacity: 0; } to { opacity: 1; } }
@keyframes msgIn      { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes glow       { 0%,100% { text-shadow: var(--glow); } 50% { text-shadow: var(--glow-lg); } }
@keyframes typeBounce { 0%,60%,100% { transform: translateY(0); opacity: .25; } 30% { transform: translateY(-4px); opacity: 1; } }
/* keep old name for JS compatibility */
@keyframes pulse      { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* ─── Scanline mixin (applied per-panel) ─────────────────────────────────── */
/* Panels get their own CRT scanlines via ::before */

/* ─── Screen transitions ─────────────────────────────────────────────────── */
.scr { display: none; height: 100%; }
.scr.on { display: flex; }

/* ─── Loading screen ─────────────────────────────────────────────────────── */
#S_load {
  align-items: center; justify-content: center;
  flex-direction: column; gap: 10px;
}
.ld-logo {
  font-size: 1.1rem; font-weight: 600; color: var(--g);
  letter-spacing: 6px; text-transform: uppercase;
  animation: glow 2.5s ease-in-out infinite;
}
.ld-sub {
  font-size: .6rem; color: var(--text-dim);
  letter-spacing: 3px; text-transform: uppercase;
}
.ld-spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--g10); border-top-color: var(--g);
  border-radius: 50%; animation: spin .6s linear infinite;
  margin-top: 20px;
}
.ld-track {
  width: 200px; height: 2px;
  background: var(--g06); border-radius: 1px;
  overflow: hidden; margin-top: 6px;
}
.ld-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--g25), var(--g));
  border-radius: 1px; transition: width .35s;
}

/* ─── Auth screen ────────────────────────────────────────────────────────── */
#S_auth {
  align-items: center; justify-content: center;
  padding: 20px; position: relative; z-index: 1;
}
.a-wrap { width: 100%; max-width: 440px; animation: fadeUp .45s ease; }
.a-card {
  position: relative; overflow: hidden;
  border-radius: var(--r); background: var(--surface);
  border: 1px dashed var(--border);
  box-shadow: var(--shadow), var(--glow);
}
/* Panel scanlines */
.a-card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(to bottom,
    var(--scanline) 0px, var(--scanline) 1px,
    transparent 1px, transparent 6px);
}
.a-card > * { position: relative; z-index: 1; }

.a-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px; text-align: center;
  border-bottom: 1px dashed var(--head-border);
  background: linear-gradient(to right, var(--head-bg), transparent);
}
.a-head::before {
  content: "● ● ●"; font-size: .42rem; letter-spacing: 3px;
  color: var(--dot-color); flex-shrink: 0;
}
.a-logo {
  font-size: .76rem; font-weight: 600; color: var(--g-title);
  letter-spacing: 1.4px; text-transform: uppercase;
  text-shadow: var(--g-title-glow);
}
.a-sub {
  font-size: .72rem; letter-spacing: 1px; color: var(--text-dim);
  text-transform: uppercase;
  animation: blinkSlow 2.4s ease-in-out infinite;
}
.a-body { padding: 24px 20px 28px; }
@media(min-width:768px) { .a-body { padding: 28px 24px 32px; } }

/* Auth tabs */
.tabs {
  display: flex; margin-bottom: 22px;
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  overflow: hidden; background: var(--input-bg);
}
.tab {
  flex: 1; padding: 10px; border: 0; background: 0;
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer; transition: .16s;
  position: relative;
}
.tab:hover { background: var(--g06); }
.tab.on { background: var(--g10); color: var(--g); }
.tab.on::after {
  content: ""; position: absolute; bottom: 0;
  left: 20%; right: 20%; height: 1px;
  background: var(--g); border-radius: 1px;
}

/* Form fields */
.fld { margin-bottom: 16px; }
.fld-lbl {
  display: block; font-size: .62rem; letter-spacing: 2px;
  text-transform: uppercase; color: var(--text-dim);
  margin-bottom: 6px; font-weight: 500;
}
.fld-inp {
  width: 100%; background: var(--input-bg);
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--mono);
  font-size: .84rem; padding: 12px 14px;
  outline: 0; transition: .16s; letter-spacing: .5px;
}
.fld-inp::placeholder { color: var(--text-mute); }
.fld-inp:focus {
  border-color: var(--border-act); border-style: solid;
  background: var(--input-bg-fo);
  box-shadow: var(--glow);
}
.fld-ta {
  width: 100%; background: var(--input-bg);
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  color: var(--text); font-family: var(--mono);
  font-size: .76rem; padding: 10px 14px;
  outline: 0; transition: .16s; resize: vertical;
  min-height: 60px; max-height: 120px; line-height: 1.5;
}
.fld-ta::placeholder { color: var(--text-mute); }
.fld-ta:focus { border-color: var(--border-act); border-style: solid; background: var(--input-bg-fo); }

/* Color picker */
.colors { display: flex; gap: 10px; flex-wrap: wrap; padding: 4px 0; }
.colbtn {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid transparent; cursor: pointer; transition: .16s;
}
.colbtn:hover { transform: scale(1.12); }
.colbtn.on { transform: scale(1.3); border-color: rgba(255,255,255,.3); }

/* Status messages */
.sts {
  padding: 10px 14px; border-radius: var(--r-sm);
  font-size: .68rem; display: none; align-items: center;
  gap: 8px; margin-bottom: 14px; letter-spacing: .6px;
}
.sts.show { display: flex; }
.sts.err { background: rgba(220, 90, 70, .06); border: 1px dashed rgba(220, 90, 70, .22); color: var(--neg); }
.sts.ok  { background: var(--g06); border: 1px dashed var(--g-bub-mi-bdr); color: var(--pos); }

/* Auth button */
.a-btn {
  width: 100%; padding: 13px;
  border: 1px dashed var(--g-btn-border); border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font-family: var(--mono); font-size: .74rem; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase;
  cursor: pointer; transition: .16s;
  position: relative; overflow: hidden;
  box-shadow: var(--glow); min-height: 34px;
}
.a-btn:hover:not(:disabled) {
  background: var(--g-btn-hover);
  border-color: var(--g); color: var(--g);
  box-shadow: var(--glow-lg); transform: translateY(-1px);
}
.a-btn:active { transform: translateY(0) scale(.985); }
.a-btn:disabled { opacity: .4; cursor: not-allowed; }
.a-btn .sp {
  display: none; width: 14px; height: 14px;
  border: 2px solid var(--g25); border-top-color: var(--g);
  border-radius: 50%; animation: spin .5s linear infinite;
}
.a-btn.ld .bt { opacity: 0; }
.a-btn.ld .sp {
  display: inline-block; position: absolute;
  left: 50%; top: 50%; margin: -7px 0 0 -7px;
}

.a-reset {
  font-size: .60rem; color: var(--text-mute); text-align: center;
  margin-top: 10px; cursor: pointer; letter-spacing: 1.2px;
  text-decoration: underline; text-underline-offset: 3px;
}
.a-reset:hover { color: var(--text-dim); }
.a-foot {
  font-size: .54rem; color: var(--text-mute); text-align: center;
  margin-top: 18px; letter-spacing: 1.2px;
}

/* ─── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 1px 5px; border-radius: 3px;
  font-size: .48rem; font-weight: 600; letter-spacing: 1.5px;
  text-transform: uppercase; vertical-align: middle; margin-left: 4px;
}
.badge-dev   { background: var(--g10); color: var(--g); border: 1px dashed var(--g40); }
.badge-admin { background: rgba(90, 160, 220, .10); color: #6aaddb; border: 1px dashed rgba(90, 160, 220, .28); }
.badge-mod   { background: rgba(200, 168, 50, .08); color: var(--warn); border: 1px dashed rgba(200, 168, 50, .22); }
.badge-muted { background: rgba(220, 90, 70, .08); color: var(--neg); border: 1px dashed rgba(220, 90, 70, .18); }
.badge-bot   { background: var(--g10); color: var(--g); border: 1px dashed var(--g25); }

/* ─── Avatars ────────────────────────────────────────────────────────────── */
.pfp {
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; color: rgba(0,0,0,.65); position: relative;
  overflow: hidden;
}
.pfp img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.pfp .od {
  position: absolute; bottom: 0; right: 0;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--pos); border: 2px solid var(--bg2);
}

/* ─── Chat Layout ────────────────────────────────────────────────────────── */
.chat-wrap { display: flex; width: 100%; height: 100%; overflow: hidden; }

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sb {
  width: 260px; min-width: 260px;
  background: var(--surface);
  border-right: 1px dashed var(--border);
  display: flex; flex-direction: column;
  overflow: hidden; position: relative; z-index: 100;
  box-shadow: var(--shadow);
}
/* Scanlines on sidebar */
.sb::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: repeating-linear-gradient(to bottom,
    var(--scanline) 0px, var(--scanline) 1px,
    transparent 1px, transparent 6px);
}
.sb > * { position: relative; z-index: 1; }

.sb-logo {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px dashed var(--head-border);
  background: linear-gradient(to right, var(--head-bg), transparent);
}
.sb-logo::before {
  content: "● ● ●"; font-size: .42rem; letter-spacing: 3px;
  color: var(--dot-color); flex-shrink: 0;
  display: none;
}
.sb-logo-t {
  font-size: .76rem; font-weight: 600; color: var(--g-title);
  letter-spacing: 1.4px; text-transform: uppercase;
  text-shadow: var(--g-title-glow);
}
.sb-logo-s {
  font-size: .54rem; color: var(--text-dim);
  letter-spacing: 2px; text-transform: uppercase; margin-top: 2px;
}
.sb-close {
  display: none; background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-family: var(--mono); font-size: .9rem;
  width: 30px; height: 30px; border-radius: var(--r-sm);
  cursor: pointer; transition: .16s; flex-shrink: 0;
  align-items: center; justify-content: center;
}
.sb-close:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }

/* Sidebar nav tabs */
.sb-nav { display: flex; border-bottom: 1px dashed var(--border); flex-shrink: 0; }
.sb-nav-tab {
  flex: 1; display: flex; align-items: center; justify-content: center;
  gap: 6px; padding: 10px 8px;
  font-family: var(--mono); font-size: .64rem; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer; border: 0; background: 0;
  transition: .16s; position: relative;
  border-bottom: 2px solid transparent;
}
.sb-nav-tab:hover { background: var(--g06); color: var(--text); }
.sb-nav-tab.on { color: var(--g); background: var(--g06); border-bottom-color: var(--g); }
.sb-nav-tab .unread-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--g); display: none; flex-shrink: 0;
  animation: blinkSlow 2.4s ease-in-out infinite;
}
.sb-nav-tab .unread-dot.on { display: block; }
.sb-nav-tab .unread-num {
  font-size: .50rem; padding: 1px 5px; border-radius: 8px;
  background: var(--g); color: var(--bg); font-weight: 600;
  display: none; flex-shrink: 0;
}
.sb-nav-tab .unread-num.on { display: inline; }

/* Sidebar panels */
.sb-panel { flex: 1; overflow-y: auto; display: none; min-height: 0; }
.sb-panel.on { display: block; }

/* Users panel */
.sb-users { padding: 14px; }
.sb-users-h {
  font-size: .56rem; font-weight: 600; color: var(--text-dim);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between;
}
.sb-cnt {
  padding: 2px 7px; border-radius: 8px;
  background: var(--input-bg); border: 1px dashed var(--border);
  font-size: .50rem; color: var(--g55); font-weight: 600;
}
.sb-u {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; margin-bottom: 2px;
  border-radius: var(--r-sm); transition: .16s;
  cursor: pointer; position: relative;
}
.sb-u:hover { background: var(--g06); }
.sb-u.me { background: var(--g06); border: 1px dashed var(--border); }
.sb-u.offline { opacity: .4; }
.sb-u.offline:hover { opacity: .65; }
.sb-u.offline .sb-u-name { text-shadow: none; }
.sb-u.offline .sb-u-name span { filter: none; }
.sb-u-info { flex: 1; min-width: 0; }
.sb-u-name {
  font-size: .78rem; font-weight: 700; display: flex; align-items: center;
  gap: 4px; overflow: hidden; white-space: nowrap;
  text-shadow: 0 0 8px currentColor;
}
.sb-u-name span { overflow: hidden; text-overflow: ellipsis; filter: brightness(1.15); }
.sb-u-role {
  font-size: .50rem; color: var(--text-mute);
  letter-spacing: 1px; text-transform: uppercase;
}

/* DMs panel */
.sb-dms { padding: 12px; }
.dm-conv {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-bottom: 3px;
  border-radius: var(--r-sm); cursor: pointer;
  transition: .16s; border: 1px dashed transparent;
}
.dm-conv:hover { background: var(--g06); }
.dm-conv.active { background: var(--g06); border-color: var(--border); }
.dm-conv-info { flex: 1; min-width: 0; }
.dm-conv-name {
  font-size: .78rem; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 0 8px currentColor; filter: brightness(1.15);
}
.dm-conv-preview {
  font-size: .58rem; color: var(--text-mute);
  overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; margin-top: 1px;
}
.dm-conv-meta {
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 3px; flex-shrink: 0;
}
.dm-conv-time { font-size: .48rem; color: var(--text-mute); letter-spacing: .5px; }
.dm-conv-unread {
  font-size: .46rem; padding: 1px 5px; border-radius: 8px;
  background: var(--g); color: var(--bg); font-weight: 600; display: none;
}
.dm-conv-unread.on { display: inline; }
.dm-empty {
  text-align: center; padding: 30px 16px;
  color: var(--text-mute); font-size: .66rem; letter-spacing: 1px;
}
.dm-empty-ic { font-size: 26px; opacity: .12; margin-bottom: 8px; }

/* Sidebar footer */
.sb-foot {
  padding: 12px 14px; border-top: 1px dashed var(--border);
  display: flex; justify-content: space-between;
  align-items: center; flex-shrink: 0;
}
.sb-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border: 1px dashed var(--border);
  border-radius: 16px; font-size: .54rem; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--text-dim); background: var(--input-bg);
}
.dp {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--g); animation: blinkSlow 2.4s ease-in-out infinite;
  display: inline-block;
}
.sb-dc {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-mute); font-family: var(--mono);
  font-size: .54rem; cursor: pointer; letter-spacing: 1.1px;
  transition: .16s; padding: 5px 10px;
  border-radius: var(--r-sm); text-transform: uppercase;
}
.sb-dc:hover { border-color: var(--neg); color: var(--neg); background: rgba(220, 90, 70, .05); }

/* ─── Main content ───────────────────────────────────────────────────────── */
.mc {
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; position: relative; min-width: 0;
}

/* Chat header — triple-dot chrome bar */
.mc-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px;
  border-bottom: 1px dashed var(--head-border);
  background: linear-gradient(to right, var(--head-bg), transparent);
  flex-shrink: 0;
}
.mc-head-l { display: flex; align-items: center; gap: 12px; }
.mob-btn {
  display: none; background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-size: 1rem; padding: 5px 9px;
  border-radius: var(--r-sm); cursor: pointer;
  font-family: var(--mono); transition: .16s;
}
.mob-btn:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }
.mc-h-title {
  font-size: .76rem; font-weight: 600; color: var(--g-title);
  letter-spacing: 1.4px; text-transform: uppercase;
  text-shadow: var(--g-title-glow);
}
.mc-h-desc {
  font-size: .56rem; color: var(--text-dim);
  letter-spacing: 1px; display: block; margin-top: 1px;
}
.mc-head-r { display: flex; align-items: center; gap: 10px; }
.mc-h-user { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.mc-h-name { font-size: .74rem; font-weight: 700; letter-spacing: 1px; text-shadow: 0 0 8px currentColor; filter: brightness(1.15); }
.mc-exit {
  padding: 7px 13px; border-radius: var(--r-sm);
  border: 1px dashed var(--g-btn-border); background: 0;
  color: var(--text-dim); font-family: var(--mono);
  font-size: .62rem; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase;
  cursor: pointer; transition: .16s; box-shadow: var(--glow);
}
.mc-exit:hover {
  background: var(--g-btn-hover); border-color: var(--g);
  color: var(--g); box-shadow: var(--glow-lg); transform: translateY(-1px);
}
.mc-exit:active { transform: translateY(0) scale(.985); }

/* DM header */
.dm-head {
  display: none; align-items: center; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px dashed var(--head-border);
  background: linear-gradient(to right, var(--head-bg), transparent);
  flex-shrink: 0;
}
.dm-head.on { display: flex; }
.dm-back {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-family: var(--mono);
  font-size: .76rem; padding: 5px 10px;
  border-radius: var(--r-sm); cursor: pointer;
  transition: .16s; flex-shrink: 0;
}
.dm-back:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }
.dm-head-info {
  flex: 1; display: flex; align-items: center;
  gap: 10px; cursor: pointer; min-width: 0;
}
.dm-head-name {
  font-size: .76rem; font-weight: 600; color: var(--g);
  letter-spacing: 1.2px; text-transform: uppercase;
}
.dm-head-status {
  font-size: .52rem; color: var(--text-mute);
  letter-spacing: 1px; text-transform: uppercase;
}

/* ─── Messages area ──────────────────────────────────────────────────────── */
.msgs {
  flex: 1; overflow-y: auto; padding: 18px 24px;
  display: flex; flex-direction: column; gap: 3px;
}
.msgs-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 8px; color: var(--text-mute);
}
.msgs-empty-ic { font-size: 42px; opacity: .08; }
.msgs-empty-t { font-size: .76rem; letter-spacing: 2px; text-transform: uppercase; }
.msgs-empty-s { font-size: .56rem; letter-spacing: 1px; }

/* Date separators */
.d-sep { display: flex; align-items: center; gap: 14px; padding: 16px 0 10px; }
.d-sep-l { flex: 1; border-top: 1px dashed var(--g-sep); height: 0; background: none; }
.d-sep-t {
  font-size: .52rem; color: var(--text-mute); letter-spacing: 3px;
  text-transform: uppercase; white-space: nowrap;
  padding: 3px 12px; border: 1px dashed var(--border);
  border-radius: 10px; background: var(--input-bg);
}

/* System messages */
.s-msg {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 0; justify-content: center; animation: fadeIn .3s;
}
.s-msg-l { width: 30px; border-top: 1px dashed var(--g-sep); height: 0; flex-shrink: 0; background: none; }
.s-msg-t {
  font-size: .54rem; color: var(--text-mute); letter-spacing: 2px;
  text-transform: uppercase; white-space: nowrap; text-align: center;
}

/* Action messages */
.act-msg {
  padding: 6px 0; font-size: .76rem; color: var(--text-dim);
  font-style: italic; animation: fadeIn .3s; letter-spacing: .3px;
  text-align: center;
}
.act-msg strong { font-style: normal; font-weight: 600; cursor: pointer; }

/* Message rows */
.m-row { display: flex; width: 100%; animation: msgIn .2s; position: relative; }
.m-row.mi { justify-content: flex-end; }
.m-row.ot { justify-content: flex-start; }
.m-grp { display: flex; gap: 10px; max-width: 70%; }
.m-av { width: 32px; height: 32px; border-radius: 50%; font-size: .48rem; flex-shrink: 0; margin-top: 2px; }
.m-av.hid { visibility: hidden; width: 32px; }
.m-cnt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.m-au {
  font-size: .60rem; font-weight: 700; margin-bottom: 2px;
  letter-spacing: 1.2px; text-transform: uppercase;
  padding-left: 2px; display: flex; align-items: center;
  gap: 4px; cursor: pointer;
  text-shadow: 0 0 8px currentColor; filter: brightness(1.15);
}
.m-au:hover { text-decoration: underline; }
.m-bub {
  padding: 10px 14px; border-radius: var(--r);
  font-size: .82rem; line-height: 1.65;
  word-break: break-word; border: 1px dashed var(--border);
  position: relative;
}
.m-bub.mi {
  background: var(--g-bub-mi);
  border-color: var(--g-bub-mi-bdr);
  border-bottom-right-radius: 3px;
}
.m-bub.ot {
  background: var(--input-bg);
  border-bottom-left-radius: 3px;
}
.m-bub.deleted { opacity: .35; font-style: italic; }
.m-txt { color: var(--text); letter-spacing: .2px; white-space: pre-wrap; }
.m-txt a { color: var(--g); text-decoration: underline; text-underline-offset: 2px; }
.m-txt code {
  background: rgba(0,0,0,.38); padding: 2px 6px;
  border-radius: 3px; font-size: .74rem; color: var(--g70);
}
.m-meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 3px; }
.m-time { font-size: .50rem; color: var(--text-mute); letter-spacing: .6px; }
.m-del {
  display: none; background: 0; border: 1px dashed var(--border);
  color: var(--text-mute); font-family: var(--mono);
  font-size: .46rem; padding: 1px 5px; border-radius: 3px;
  cursor: pointer; letter-spacing: .5px; transition: .16s; text-transform: uppercase;
}
.m-row:hover .m-del { display: inline-block; }
.m-del:hover { border-color: var(--neg); color: var(--neg); background: rgba(220, 90, 70, .06); }

/* ─── Typing indicator ───────────────────────────────────────────────────── */
.typ {
  display: none; align-items: center; gap: 10px;
  padding: 4px 24px 2px; font-size: .58rem;
  color: var(--text-mute); letter-spacing: .6px; flex-shrink: 0;
}
.typ.on { display: flex; }
.typ-d { display: flex; gap: 3px; }
.typ-d span {
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--g40); animation: typeBounce 1.2s ease-in-out infinite;
}
.typ-d span:nth-child(2) { animation-delay: .15s; }
.typ-d span:nth-child(3) { animation-delay: .3s; }

/* ─── Command results ────────────────────────────────────────────────────── */
.cmd-res {
  padding: 8px 14px; margin: 4px 0;
  border-radius: var(--r-sm); font-size: .72rem;
  border: 1px dashed var(--border);
  background: var(--input-bg); color: var(--text-dim);
  animation: fadeIn .2s; letter-spacing: .3px; max-width: 500px;
  white-space: pre-wrap; line-height: 1.6;
}
.cmd-res.cmd-err { border-color: rgba(220, 90, 70, .22); color: var(--neg); }
.cmd-res.cmd-ok  { border-color: var(--g-bub-mi-bdr); color: var(--pos); }

/* ─── New message pill ───────────────────────────────────────────────────── */
.npill {
  position: absolute; bottom: 100px; left: 50%;
  transform: translateX(-50%);
  padding: 7px 18px; border-radius: 16px;
  background: var(--bg2);
  border: 1px dashed var(--g-btn-border); color: var(--g);
  font-size: .58rem; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  cursor: pointer; display: none; z-index: 10;
   box-shadow: var(--glow); transition: .16s;
}
.npill.on { display: block; animation: fadeUp .25s ease; }
.npill:hover { background: var(--g06); box-shadow: var(--glow-lg); }

/* ─── Input bar ──────────────────────────────────────────────────────────── */
.ibar {
  flex-shrink: 0; border-top: 1px dashed var(--border);
  background: var(--surface); padding: 14px 24px 16px;
}
.ibar-row { display: flex; align-items: flex-end; gap: 10px; width: 100%; }
.ibar-box {
  flex: 1; min-width: 0; display: flex; align-items: flex-end;
  background: var(--input-bg); border: 1px dashed var(--border);
  border-radius: var(--r-sm); padding: 12px 16px;
  transition: .16s; min-height: 50px; gap: 10px;
}
.ibar-box:focus-within {
  border-color: var(--border-act); border-style: solid;
  box-shadow: var(--glow);
  background: var(--input-bg-fo);
}
.i-prompt { color: var(--g40); font-size: .9rem; font-weight: 600; flex-shrink: 0; user-select: none; line-height: 1.5; }
.i-input {
  flex: 1; min-width: 0; background: 0; border: 0;
  color: var(--text); font-family: var(--mono);
  font-size: .86rem; padding: 0; resize: none;
  line-height: 1.5; max-height: 140px; letter-spacing: .3px;
  outline: 0; word-break: break-word;
}
.i-input::placeholder { color: var(--text-mute); }
.i-cc {
  font-size: .50rem; color: var(--text-mute); flex-shrink: 0;
  letter-spacing: .5px; align-self: flex-end;
  transition: color .15s; white-space: nowrap;
}
.i-cc.w { color: var(--warn); }
.i-cc.o { color: var(--neg); }
.i-send {
  padding: 12px 24px; border-radius: var(--r-sm);
  border: 1px dashed var(--g-btn-border); background: 0;
  color: var(--text-dim); font-family: var(--mono);
  font-size: .72rem; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase;
  cursor: pointer; transition: .16s;
  min-height: 50px; white-space: nowrap; flex-shrink: 0;
  box-shadow: var(--glow);
}
.i-send.ok {
  border-color: var(--g-btn-border);
  background: transparent; color: var(--g);
}
.i-send.ok:hover {
  background: var(--g-btn-hover);
  border-color: var(--g); color: var(--g);
  box-shadow: var(--glow-lg); transform: translateY(-1px);
}
.i-send.ok:active { transform: translateY(0) scale(.985); }
.i-send:disabled { opacity: .2; cursor: not-allowed; }

/* ─── Attach button ─────────────────────────────────────────────────────── */
.i-attach {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-size: 1.1rem;
  width: 50px; min-height: 50px; border-radius: var(--r-sm);
  cursor: pointer; transition: .16s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.i-attach:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }

/* ─── Image preview (pending attachment) ────────────────────────────────── */
.img-preview {
  display: none; position: relative;
  padding: 8px 12px; margin-bottom: 4px;
}
.img-preview.on { display: flex; align-items: flex-start; gap: 8px; }
.img-preview img {
  max-width: 200px; max-height: 120px; border-radius: var(--r-sm);
  border: 1px dashed var(--border-hi); object-fit: contain;
}
.img-preview-close {
  background: var(--bg2); border: 1px dashed var(--border);
  color: var(--text-dim); font-size: .7rem;
  width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; transition: .16s;
  display: flex; align-items: center; justify-content: center;
  position: absolute; top: 4px; right: 8px;
}
.img-preview-close:hover { border-color: var(--neg); color: var(--neg); }

/* ─── Inline images in messages ─────────────────────────────────────────── */
.m-img {
  margin: 4px 0;
}
.m-img img {
  max-width: 320px; max-height: 280px;
  border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--border);
  object-fit: contain; display: block;
  transition: .15s;
}
.m-img img:hover { border-color: var(--g); box-shadow: var(--glow); }
@media (max-width: 768px) {
  .m-img img { max-width: 220px; max-height: 200px; }
}

/* ─── Drag over indicator ───────────────────────────────────────────────── */
.ibar.drag-over { outline: 2px dashed var(--g); outline-offset: -2px; }

/* ─── Image lightbox ────────────────────────────────────────────────────── */
.lightbox-ov {
  display: none; position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.85);  align-items: center; justify-content: center;
  cursor: pointer;
}
.lightbox-ov.on { display: flex; }
.lightbox-img {
  max-width: 90vw; max-height: 85vh;
  border-radius: var(--r); border: 1px solid var(--border-hi);
  object-fit: contain; cursor: default;
  box-shadow: 0 8px 48px rgba(0,0,0,.6);
}
.lightbox-close {
  position: fixed; top: 16px; right: 20px; z-index: 401;
  background: rgba(0,0,0,.6); border: 1px dashed var(--border);
  color: var(--text-dim); font-size: 1.1rem;
  width: 36px; height: 36px; border-radius: 50%;
  cursor: pointer; transition: .16s;
  display: flex; align-items: center; justify-content: center;
}
.lightbox-close:hover { border-color: var(--neg); color: var(--neg); }

/* ─── Overlays ───────────────────────────────────────────────────────────── */
.sb-ov {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); z-index: 99;
}
.sb-ov.on { display: block; }

/* User popup */
.u-popup-ov { display: none; position: fixed; inset: 0; z-index: 500; background: rgba(0,0,0,.45); }
.u-popup-ov.on { display: block; }
[data-theme="light"] .u-popup-ov { background: rgba(0,0,0,.15); }
.u-popup {
  position: fixed; z-index: 501; width: 230px;
  background: var(--bg2); border: 1px dashed var(--border-hi);
  border-radius: var(--r);
  box-shadow: var(--shadow), 0 8px 32px rgba(0,0,0,.6);
  overflow: hidden; animation: fadeUp .15s ease;
}
[data-theme="light"] .u-popup {
  background: #f4f4ee;
  box-shadow: 0 2px 12px rgba(0,0,0,.12), 0 8px 32px rgba(0,0,0,.10);
  border-color: rgba(58, 122, 40, .30);
}
.u-popup-close {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-size: .7rem;
  width: 24px; height: 24px; border-radius: 50%;
  cursor: pointer; transition: .16s;
  display: flex; align-items: center; justify-content: center;
}
.u-popup-close:hover { border-color: var(--neg); color: var(--neg); }
.u-popup-head {
  padding: 12px 14px 10px; border-bottom: 1px dashed var(--border);
  background: linear-gradient(to right, var(--head-bg), transparent);
  display: flex; align-items: center; gap: 10px;
  position: relative;
}
.u-popup-info { flex: 1; min-width: 0; }
.u-popup-name {
  font-size: .78rem; font-weight: 700;
  display: flex; align-items: center; gap: 4px;
  overflow: hidden; white-space: nowrap;
  text-shadow: 0 0 8px currentColor;
}
.u-popup-name span { overflow: hidden; text-overflow: ellipsis; filter: brightness(1.15); }
.u-popup-role {
  font-size: .50rem; color: var(--text-mute);
  letter-spacing: 1.1px; text-transform: uppercase; margin-top: 1px;
}
.u-popup-body { padding: 6px; }
.u-popup-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 12px;
  background: 0; border: 0; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: .62rem; font-weight: 500;
  letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-dim); cursor: pointer;
  transition: .16s; text-align: left;
}
.u-popup-btn:hover { background: var(--g06); color: var(--text); }
.u-popup-btn.danger { color: rgba(220, 90, 70, .55); }
.u-popup-btn.danger:hover { background: rgba(220, 90, 70, .06); color: var(--neg); }
.u-popup-btn .p-icon { width: 16px; text-align: center; font-size: .70rem; opacity: .45; }
.u-popup-sep { height: 1px; border-top: 1px dashed var(--border); margin: 4px 10px; background: none; }

/* Confirm dialog */
.confirm-ov {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: var(--ov-bg);  align-items: center; justify-content: center;
}
.confirm-ov.on { display: flex; }
.confirm-box {
  width: 320px; max-width: 90vw;
  background: var(--bg2); border: 1px dashed var(--border-hi);
  border-radius: var(--r);
  box-shadow: var(--shadow), 0 12px 48px rgba(0,0,0,.7);
  overflow: hidden; animation: fadeUp .15s ease;
}
.confirm-head {
  padding: 14px 18px 10px; border-bottom: 1px dashed var(--border);
  background: linear-gradient(to right, var(--head-bg), transparent);
  font-size: .72rem; font-weight: 600; color: var(--g);
  letter-spacing: 1.2px; text-transform: uppercase;
  display: flex; align-items: center; gap: 8px;
}
.confirm-body {
  padding: 16px 18px; font-size: .76rem;
  color: var(--text); line-height: 1.6;
}
.confirm-body strong { color: var(--g90); }
.confirm-body .confirm-warn {
  font-size: .62rem; color: var(--text-dim); margin-top: 6px;
}
.confirm-btns {
  display: flex; gap: 8px; padding: 10px 18px 16px;
  justify-content: flex-end;
}
.confirm-btn {
  padding: 8px 16px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: .64rem; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase; cursor: pointer;
  transition: .16s; box-shadow: var(--glow);
}
.confirm-btn.cancel {
  background: 0; border: 1px dashed var(--border); color: var(--text-dim);
}
.confirm-btn.cancel:hover { border-color: var(--text); color: var(--text); }
.confirm-btn.proceed {
  background: transparent; border: 1px dashed var(--g-btn-border); color: var(--g);
}
.confirm-btn.proceed:hover { background: var(--g-btn-hover); border-color: var(--g); box-shadow: var(--glow-lg); }
.confirm-btn.proceed.danger {
  background: transparent;
  border: 1px dashed rgba(220, 90, 70, .28); color: var(--neg);
}
.confirm-btn.proceed.danger:hover { background: rgba(220, 90, 70, .06); border-color: var(--neg); }

/* Profile overlay */
.prof-ov {
  display: none; position: fixed; inset: 0; z-index: 250;
  background: var(--ov-bg);  align-items: center; justify-content: center;
}
.prof-ov.on { display: flex; }
.prof-box {
  width: 380px; max-width: 92vw; max-height: 85vh;
  overflow-y: auto; background: var(--bg2);
  border: 1px dashed var(--border-hi); border-radius: var(--r);
  box-shadow: var(--shadow), 0 12px 48px rgba(0,0,0,.7);
  animation: fadeUp .2s ease;
}
.prof-header {
  padding: 22px 22px 16px; text-align: center;
  border-bottom: 1px dashed var(--border);
  background: linear-gradient(to right, var(--head-bg), transparent);
  position: relative;
}
.prof-close {
  position: absolute; top: 10px; right: 10px;
  background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-family: var(--mono);
  font-size: .8rem; width: 28px; height: 28px;
  border-radius: 50%; cursor: pointer; transition: .16s;
  display: flex; align-items: center; justify-content: center;
}
.prof-close:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }
.prof-av {
  width: 68px; height: 68px; border-radius: 50%;
  margin: 0 auto 12px; display: flex;
  align-items: center; justify-content: center;
  font-size: 1.1rem; font-weight: 600; color: rgba(0,0,0,.65);
  overflow: hidden; border: 2px dashed var(--border-hi);
}
.prof-av img { width: 100%; height: 100%; object-fit: cover; }
.prof-name {
  font-size: .90rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  text-shadow: 0 0 10px currentColor; filter: brightness(1.15);
}
.prof-role-line {
  font-size: .52rem; color: var(--text-mute);
  letter-spacing: 2px; text-transform: uppercase; margin-top: 4px;
}
.prof-bio {
  font-size: .72rem; color: var(--text-dim); line-height: 1.6;
  padding: 0 8px; margin-top: 10px; text-align: center;
  word-break: break-word; white-space: pre-wrap;
}
.prof-bio.empty { font-style: italic; color: var(--text-mute); }
.prof-body { padding: 16px 22px 22px; }
.prof-stats { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.prof-stat {
  text-align: center; padding: 8px 14px;
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  background: var(--input-bg); flex: 1;
}
.prof-stat-v { font-size: .78rem; font-weight: 600; color: var(--g); }
.prof-stat-l {
  font-size: .50rem; color: var(--text-mute);
  letter-spacing: 1.2px; text-transform: uppercase; margin-top: 2px;
}
.prof-edit-section { border-top: 1px dashed var(--border); padding-top: 14px; margin-top: 8px; }
.prof-save {
  width: 100%; padding: 10px;
  border: 1px dashed var(--g-btn-border); border-radius: var(--r-sm);
  background: transparent; color: var(--g);
  font-family: var(--mono); font-size: .68rem; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase;
  cursor: pointer; transition: .16s; margin-top: 12px;
  box-shadow: var(--glow);
}
.prof-save:hover { background: var(--g-btn-hover); border-color: var(--g); box-shadow: var(--glow-lg); }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sb {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 100; transform: translateX(-100%);
    transition: transform .25s ease;
    width: 280px; min-width: 280px;
    background: var(--bg2);
  }
  .sb.open { transform: translateX(0); }
  .mob-btn { display: block; }
  .sb-close { display: flex; }
  .m-grp { max-width: 88%; }
  .i-input { font-size: 16px; }
  .ibar { padding: 10px 14px 14px; }
  .ibar-box { padding: 10px 12px; }
  .msgs { padding: 12px 14px; }
  .mc-head, .dm-head { padding: 10px 14px; }
  .mc-h-name { display: none; }
  .i-send { padding: 12px 16px; font-size: .66rem; letter-spacing: 1px; }
  /* Center popup on mobile instead of anchoring to element */
  .u-popup {
    top: 50% !important; left: 50% !important;
    transform: translate(-50%, -50%);
    width: 260px;
  }
}

@media (max-width: 400px) {
  .sb { width: 85%; min-width: 85%; }
  .i-send { padding: 12px; letter-spacing: .8px; }
}

/* ─── Reduced motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dp, .ld-logo, .sb-nav-tab .unread-dot, .a-sub { animation: none !important; }
  .a-btn, .mc-exit, .i-send, .mob-btn, .sb-dc, .sb-close,
  .confirm-btn, .prof-save, .prof-close, .dm-back, .npill,
  .sb-u, .dm-conv, .fld-inp, .fld-ta, .ibar-box { transition: none !important; }
  .sb::before, .a-card::before { display: none; }
}

/* ─── Clickable elements ─────────────────────────────────────────────────── */
.clickable-name { cursor: pointer; }
.clickable-name:hover { text-decoration: underline; }

/* ─── Theme toggle ──────────────────────────────────────────────────────── */
.theme-toggle {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-family: var(--mono);
  font-size: .76rem; width: 32px; height: 32px;
  border-radius: var(--r-sm); cursor: pointer;
  transition: .16s; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.theme-toggle:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }

/* ─── Reply bar above input ─────────────────────────────────────────────── */
.reply-bar {
  display: none; align-items: center; justify-content: space-between;
  padding: 8px 16px; margin-bottom: 8px;
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  background: var(--input-bg); animation: fadeIn .15s;
}
.reply-bar.on { display: flex; }
.reply-bar-content { display: flex; align-items: center; flex: 1; min-width: 0; gap: 6px; }
.reply-bar-label { font-size: .52rem; color: var(--text-mute); letter-spacing: 1.5px; text-transform: uppercase; flex-shrink: 0; }
.reply-bar-name { font-size: .66rem; font-weight: 600; flex-shrink: 0; }
.reply-bar-snippet { font-size: .64rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.reply-bar-close {
  background: 0; border: 0; color: var(--text-mute); font-family: var(--mono);
  font-size: .8rem; cursor: pointer; padding: 2px 6px; flex-shrink: 0; transition: .16s;
}
.reply-bar-close:hover { color: var(--neg); }

/* ─── Quoted reply in message bubble ────────────────────────────────────── */
.m-reply {
  padding: 6px 10px; margin-bottom: 6px;
  border-left: 2px solid var(--g40);
  border-radius: 2px; background: var(--g06);
  cursor: pointer;
}
.m-reply-name { font-size: .52rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; }
.m-reply-text { font-size: .64rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }

/* ─── Reply button on hover ─────────────────────────────────────────────── */
.m-reply-btn {
  display: none; background: 0; border: 1px dashed var(--border);
  color: var(--text-mute); font-family: var(--mono);
  font-size: .46rem; padding: 1px 5px; border-radius: 3px;
  cursor: pointer; letter-spacing: .5px; transition: .16s; text-transform: uppercase;
}
.m-row:hover .m-reply-btn { display: inline-block; }
.m-reply-btn:hover { border-color: var(--g); color: var(--g); }

/* ─── @mention highlights ───────────────────────────────────────────────── */
.mention { color: var(--g); font-weight: 600; cursor: pointer; }
.mention-me { background: var(--g10); padding: 0 3px; border-radius: 3px; }

/* ─── Mention autocomplete dropdown ─────────────────────────────────────── */
.mention-drop {
  display: none; position: absolute; bottom: 100%; left: 24px;
  width: 220px; max-height: 200px; overflow-y: auto;
  background: var(--bg2); border: 1px dashed var(--border-hi);
  border-radius: var(--r-sm); z-index: 50;
  box-shadow: 0 -4px 16px rgba(0,0,0,.5);
  margin-bottom: 4px;
}
.mention-drop.on { display: block; }
.mention-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer; transition: .1s;
  font-size: .68rem; color: var(--text);
}
.mention-item:hover, .mention-item.active { background: var(--g06); }
.mention-item-av {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .36rem; font-weight: 600; color: rgba(0,0,0,.65);
  overflow: hidden;
}
.mention-item-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ─── Crop overlay ──────────────────────────────────────────────────────── */
.crop-ov {
  display: none; position: fixed; inset: 0; z-index: 260;
  background: rgba(0,0,0,.75);  align-items: center; justify-content: center;
}
.crop-ov.on { display: flex; }
.crop-box {
  width: 380px; max-width: 92vw;
  background: var(--bg2); border: 1px dashed var(--border-hi);
  border-radius: var(--r); overflow: hidden;
  box-shadow: var(--shadow), 0 12px 48px rgba(0,0,0,.7);
  animation: fadeUp .2s ease;
}
.crop-head {
  padding: 14px 18px; border-bottom: 1px dashed var(--border);
  font-size: .72rem; font-weight: 600; color: var(--g);
  letter-spacing: 1.2px; text-transform: uppercase;
  background: linear-gradient(to right, var(--head-bg), transparent);
}
.crop-canvas-wrap {
  position: relative; padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--input-bg); gap: 12px;
}
.crop-canvas-wrap canvas { max-width: 100%; border-radius: 4px; cursor: crosshair; display: block; }
.crop-size-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0 4px; }
.crop-size-label { font-size: .52rem; color: var(--text-mute); letter-spacing: 1px; text-transform: uppercase; flex-shrink: 0; }
.crop-size-slider {
  flex: 1; -webkit-appearance: none; appearance: none; height: 3px;
  background: var(--border); border-radius: 2px; outline: none;
}
.crop-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  border-radius: 50%; background: var(--g); cursor: pointer;
  border: 2px solid var(--bg2);
}
.crop-btns { display: flex; gap: 8px; padding: 10px 18px 16px; justify-content: flex-end; }

/* Profile upload button */
.prof-av-upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.prof-upload-btn {
  padding: 8px 14px; border: 1px dashed var(--border);
  border-radius: var(--r-sm); background: 0;
  color: var(--text-dim); font-family: var(--mono);
  font-size: .64rem; letter-spacing: 1px; text-transform: uppercase;
  cursor: pointer; transition: .16s; white-space: nowrap;
}
.prof-upload-btn:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }
.prof-av-or { font-size: .54rem; color: var(--text-mute); letter-spacing: 1px; }

/* ═══════════════════════════════════════════════════════════════════════════ */
/* NEW FEATURE CSS — Price Ticker, Alerts, Reactions, Search, Mobile Polish  */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Price Ticker ───────────────────────────────────────────────────────── */
.price-ticker {
  display: none; /* hidden until user logs in */
  flex-shrink: 0; align-items: center;
  padding: 0 16px; height: 30px;
  border-bottom: 1px dashed var(--border);
  background: linear-gradient(to right, var(--head-bg), transparent);
  font-size: .58rem; letter-spacing: .8px; overflow: hidden;
}
.price-ticker.on { display: flex; }
.ticker-inner {
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap; overflow: hidden; width: 100%;
}
.ticker-live {
  display: flex; align-items: center; gap: 5px;
  color: var(--pos); font-weight: 600; letter-spacing: 1.5px;
  font-size: .52rem; flex-shrink: 0;
}
.ticker-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--pos); display: inline-block;
  animation: blinkSlow 2s ease-in-out infinite;
}
.ticker-item { color: var(--text-dim); flex-shrink: 0; }
.ticker-price { color: var(--text); font-weight: 500; }
.ticker-change { font-size: .54rem; margin-left: 3px; }
.ticker-change.pos { color: var(--pos); }
.ticker-change.neg { color: var(--neg); }
.ticker-sep { color: var(--border-hi); flex-shrink: 0; }

/* Mobile: hide some ticker items */
@media (max-width: 768px) {
  .ticker-hide-mobile { display: none !important; }
  #tickMcapMobile { display: inline !important; }
  .price-ticker { padding: 0 10px; }
}

/* ─── Header icon buttons (search, bell) ─────────────────────────────────── */
.head-icon-btn {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-dim); font-size: .88rem;
  width: 32px; height: 32px; border-radius: var(--r-sm);
  cursor: pointer; transition: .16s;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; padding: 0;
}
.head-icon-btn:hover { border-color: var(--g); color: var(--g); box-shadow: var(--glow); }
.head-icon-btn.on { border-color: var(--g); color: var(--g); background: var(--g06); }

/* ─── Search bar ─────────────────────────────────────────────────────────── */
.search-bar {
  display: none; flex-shrink: 0;
  padding: 8px 16px;
  border-bottom: 1px dashed var(--border);
  background: var(--surface); animation: fadeUp .15s ease;
}
.search-bar.on { display: block; }
.search-bar-inner {
  display: flex; align-items: center; gap: 8px;
  background: var(--input-bg); border: 1px dashed var(--border);
  border-radius: var(--r-sm); padding: 8px 12px;
  transition: .16s;
}
.search-bar-inner:focus-within {
  border-color: var(--border-act); border-style: solid; box-shadow: var(--glow);
}
.search-icon { color: var(--text-mute); font-size: .84rem; flex-shrink: 0; }
.search-input {
  flex: 1; background: 0; border: 0;
  color: var(--text); font-family: var(--mono);
  font-size: .80rem; outline: 0; padding: 0;
}
.search-input::placeholder { color: var(--text-mute); }
.search-count {
  font-size: .56rem; color: var(--text-mute); flex-shrink: 0;
  letter-spacing: .6px; min-width: 50px; text-align: right;
}
.search-close {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-mute); font-family: var(--mono);
  font-size: .7rem; width: 22px; height: 22px; border-radius: 50%;
  cursor: pointer; transition: .16s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.search-close:hover { border-color: var(--neg); color: var(--neg); }

/* Search highlight */
mark {
  background: rgba(120, 177, 90, .30);
  color: var(--g); border-radius: 2px;
  padding: 0 2px;
}
[data-theme="light"] mark { background: rgba(58, 122, 40, .20); }

/* ─── Alerts panel ───────────────────────────────────────────────────────── */
.sb-alerts { padding: 10px; }
.alert-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px 10px; margin-bottom: 4px;
  border-radius: var(--r-sm); border: 1px dashed var(--border);
  background: var(--input-bg); animation: fadeIn .2s;
  transition: .16s;
}
.alert-item:hover { border-color: var(--border-hi); }
.alert-item.buy { border-left: 2px solid var(--pos); }
.alert-item.sell { border-left: 2px solid var(--neg); }
.alert-tier { font-size: 1.1rem; flex-shrink: 0; line-height: 1.2; }
.alert-body { flex: 1; min-width: 0; }
.alert-main {
  font-size: .66rem; font-weight: 600; color: var(--text);
  letter-spacing: .5px;
}
.alert-sol { color: var(--pos); font-weight: 700; }
.alert-mcap { color: var(--text-dim); font-size: .60rem; }
.alert-sub {
  font-size: .58rem; color: var(--text-mute); margin-top: 2px;
}
.alert-addr { color: var(--g55); font-family: var(--mono); }
.alert-time {
  font-size: .48rem; color: var(--text-mute);
  letter-spacing: .5px; flex-shrink: 0; margin-top: 2px;
}
.alert-item.sell .alert-sol { color: var(--neg); }

/* Alert unread badge in nav */
.sb-nav-tab .unread-num { display: none; }
.sb-nav-tab .unread-num.on { display: inline; }

/* ─── Message Reactions ──────────────────────────────────────────────────── */
.m-reactions {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.m-react-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 7px; border-radius: 10px;
  font-size: .72rem; cursor: pointer;
  background: var(--input-bg); border: 1px dashed var(--border);
  color: var(--text-dim); transition: .12s;
  font-family: var(--mono);
}
.m-react-chip:hover { border-color: var(--border-hi); background: var(--g06); }
.m-react-chip.mine { background: var(--g10); border-color: var(--g40); color: var(--g); }

.m-react-btn {
  display: none; background: 0; border: 1px dashed var(--border);
  color: var(--text-mute); font-family: var(--mono);
  font-size: .58rem; padding: 0px 5px; border-radius: 3px;
  cursor: pointer; letter-spacing: .5px; transition: .16s;
  font-weight: 700; line-height: 1.6;
}
.m-row:hover .m-react-btn { display: inline-block; }
.m-react-btn:hover { border-color: var(--g); color: var(--g); }

/* Emoji picker popup */
.emoji-picker {
  position: fixed; z-index: 600;
  display: none; flex-wrap: nowrap; gap: 4px;
  background: var(--bg2); border: 1px dashed var(--border-hi);
  border-radius: var(--r); padding: 8px 10px;
  box-shadow: var(--shadow), 0 6px 24px rgba(0,0,0,.6);
  animation: fadeUp .12s ease;
}
.emoji-opt {
  background: 0; border: 1px dashed transparent; border-radius: var(--r-sm);
  font-size: 1.1rem; padding: 4px 6px; cursor: pointer; transition: .12s;
  line-height: 1;
}
.emoji-opt:hover { background: var(--g06); border-color: var(--border); transform: scale(1.15); }

/* Mobile: long-press shows react btn */
@media (max-width: 768px) {
  .m-react-btn { display: inline-block; } /* Always show on mobile */
  .m-react-chip { font-size: .66rem; padding: 2px 6px; }
}

/* ─── Profile enhancements ───────────────────────────────────────────────── */
.prof-link {
  font-size: .64rem; margin-top: 6px; text-align: center;
}
.prof-link a {
  color: var(--g); text-decoration: none;
  border-bottom: 1px dashed var(--g40);
  padding-bottom: 1px;
}
.prof-link a:hover { border-bottom-color: var(--g); }

@media (max-width: 768px) {
  .m-reply-btn, .m-del {
    min-height: 36px; padding: 6px 8px;
    display: inline-flex; align-items: center; justify-content: center;
  }
}

/* ─── Chat screen structure with ticker ──────────────────────────────────── */
#S_chat { flex-direction: column; position: relative; overflow: hidden; }
.chat-wrap { flex: 1; overflow: hidden; display: flex; min-height: 0; }

/* ─── Profile wallet copy/link area ─────────────────────────────────────── */
.prof-wallet-row {
  display: flex; align-items: center; gap: 6px;
  font-size: .62rem; margin-top: 4px; justify-content: center;
}
.prof-copy-btn {
  background: 0; border: 1px dashed var(--border);
  color: var(--text-mute); font-family: var(--mono);
  font-size: .52rem; padding: 2px 6px; border-radius: 3px;
  cursor: pointer; transition: .16s; letter-spacing: .5px;
}
.prof-copy-btn:hover { border-color: var(--g); color: var(--g); }


/* ─── Floating theme toggle ─────────────────────────────────────────────── */
.theme-toggle-float {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 36px; height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  color: var(--text-soft);
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  z-index: 9999;
  box-shadow: var(--shadow), var(--glow);
  transition: background .15s, border-color .15s, color .15s, transform .12s;
}
.theme-toggle-float:hover {
  background: var(--bg3);
  border-color: var(--border-act);
  color: var(--g);
  transform: translateY(-1px);
}
.theme-toggle-float:active { transform: translateY(0); }
