/* Private Chat: WhatsApp-style look, light + dark. */
:root {
  --bg: #eae6df;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --border: #e9edef;
  --text: #111b21;
  --muted: #667781;
  --green: #00a884;
  --green-dark: #008069;
  --chat-bg: #efeae2;
  --pattern: rgba(84, 101, 111, .07);
  --in: #ffffff;
  --out: #d9fdd3;
  --tick: #53bdeb;
  --hover: #f5f6f6;
  --active: #f0f2f5;
  --shadow: 0 1px .5px rgba(11, 20, 26, .13);
  --shadow-lg: 0 2px 5px rgba(11, 20, 26, .26), 0 2px 10px rgba(11, 20, 26, .16);
  --danger: #ea0038;
  --link: #027eb5;
  --sys: #ffffff;
  --sys-text: #54656f;
  --quote-in: #f5f6f6;
  --quote-out: #d1f4cc;
  --input: #ffffff;
  --badge: #25d366;
  --warn-bg: #fff4e5;
  --warn-text: #7a4a00;
  --warn-border: #f5c26b;
  --chip: #e7fce3;
  --chip-text: #0a5c45;
  --overlay: rgba(11, 20, 26, .55);
  --c0: #1f7aec; --c1: #d3396d; --c2: #008069; --c3: #c4532d; --c4: #6f42c1; --c5: #027eb5;
  --c6: #9a6b3f; --c7: #c2368f; --c8: #1b8755; --c9: #a62c71; --c10: #5e6ad2; --c11: #b25f00;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c1317; --panel: #111b21; --panel-2: #202c33; --border: #222d34; --text: #e9edef; --muted: #8696a0;
    --chat-bg: #0b141a; --pattern: rgba(233, 237, 239, .035); --in: #202c33; --out: #005c4b; --hover: #202c33;
    --active: #2a3942; --shadow: 0 1px .5px rgba(0, 0, 0, .3); --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5);
    --link: #53bdeb; --sys: #182229; --sys-text: #8696a0; --quote-in: #1d282f; --quote-out: #025144;
    --input: #2a3942; --warn-bg: #3a2a10; --warn-text: #ffd38a; --warn-border: #7a5a1c; --chip: #103629; --chip-text: #7be0b9;
    --overlay: rgba(0, 0, 0, .7);
    --c0: #53a6fd; --c1: #ff72a1; --c2: #25d366; --c3: #fc9775; --c4: #a791ff; --c5: #53bdeb;
    --c6: #d3a87c; --c7: #ff7ed3; --c8: #42c7b8; --c9: #e26ab6; --c10: #8b95ff; --c11: #ffbc38;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c1317; --panel: #111b21; --panel-2: #202c33; --border: #222d34; --text: #e9edef; --muted: #8696a0;
  --chat-bg: #0b141a; --pattern: rgba(233, 237, 239, .035); --in: #202c33; --out: #005c4b; --hover: #202c33;
  --active: #2a3942; --shadow: 0 1px .5px rgba(0, 0, 0, .3); --shadow-lg: 0 2px 8px rgba(0, 0, 0, .5);
  --link: #53bdeb; --sys: #182229; --sys-text: #8696a0; --quote-in: #1d282f; --quote-out: #025144;
  --input: #2a3942; --warn-bg: #3a2a10; --warn-text: #ffd38a; --warn-border: #7a5a1c; --chip: #103629; --chip-text: #7be0b9;
  --overlay: rgba(0, 0, 0, .7);
  --c0: #53a6fd; --c1: #ff72a1; --c2: #25d366; --c3: #fc9775; --c4: #a791ff; --c5: #53bdeb;
  --c6: #d3a87c; --c7: #ff7ed3; --c8: #42c7b8; --c9: #e26ab6; --c10: #8b95ff; --c11: #ffbc38;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14.2px/1.4 "Segoe UI", "Helvetica Neue", Helvetica, "Lucida Grande", Arial, "Nirmala UI", "Noto Sans Tamil", "Tamil Sangam MN", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--link); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

.ic { display: inline-flex; width: 24px; height: 24px; flex: none; }
.ic svg { width: 100%; height: 100%; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center;
  color: var(--muted); flex: none; transition: background .15s;
}
.icon-btn:hover { background: var(--active); }
.icon-btn:focus-visible, .btn:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ---------- boot + login ---------- */
.boot { height: 100%; display: grid; place-items: center; }
.boot-logo { width: 64px; height: 64px; background: url(/img/icon.svg) center/contain no-repeat; opacity: .5; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .9; } }

.login { height: 100%; overflow: auto; background: var(--panel-2); }
.login-top { height: 222px; background: var(--green-dark); }
.login-card {
  max-width: 440px; margin: -150px auto 40px; background: var(--panel); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 36px 36px 28px; position: relative;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .logo { width: 44px; height: 44px; background: url(/img/icon.svg) center/contain no-repeat; flex: none; }
.login-brand h1 { font-size: 20px; font-weight: 500; margin: 0; }
.login-brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
.field { position: relative; }
.field input, .text-input {
  width: 100%; padding: 11px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--input);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .text-input:focus { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }
.field .eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; color: var(--muted); display: grid; place-items: center; }
.field .eye .ic { width: 20px; height: 20px; }
.login-note { margin-top: 18px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.login-note .ic { width: 16px; height: 16px; margin-top: 1px; }
.form-error { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: rgba(234, 0, 56, .08); color: var(--danger); font-size: 13px; }
.notice { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); font-size: 13px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 24px;
  font-weight: 500; font-size: 14px; border: 1px solid var(--border); background: var(--panel); color: var(--green-dark);
  transition: background .15s, box-shadow .15s;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { padding: 5px 12px; font-size: 13px; }
.btn.block { width: 100%; margin-top: 22px; padding: 11px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn .ic { width: 18px; height: 18px; }

/* ---------- layout ---------- */
.layout { position: relative; height: 100vh; height: 100dvh; display: flex; overflow: hidden; background: var(--panel); }
.side {
  width: 30%; min-width: 300px; max-width: 420px; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); background: var(--panel); z-index: 5;
}
.side-head, .chat-head {
  height: 59px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px 0 16px;
  background: var(--panel-2);
}
.side-head { justify-content: space-between; }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-sub { font-size: 12px; color: var(--muted); }
.head-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.side-scroll { flex: 1; overflow-y: auto; }
.room-card {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 15px; text-align: left;
  background: var(--active); border-bottom: 1px solid var(--border);
}
.rc-body { flex: 1; min-width: 0; }
.rc-top, .rc-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.rc-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-time { font-size: 12px; color: var(--muted); flex: none; }
.rc-last { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--badge); color: #fff;
  font-size: 12px; font-weight: 600; display: inline-grid; place-items: center; flex: none;
}
.side-title { padding: 18px 16px 8px; font-size: 13px; color: var(--green-dark); font-weight: 500; text-transform: uppercase; letter-spacing: .03em; }
.search { margin: 0 12px 6px; display: flex; align-items: center; gap: 10px; background: var(--panel-2); border-radius: 8px; padding: 0 12px; color: var(--muted); }
.search .ic { width: 18px; height: 18px; }
.search input { flex: 1; border: 0; background: none; outline: none; padding: 8px 0; min-width: 0; }
.member { display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.member:hover { background: var(--hover); }
.av-wrap { position: relative; flex: none; }
.av-wrap .dot { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--badge); border: 2px solid var(--panel); }
.m-body { flex: 1; min-width: 0; }
.m-top { display: flex; align-items: center; gap: 6px; }
.m-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sub.on { color: var(--green-dark); }
.member .m-act { opacity: 0; }
.member:hover .m-act, .member .m-act:focus-visible { opacity: 1; }
.tag { font-size: 11px; color: var(--green-dark); background: var(--chip); padding: 1px 6px; border-radius: 4px; flex: none; font-weight: 500; }
.side-foot { padding: 10px 16px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--border); }
.side-foot .ic { width: 14px; height: 14px; }
.empty { padding: 20px 16px; color: var(--muted); text-align: center; font-size: 13px; }

/* avatars */
.av {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .02em; user-select: none;
}
.av.sm { width: 32px; height: 32px; font-size: 13px; }
.av.xl { width: 120px; height: 120px; font-size: 44px; }
.av.room { background: var(--green); }
.av.room .ic { width: 60%; height: 60%; }
.av.c0 { background: var(--c0); } .av.c1 { background: var(--c1); } .av.c2 { background: var(--c2); } .av.c3 { background: var(--c3); }
.av.c4 { background: var(--c4); } .av.c5 { background: var(--c5); } .av.c6 { background: var(--c6); } .av.c7 { background: var(--c7); }
.av.c8 { background: var(--c8); } .av.c9 { background: var(--c9); } .av.c10 { background: var(--c10); } .av.c11 { background: var(--c11); }
.nc0 { color: var(--c0); } .nc1 { color: var(--c1); } .nc2 { color: var(--c2); } .nc3 { color: var(--c3); }
.nc4 { color: var(--c4); } .nc5 { color: var(--c5); } .nc6 { color: var(--c6); } .nc7 { color: var(--c7); }
.nc8 { color: var(--c8); } .nc9 { color: var(--c9); } .nc10 { color: var(--c10); } .nc11 { color: var(--c11); }

/* ---------- chat ---------- */
.chat { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; background: var(--chat-bg); }
.chat-head { border-left: 1px solid var(--border); padding-left: 10px; z-index: 2; }
.ch-info { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; text-align: left; padding: 4px; border-radius: 8px; }
.ch-text { min-width: 0; }
.ch-name { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-sub.typing { color: var(--green-dark); }
.chat-body { flex: 1; position: relative; min-height: 0; }
.messages {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: 12px 0 8px;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--pattern) 1.3px, transparent 1.4px), radial-gradient(var(--pattern) 1.3px, transparent 1.4px);
  background-size: 26px 26px; background-position: 0 0, 13px 13px;
}
.chat.drop .messages { outline: 3px dashed var(--green); outline-offset: -12px; }
.loader { text-align: center; color: var(--muted); font-size: 13px; padding: 8px; }
.day { text-align: center; margin: 12px 0 8px; }
.day span, .sys span, .unread-div span {
  display: inline-block; padding: 5px 12px; border-radius: 7.5px; background: var(--sys); color: var(--sys-text);
  font-size: 12.5px; box-shadow: var(--shadow);
}
.sys { text-align: center; margin: 6px 0; padding: 0 12%; }
.sys span { font-size: 12.5px; }
.unread-div { text-align: center; margin: 10px 0; background: rgba(255, 255, 255, .25); padding: 3px 0; }
.unread-div span { color: var(--green-dark); font-weight: 500; }

.row { display: flex; padding: 0 6%; margin-top: 10px; }
.row.cont { margin-top: 2px; }
.row.out { justify-content: flex-end; }
.bubble {
  position: relative; max-width: min(65%, 560px); padding: 6px 7px 8px 9px; border-radius: 7.5px;
  box-shadow: var(--shadow); background: var(--in); word-wrap: break-word; overflow-wrap: anywhere;
}
.row.out .bubble { background: var(--out); }
.row.in .bubble.tail { border-top-left-radius: 0; }
.row.out .bubble.tail { border-top-right-radius: 0; }
.row.in .bubble.tail::before, .row.out .bubble.tail::before {
  content: ''; position: absolute; top: 0; width: 8px; height: 13px;
}
.row.in .bubble.tail::before { left: -8px; background: var(--in); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.row.out .bubble.tail::before { right: -8px; background: var(--out); clip-path: polygon(0 0, 100% 0, 0 100%); }
.row.flash .bubble { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--green); } }
.sender { font-size: 12.8px; font-weight: 500; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.text { white-space: pre-wrap; }
.text.jumbo { font-size: 36px; line-height: 1.2; }
.spacer { display: inline-block; width: 52px; height: 1px; }
.row.out .spacer { width: 70px; }
.meta {
  position: absolute; right: 7px; bottom: 3px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--muted); white-space: nowrap; pointer-events: none;
}
.tick { width: 16px; height: 15px; color: var(--muted); }
.tick.read { color: var(--tick); }
.tick.clock { width: 13px; height: 13px; }
.bubble.deleted .text { font-style: italic; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.bubble.deleted .text .ic { width: 16px; height: 16px; }
.pending .bubble { opacity: .85; }
.msg-menu {
  position: absolute; top: 3px; right: 3px; width: 26px; height: 22px; border-radius: 0 6px 0 12px;
  display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity .12s;
  background: linear-gradient(to left, var(--in) 60%, transparent);
}
.row.out .msg-menu { background: linear-gradient(to left, var(--out) 60%, transparent); }
.msg-menu .ic { width: 20px; height: 20px; }
.bubble:hover .msg-menu, .msg-menu:focus-visible { opacity: 1; }
@media (hover: none) { .msg-menu { display: none; } }

.quote {
  display: flex; flex-direction: column; text-align: left; width: 100%; border-radius: 6px; padding: 6px 10px;
  margin-bottom: 4px; background: var(--quote-in); border-left: 4px solid var(--green); overflow: hidden;
}
.row.out .quote { background: var(--quote-out); }
.q-name { font-size: 12.8px; font-weight: 500; }
.q-text { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }

.media { display: block; margin: -3px -4px 4px -6px; border-radius: 6px; overflow: hidden; position: relative; background: rgba(0, 0, 0, .06); cursor: zoom-in; }
.media img { display: block; max-width: min(330px, 70vw); max-height: 380px; width: auto; height: auto; min-width: 120px; min-height: 80px; object-fit: cover; }
.bubble.media-only { padding: 3px; }
.bubble.media-only .media { margin: 0; }
.bubble.media-only .meta {
  color: #fff; right: 10px; bottom: 8px; padding: 2px 6px; border-radius: 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, .45), rgba(0, 0, 0, .25));
}
.bubble.media-only .tick { color: #fff; }
.bubble.media-only .tick.read { color: var(--tick); }
.filecard {
  display: flex; align-items: center; gap: 10px; min-width: 240px; max-width: 330px; padding: 10px; margin: 0 -2px 4px -4px;
  border-radius: 6px; background: var(--quote-in); color: var(--text); text-decoration: none;
}
.row.out .filecard { background: var(--quote-out); }
.fc-icon { width: 36px; height: 44px; border-radius: 4px; display: grid; place-items: end center; font-size: 9px; font-weight: 700; color: #fff; padding-bottom: 5px; flex: none; position: relative; }
.fc-icon::before { content: ''; position: absolute; top: 0; right: 0; width: 10px; height: 10px; background: rgba(255, 255, 255, .35); border-bottom-left-radius: 3px; }
.fc-pdf { background: #e2463b; } .fc-doc { background: #2b6cd4; } .fc-xls { background: #1d8a4e; } .fc-ppt { background: #d7552a; } .fc-txt { background: #6b7c85; }
.fc-body { flex: 1; min-width: 0; }
.fc-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-meta { font-size: 12px; color: var(--muted); }
.filecard .ic { color: var(--muted); width: 22px; height: 22px; }

.jump {
  position: absolute; right: 18px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; background: var(--panel);
  box-shadow: var(--shadow-lg); display: grid; place-items: center; color: var(--muted); z-index: 3;
}
.jump .badge { position: absolute; top: -6px; right: -4px; }

/* composer */
.chat-foot { flex: none; background: var(--panel-2); position: relative; z-index: 2; }
.composer { display: flex; align-items: flex-end; gap: 4px; padding: 5px 10px 5px 8px; min-height: 62px; }
.composer .icon-btn { margin-bottom: 6px; }
.composer .icon-btn .ic { width: 26px; height: 26px; }
.input-wrap { flex: 1; min-width: 0; background: var(--input); border-radius: 8px; padding: 9px 12px; margin: 5px 4px; }
.input-wrap textarea {
  display: block; width: 100%; border: 0; outline: none; background: none; resize: none; max-height: 140px;
  font-size: 15px; line-height: 21px; padding: 0;
}
.send { width: 46px; height: 46px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; margin-bottom: 3px; flex: none; transition: opacity .15s, transform .1s; }
.send:hover { background: var(--green-dark); }
.send:disabled { opacity: .5; cursor: default; }
.send:active:not(:disabled) { transform: scale(.94); }
.send .ic { width: 22px; height: 22px; margin-left: 2px; }
.readonly { padding: 20px; text-align: center; color: var(--muted); font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.readonly .ic { width: 16px; height: 16px; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px 0 16px; }
.reply-bar .quote { margin: 0; flex: 1; cursor: default; background: var(--panel); }
.link-warn {
  margin: 8px 12px 0; padding: 9px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text);
  border: 1px solid var(--warn-border); font-size: 13px; display: flex; gap: 10px; align-items: flex-start;
}
.link-warn .ic { width: 18px; height: 18px; margin-top: 1px; }
.link-warn .lw-body { flex: 1; }
.link-warn .lw-actions { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* ---------- popovers, menus, modals ---------- */
.menu {
  position: fixed; z-index: 60; min-width: 190px; background: var(--panel); border-radius: 6px; box-shadow: var(--shadow-lg);
  padding: 8px 0; animation: pop .12s ease-out;
}
@keyframes pop { from { opacity: 0; transform: scale(.96); } }
.menu button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 20px 9px 16px; text-align: left; font-size: 14.5px; }
.menu button:hover { background: var(--hover); }
.menu button .ic { width: 20px; height: 20px; color: var(--muted); }
.menu button.danger { color: var(--danger); }
.menu button.danger .ic { color: var(--danger); }
.emoji-pop { position: fixed; z-index: 60; background: var(--panel); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; display: grid; grid-template-columns: repeat(8, 38px); gap: 2px; animation: pop .12s ease-out; }
.emoji-pop button { width: 38px; height: 38px; font-size: 22px; border-radius: 6px; }
.emoji-pop button:hover { background: var(--hover); }

.modal-back { position: fixed; inset: 0; z-index: 50; background: var(--overlay); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow-lg); width: min(460px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { padding: 20px 24px 6px; font-size: 18px; font-weight: 500; }
.modal-body { padding: 8px 24px 4px; overflow: auto; color: var(--muted); }
.modal-body p { margin: 6px 0 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px 20px; flex-wrap: wrap; }
.check { display: flex; gap: 10px; align-items: center; color: var(--text); margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--green); }

.attach-modal { width: min(560px, 100%); }
.attach-preview { background: var(--panel-2); display: grid; place-items: center; min-height: 200px; max-height: 50dvh; overflow: hidden; }
.attach-preview img { max-width: 100%; max-height: 50dvh; display: block; }
.attach-preview .filecard { margin: 30px; background: var(--panel); }
.attach-body { padding: 14px 18px 18px; display: flex; gap: 10px; align-items: flex-end; }
.attach-body .input-wrap { margin: 0; background: var(--panel-2); }
.progress { height: 3px; background: var(--border); }
.progress div { height: 100%; width: 0; background: var(--green); transition: width .15s; }
.attach-err { margin: 0 18px 14px; }

.lightbox { position: fixed; inset: 0; z-index: 55; background: var(--panel); display: flex; flex-direction: column; animation: fade .15s; }
.lightbox header { display: flex; align-items: center; gap: 12px; padding: 10px 16px; height: 60px; border-bottom: 1px solid var(--border); }
.lightbox .lb-who { flex: 1; min-width: 0; }
.lightbox .lb-name { font-weight: 500; }
.lightbox .lb-time { font-size: 12.5px; color: var(--muted); }
.lightbox .lb-img { flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; background: var(--chat-bg); }
.lightbox .lb-img img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: var(--shadow-lg); }
.lightbox .lb-caption { padding: 12px 20px 18px; text-align: center; white-space: pre-wrap; }

#toasts { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(560px, calc(100% - 32px)); }
.toast { pointer-events: auto; background: #303c43; color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); font-size: 14px; animation: pop .15s; display: flex; gap: 12px; align-items: center; }
.toast.error { background: #b3002a; }
.toast.ok { background: var(--green-dark); }

/* ---------- drawer (room info + admin) ---------- */
.drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(440px, 100%); background: var(--panel-2); z-index: 20;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .22s ease;
}
.drawer.open { transform: none; }
.drawer-head { height: 59px; flex: none; display: flex; align-items: center; gap: 14px; padding: 0 12px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.drawer-head h2 { font-size: 16px; font-weight: 500; margin: 0; }
.drawer-body { flex: 1; overflow-y: auto; }
.info-hero { background: var(--panel); text-align: center; padding: 28px 20px 20px; margin-bottom: 10px; box-shadow: var(--shadow); }
.info-hero .av { margin: 0 auto 14px; }
.info-hero h3 { margin: 0; font-size: 22px; font-weight: 400; }
.info-card { display: block; width: 100%; background: var(--panel); padding: 16px 24px; margin-bottom: 10px; box-shadow: var(--shadow); text-align: left; }
.info-card .label { font-size: 13.5px; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.info-card .label .ic { width: 16px; height: 16px; }
.info-card .desc { white-space: pre-wrap; }
.info-card .hint { font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.info-card .member { padding: 8px 0; }
.info-card .member:hover { background: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--chip); color: var(--chip-text); border-radius: 14px; padding: 4px 10px; font-size: 13px; }
.chip.bad { background: rgba(234, 0, 56, .1); color: var(--danger); }
.row-btn { display: flex; align-items: center; gap: 14px; width: 100%; background: var(--panel); padding: 16px 24px; margin-bottom: 10px; box-shadow: var(--shadow); text-align: left; font-size: 15px; }
.row-btn:hover { background: var(--hover); }
.row-btn.danger { color: var(--danger); }
.row-btn .ic { width: 22px; height: 22px; }

.tabs { display: flex; background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1; }
.tabs button { flex: 1; padding: 13px 6px; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; font-size: 14px; }
.tabs button.on { color: var(--green-dark); border-bottom-color: var(--green); }
.pane { padding: 12px 0 30px; }
.section { background: var(--panel); padding: 16px 20px; margin-bottom: 10px; box-shadow: var(--shadow); }
.section h4 { margin: 0 0 10px; font-size: 14px; font-weight: 500; color: var(--green-dark); }
.section p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.inline-form { display: flex; gap: 8px; }
.inline-form .text-input { flex: 1; min-width: 0; padding: 9px 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.filters button { padding: 5px 11px; border-radius: 14px; background: var(--panel-2); color: var(--muted); font-size: 12.5px; }
.filters button.on { background: var(--chip); color: var(--chip-text); font-weight: 500; }
.person { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.person:last-child { border-bottom: 0; }
.p-body { flex: 1; min-width: 0; }
.p-name { display: flex; align-items: center; gap: 6px; }
.p-name span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 11px; padding: 1px 7px; border-radius: 4px; flex: none; font-weight: 500; }
.st-joined, .st-admin { background: var(--chip); color: var(--chip-text); }
.st-removed, .st-inactive { background: rgba(234, 0, 56, .1); color: var(--danger); }
.st-can_join, .st-added, .st-not_added, .st-missing { background: var(--panel-2); color: var(--muted); }
.domain-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.domain-row:last-child { border-bottom: 0; }
.domain-row .d-body { flex: 1; min-width: 0; }
.domain-row .d-name { font-weight: 500; }
.domain-row .d-sub { font-size: 12px; color: var(--muted); }
.attempt { padding: 10px 0; border-bottom: 1px solid var(--border); }
.attempt:last-child { border-bottom: 0; }
.attempt .a-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.attempt .a-ex { font-size: 12.5px; color: var(--muted); margin: 4px 0 6px; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.form-row { margin-bottom: 16px; }
.form-row > label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.form-row textarea.text-input { resize: vertical; min-height: 70px; }
.radio { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.radio input { accent-color: var(--green); width: 18px; height: 18px; margin-top: 1px; }
.radio small { display: block; color: var(--muted); font-size: 12.5px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; cursor: pointer; }
.toggle small { display: block; color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 38px; height: 22px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 11px; background: #aebac1; transition: background .15s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.number { width: 90px; }
.loading { padding: 30px; text-align: center; color: var(--muted); }

/* ---------- small screens ---------- */
.only-mobile { display: none !important; }
@media (max-width: 820px) {
  .only-mobile { display: inline-grid !important; }
  .side { position: absolute; inset: 0; width: 100%; max-width: none; min-width: 0; transform: translateX(-100%); transition: transform .22s ease; z-index: 15; }
  .layout.side-open .side { transform: none; }
  .chat-head { padding-left: 4px; border-left: 0; }
  .row { padding: 0 3.5%; }
  .bubble { max-width: 85%; }
  .drawer { width: 100%; }
  .login-card { margin: -170px 12px 30px; padding: 28px 22px 22px; }
  .login-top { height: 200px; }
  .member .m-act { opacity: 1; }
  #toasts { bottom: 84px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- link approvals ---------- */
.icon-btn { position: relative; }
.ap-badge { position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; pointer-events: none; }
.tabs .ap-badge-tab { margin-left: 6px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 5px; }
.link-warn .lw-ask { margin-top: 4px; font-weight: 500; }
.req-list .row.req .bubble { opacity: .9; }
.req-note { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--muted); }
.req-note .ic { width: 15px; height: 15px; flex: none; }
.req-note.no { color: var(--danger); }
.req-note button { margin-left: auto; border: 0; background: none; color: var(--green-dark); font: inherit; font-weight: 600; cursor: pointer; padding: 2px 4px; }
.req-note button:hover { text-decoration: underline; }
.ap-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--panel); }
.ap-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ap-when { font-size: 12px; color: var(--muted); flex: none; }
.ap-text { margin: 6px 0 8px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.ap-sites { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { font-size: 12px; background: var(--chip); color: var(--text, inherit); padding: 1px 8px; border-radius: 10px; }
.ap-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ap-done { font-size: 12.5px; color: var(--muted); padding: 4px 0; }
.ap-done .ok { color: var(--green-dark); font-weight: 600; }
.ap-done .no { color: var(--danger); font-weight: 600; }

/* ---------- GIFs ---------- */
.gif-btn { width: auto; height: 22px; padding: 0 4px; margin: 0 6px; align-self: center; border: 1.6px solid currentColor; border-radius: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); }
.gif-btn:hover { color: var(--text, inherit); }
.gif-pop { position: fixed; z-index: 60; width: min(360px, calc(100vw - 16px)); height: min(420px, calc(100vh - 140px)); display: flex; flex-direction: column;
  background: var(--panel); border-radius: 10px; box-shadow: var(--shadow-lg); animation: pop .12s ease-out; overflow: hidden; }
.gif-search { display: flex; align-items: center; gap: 8px; margin: 8px; padding: 0 10px; border-radius: 8px; background: var(--panel-2); color: var(--muted); }
.gif-search .ic { width: 18px; height: 18px; }
.gif-search input { flex: 1; border: 0; background: none; outline: none; padding: 8px 0; min-width: 0; color: inherit; }
.gif-scroll { flex: 1; overflow-y: auto; padding: 0 8px 8px; }
.gif-grid { columns: 2; column-gap: 6px; }
.gif-item { display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0; border-radius: 6px; overflow: hidden; background: var(--panel-2); cursor: pointer; break-inside: avoid; }
.gif-item img { display: block; width: 100%; height: auto; }
.gif-item:hover, .gif-item:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.gif-status { padding: 12px; text-align: center; color: var(--muted); font-size: 13px; }
.gif-status:empty { display: none; }
.gif-more { display: block; margin: 4px auto 0; }
.gif-foot { padding: 6px 10px; font-size: 11px; color: var(--muted); text-align: right; border-top: 1px solid var(--border); }

/* ===================================================================== The Simple Trade look
   (Dr Prasun, 22-Oct-2026: "lets work the same for the simple room") - the website's navy + violet,
   Inter (served from /fonts, so nothing loads from Google), and the TST icon. Style only: every class
   above is unchanged; this block re-points the colour variables and swaps the logo. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin-wght-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(/fonts/inter-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
body { font-family: "Inter", "Segoe UI", "Helvetica Neue", Arial, "Nirmala UI", "Noto Sans Tamil", "Tamil Sangam MN", sans-serif; }

/* light */
:root {
  --bg: #F6F7FB; --panel: #FFFFFF; --panel-2: #F4F5FA; --border: #E4E7EF;
  --text: #0F172A; --muted: #5B6478;
  --green: #7C3AED; --green-dark: #6D28D9;          /* the accent slot: buttons, active tab, send */
  --chat-bg: #F3F1FB; --pattern: rgba(109, 40, 217, .05);
  --in: #FFFFFF; --out: #EDE7FF; --tick: #7C3AED;
  --hover: #F4F2FD; --active: #EDE9FE;
  --link: #6D28D9; --sys: #FFFFFF; --sys-text: #5B6478;
  --quote-in: #F4F5FA; --quote-out: #DDD3FF; --input: #FFFFFF;
  --badge: #16A34A;                                   /* unread count + online dot stay green */
  --chip: #EDE9FE; --chip-text: #5B21B6;
  --overlay: rgba(1, 4, 26, .55);
}
/* dark - the website's own ground */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #01041A; --panel: #050A26; --panel-2: #0A1030; --border: #141B45;
    --text: #FFFFFF; --muted: #97A3C8;
    --green: #8B5CF6; --green-dark: #6D28D9;
    --chat-bg: #020722; --pattern: rgba(167, 139, 250, .045);
    --in: #0E1538; --out: #4C1D95; --tick: #C4B5FD;
    --hover: #0A1030; --active: #111A48;
    --link: #C4B5FD; --sys: #0A1030; --sys-text: #97A3C8;
    --quote-in: #0A1030; --quote-out: #5B21B6; --input: #0E1538;
    --badge: #3DDC64;
    --chip: #1E1B4B; --chip-text: #C4B5FD;
    --overlay: rgba(1, 4, 26, .75);
  }
}
:root[data-theme="dark"] {
  --bg: #01041A; --panel: #050A26; --panel-2: #0A1030; --border: #141B45;
  --text: #FFFFFF; --muted: #97A3C8;
  --green: #8B5CF6; --green-dark: #6D28D9;
  --chat-bg: #020722; --pattern: rgba(167, 139, 250, .045);
  --in: #0E1538; --out: #4C1D95; --tick: #C4B5FD;
  --hover: #0A1030; --active: #111A48;
  --link: #C4B5FD; --sys: #0A1030; --sys-text: #97A3C8;
  --quote-in: #0A1030; --quote-out: #5B21B6; --input: #0E1538;
  --badge: #3DDC64;
  --chip: #1E1B4B; --chip-text: #C4B5FD;
  --overlay: rgba(1, 4, 26, .75);
}

/* the TST icon in place of the green chat bubble */
.boot-logo, .login-brand .logo { background-image: url(/img/icon-192.png); border-radius: 12px; }
.av.room { background: #01041A url(/img/icon-192.png) center / cover no-repeat; }
.av.room .ic { display: none; }
/* the band behind the sign-in card: the website's navy with a violet glow, not WhatsApp green */
.login-top { background: radial-gradient(60% 120% at 50% 0%, rgba(124, 58, 237, .55), transparent 70%), #01041A; }
.login-brand h1 { font-weight: 700; letter-spacing: -.01em; }
/* the "N unread messages" band: a violet tint instead of the old grey strip */
.unread-div { background: rgba(124, 58, 237, .12); }
.unread-div span { color: var(--link); }
.toast { background: #0F172A; }

/* profile pictures (22-Oct-2026) */
.av { position: relative; overflow: hidden; }
.av.has-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.me { background: none; border: 0; padding: 0; margin: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 24px; }
.me:hover .av, .me:focus-visible .av { box-shadow: 0 0 0 2px var(--green); }
.av-btn { background: none; border: 0; padding: 0; cursor: zoom-in; border-radius: 50%; }
.profile-pic { display: grid; place-items: center; margin: 4px 0 14px; }
.profile-note { font-size: 13px; text-align: center; margin: 0 0 6px; }
.photo-view img { display: block; width: 100%; max-width: 360px; aspect-ratio: 1; object-fit: cover; border-radius: 16px; margin: 0 auto; }
