/* ===========================================================
   YM 9x — giao diện Messenger 2005 (bản web)
   =========================================================== */

:root {
  --ym-blue: #0b5ed7;
  --ym-blue-deep: #06367c;
  --ym-blue-soft: #7db4f2;
  --ym-blue-pale: #e6f0fc;
  --ym-grad-title: linear-gradient(180deg, #63a9f2 0%, #1f76da 45%, #0a4ba6 100%);
  --ym-grad-btn: linear-gradient(180deg, #ffffff 0%, #e2ecf8 48%, #c9d9ed 100%);
  --ym-grad-btn-active: linear-gradient(180deg, #b9cde5 0%, #dfe9f5 100%);
  --panel: #eef3fa;
  --panel-2: #f7fafd;
  --line: #a2b9d5;
  --line-soft: #cddcee;
  --text: #17293c;
  --text-soft: #5b7089;
  --green: #37a832;
  --amber: #e0a017;
  --red: #ce3b32;
  --gray: #98a8ba;
  --shadow-win: 0 22px 60px rgba(3, 25, 60, .38), 0 2px 6px rgba(3, 25, 60, .25);
  --radius: 8px;
  --font: Tahoma, "Segoe UI", Verdana, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 13px;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: #0b3f7d;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: var(--ym-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: #e7eff8; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #b9cee6, #8daacd);
  border: 2px solid #e7eff8;
  border-radius: 8px;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #a6c0dd, #7595bb); }

/* ============================ NÚT / FORM ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 14px;
  min-height: 28px;
  border: 1px solid #86a3c4;
  border-radius: 5px;
  background: var(--ym-grad-btn);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(9, 40, 80, .18);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: bold;
  color: #17416f;
  white-space: nowrap;
  transition: filter .12s ease, transform .06s ease;
  user-select: none;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { background: var(--ym-grad-btn-active); transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary {
  border: 1px solid #0a4ba6;
  background: linear-gradient(180deg, #6fb4f7 0%, #2b83e4 45%, #0d55b4 100%);
  color: #fff;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  color: #33507a;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .55); border-color: var(--line-soft); }
.btn-sm { padding: 3px 9px; min-height: 24px; font-size: 11.5px; }
.btn-icon { padding: 4px; min-width: 28px; }

.input, .select, .textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(9, 40, 80, .12);
  outline: none;
  font-size: 13px;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: #4f96e8;
  box-shadow: inset 0 1px 3px rgba(9, 40, 80, .08), 0 0 0 3px rgba(79, 150, 232, .22);
}
.textarea { resize: none; line-height: 1.45; }

.field { margin-bottom: 11px; }
.field label {
  display: block;
  font-size: 11.5px;
  font-weight: bold;
  color: #35527a;
  margin-bottom: 4px;
  letter-spacing: .2px;
}
.hint { font-size: 11px; color: var(--text-soft); margin-top: 4px; }
.err {
  background: #fdecea;
  border: 1px solid #f0b8b2;
  color: #93322a;
  padding: 7px 9px;
  border-radius: 4px;
  font-size: 12px;
  margin-bottom: 10px;
}

/* ============================ CỬA SỔ GIẢ LẬP ============================ */

.win {
  border: 1px solid #3f6b9e;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-win);
  overflow: hidden;
}
.win-title {
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--ym-grad-title);
  color: #fff;
  font-weight: bold;
  font-size: 13px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
  border-bottom: 1px solid #0a4ba6;
}
.win-title .spacer { margin-left: auto; }
.win-dot {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, .25);
  background: linear-gradient(180deg, #ffe27a, #e8a41c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
  cursor: default;
}
.win-dot.win-close { background: linear-gradient(180deg, #ff9d92, #cf3b2f); }

/* ============================ TRANG ĐĂNG NHẬP ============================ */

.login-body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 5vw, 48px) clamp(14px, 4vw, 32px);
  background:
    radial-gradient(1100px 620px at 15% 8%, #3f96e6 0%, rgba(63, 150, 230, 0) 60%),
    radial-gradient(900px 700px at 88% 92%, #0a58b8 0%, rgba(10, 88, 184, 0) 62%),
    linear-gradient(160deg, #0a4f9e 0%, #0b3f7d 45%, #062a55 100%);
  position: relative;
  overflow-x: hidden;
}
.login-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, .16) 1px, transparent 1px),
    radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px);
  background-size: 26px 26px, 26px 26px;
  background-position: 0 0, 13px 13px;
  pointer-events: none;
}

.login-wrap {
  position: relative;
  width: min(100%, 860px);
  z-index: 1;
}

.login-window { display: flex; flex-direction: column; }
.login-inner {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 0;
  background: linear-gradient(180deg, #f9fbfe, #e9f1fa);
}
.login-hero {
  padding: clamp(20px, 3.4vw, 34px);
  background:
    radial-gradient(420px 280px at 20% 0%, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 70%),
    linear-gradient(160deg, #eaf3ff 0%, #d7e8fb 60%, #c5dcf7 100%);
  border-right: 1px solid var(--line-soft);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.brand-mark {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(155deg, #ffe680, #ffc21a 55%, #e39a00);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .9), 0 4px 10px rgba(120, 70, 0, .3);
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: bold;
  color: #7a4c00;
  font-family: Georgia, serif;
  transform: rotate(-4deg);
}
.brand h1 {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  letter-spacing: -.3px;
  color: #0d3f7c;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: normal;
  color: #4a6c96;
  letter-spacing: .3px;
}
.hero-lead {
  font-size: clamp(.82rem, 1.7vw, .95rem);
  line-height: 1.62;
  color: #24507f;
  margin: 0 0 16px;
}
.hero-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  font-size: 12.5px;
  color: #2c4f78;
}
.hero-list li { display: flex; gap: 8px; align-items: flex-start; }
.hero-list .tick {
  flex: none;
  width: 15px; height: 15px;
  margin-top: 1px;
  border-radius: 50%;
  background: linear-gradient(180deg, #7ed36f, #3f9e35);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}
.hero-stat {
  margin-top: 18px;
  display: flex;
  gap: 18px;
  font-size: 11.5px;
  color: #3b608c;
}
.hero-stat b { display: block; font-size: 17px; color: #0d3f7c; }

.login-form { padding: clamp(20px, 3.4vw, 32px); }
.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.login-tab {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  cursor: pointer;
  font-weight: bold;
  color: #62809f;
  font-size: 12.5px;
  margin-bottom: -1px;
}
.login-tab.active {
  background: linear-gradient(180deg, #fff, #eef5fd);
  border-color: var(--line-soft);
  color: #0d3f7c;
  box-shadow: 0 -1px 0 #fff inset;
}
.status-pick {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.status-pick label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 7px 4px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 10.5px;
  color: #4a678a;
  transition: all .12s ease;
}
.status-pick input { display: none; }
.status-pick input:checked + span { color: #0d3f7c; font-weight: bold; }
.status-pick label:has(input:checked) {
  border-color: #4f96e8;
  background: linear-gradient(180deg, #f2f8ff, #dbeafc);
  box-shadow: 0 0 0 2px rgba(79, 150, 232, .18);
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(0, 0, 0, .18);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}
.dot.online { background: radial-gradient(circle at 35% 30%, #a4f08e, var(--green)); }
.dot.away { background: radial-gradient(circle at 35% 30%, #ffe08a, var(--amber)); }
.dot.busy { background: radial-gradient(circle at 35% 30%, #ff9c92, var(--red)); }
.dot.invisible { background: radial-gradient(circle at 35% 30%, #dfe8f2, var(--gray)); }
.dot.offline { background: radial-gradient(circle at 35% 30%, #e2e9f1, #b3c1d1); }

.login-foot {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-soft);
  padding-inline: 2px;
  flex-wrap: wrap;
}
.site-foot {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  font-size: 11px;
  color: rgba(255, 255, 255, .62);
  text-align: center;
  padding-inline: 10px;
}

/* ============================ APP ============================ */

.app-body {
  height: 100%;
  background:
    radial-gradient(1000px 600px at 12% 0%, #3a8fdc 0%, rgba(58, 143, 220, 0) 55%),
    linear-gradient(165deg, #0b447f 0%, #072f5c 60%, #04203f 100%);
  overflow: hidden;
}
.app {
  height: 100%;
  display: grid;
  grid-template-rows: 34px 1fr 22px;
  padding: clamp(6px, 1.2vw, 14px);
  gap: 6px;
}
.app-title { border-radius: var(--radius) var(--radius) 0 0; }
.app-shell {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 0;
  min-height: 0;
  border: 1px solid #3f6b9e;
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow-win);
}
.app-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, .82);
  background: rgba(4, 26, 52, .55);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 4px;
  overflow: hidden;
}
.app-status .spacer { margin-left: auto; }
.app-status .chip { display: inline-flex; align-items: center; gap: 5px; }

/* ---- cột trái: buddy list ---- */
.side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #f4f8fd, #e6eef9);
  border-right: 1px solid var(--line);
}
.me-card {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 9px 8px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #ffffff, #eaf2fb);
}
.avatar {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 6px;
  border: 1px solid #8fa9c6;
  background: linear-gradient(160deg, #dbe9f8, #b6cfe9);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(0, 0, 0, .12);
  object-fit: cover;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: bold;
  color: #2d5c8f;
  font-size: 15px;
  user-select: none;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 4px; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; border-radius: 8px; }
.me-info { min-width: 0; flex: 1; }
.me-name {
  font-weight: bold;
  font-size: 12.5px;
  color: #123a68;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-mood {
  font-size: 11px;
  color: #6b83a1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.me-status select {
  width: 100%;
  margin-top: 6px;
  padding: 3px 5px;
  font-size: 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}
.side-search {
  padding: 8px 9px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .6);
  position: relative;
}
.side-search .input { padding: 5px 8px 5px 26px; font-size: 12px; }
.side-search svg {
  position: absolute;
  left: 16px; top: 50%;
  transform: translateY(-50%);
  opacity: .45;
  pointer-events: none;
}
.buddy-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 6px 0 10px; }

.grp { margin-bottom: 2px; }
.grp-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: bold;
  color: #33547c;
  cursor: pointer;
  user-select: none;
}
.grp-head:hover { background: rgba(255, 255, 255, .7); }
.grp-head .caret { transition: transform .15s ease; opacity: .65; flex: none; }
.grp.collapsed .caret { transform: rotate(-90deg); }
.grp.collapsed .grp-items { display: none; }
.grp-count { margin-left: auto; font-weight: normal; color: #7b93ad; font-size: 10.5px; }
.grp-items { display: flex; flex-direction: column; }

.buddy {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px 5px 12px;
  cursor: pointer;
  border-left: 3px solid transparent;
  position: relative;
}
.buddy:hover { background: linear-gradient(90deg, rgba(125, 180, 242, .22), rgba(125, 180, 242, .04)); }
.buddy.active {
  background: linear-gradient(90deg, rgba(45, 128, 226, .28), rgba(45, 128, 226, .06));
  border-left-color: #2d80e2;
}
.buddy-main { min-width: 0; flex: 1; }
.buddy-name {
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buddy-sub {
  font-size: 10.5px;
  color: #7b93ad;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.buddy.offline .buddy-name { color: #7f93aa; }
.buddy .dot { position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 8px; height: 8px; }
.buddy-wrap { padding-left: 8px; }
.unread {
  flex: none;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: linear-gradient(180deg, #ff8a6b, #dd3b1b);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  display: grid;
  place-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.side-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 7px 8px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #f7fafd, #e3ecf7);
}

.side-actions .btn {
  padding: 4px 5px;
  font-size: 11px;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
}
.side-actions .btn svg { flex: 0 0 auto; width: 12px; height: 12px; }

/* ---- cột phải: khung chat ---- */
.chat-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fbfdff;
}
.tabbar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding: 6px 6px 0;
  background: linear-gradient(180deg, #dfe9f5, #c9d9ec);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
  min-height: 34px;
}
.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 10px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: rgba(255, 255, 255, .5);
  font-size: 12px;
  color: #39597e;
  cursor: pointer;
  white-space: nowrap;
  max-width: 190px;
  margin-bottom: -1px;
}
.tab.active {
  background: #fbfdff;
  border-color: var(--line);
  color: #10396a;
  font-weight: bold;
  box-shadow: 0 -1px 0 #fff inset;
}
.tab .tab-name { overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.tab .tab-x {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  color: #7b93ad;
  padding: 0 2px;
  border-radius: 3px;
}
.tab .tab-x:hover { background: rgba(206, 59, 50, .14); color: #b3302a; }
.tab .unread { min-width: 15px; height: 15px; font-size: 9.5px; }

.panels { position: relative; flex: 1; min-height: 0; }
.panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background:
    radial-gradient(600px 300px at 100% 0%, #f3f9ff, rgba(243, 249, 255, 0) 70%),
    #fbfdff;
}
.panel.hidden { display: none; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #ffffff, #eef5fd);
}
.chat-head .who { min-width: 0; flex: 1; }
.chat-head .who b { font-size: 13px; color: #10396a; display: block; }
.chat-head .who span { font-size: 11px; color: #6b83a1; }
.chat-head .tools { display: flex; gap: 4px; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px clamp(10px, 2.4vw, 20px) 8px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  scroll-behavior: smooth;
}

.msg { display: flex; gap: 8px; align-items: flex-start; max-width: 100%; }
.msg.me { flex-direction: row-reverse; }
.msg-av { flex: none; }
.msg-body { min-width: 0; max-width: min(78%, 620px); }
.msg.me .msg-body { text-align: right; }
.msg-head {
  font-size: 11px;
  color: #7b93ad;
  margin-bottom: 2px;
  display: flex;
  gap: 6px;
  align-items: baseline;
}
.msg.me .msg-head { justify-content: flex-end; }
.msg-head b { color: #1d5fa8; font-size: 11.5px; }
.msg-text {
  display: inline-block;
  text-align: left;
  padding: 7px 11px;
  border-radius: 10px 10px 10px 3px;
  background: linear-gradient(180deg, #ffffff, #f1f6fc);
  border: 1px solid #d5e3f3;
  box-shadow: 0 1px 2px rgba(20, 60, 100, .07);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
}
.msg.me .msg-text {
  border-radius: 10px 10px 3px 10px;
  background: linear-gradient(180deg, #e8f3ff, #d3e7ff);
  border-color: #b6d5f6;
}
.msg-text.sys {
  background: transparent;
  border: none;
  box-shadow: none;
  color: #8595a8;
  font-size: 11.5px;
  padding: 2px 0;
}
.msg.system { justify-content: center; max-width: 100%; }
.msg.system .msg-body { max-width: 100%; text-align: center; }
.emoji {
  font-size: 16px;
  line-height: 1;
  vertical-align: -2px;
  display: inline-block;
  margin: 0 1px;
}
.nick {
  font-weight: bold;
  background: rgba(255, 214, 102, .35);
  border-radius: 3px;
  padding: 0 2px;
}
.msg-img {
  display: block;
  margin-top: 4px;
  max-width: min(100%, 320px);
  border-radius: 7px;
  border: 1px solid #cfdff0;
  cursor: zoom-in;
  box-shadow: 0 2px 8px rgba(20, 60, 100, .12);
}
.msg-file {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 4px;
  padding: 8px 10px;
  border: 1px solid #cfe0f2;
  border-radius: 7px;
  background: #fff;
  text-decoration: none;
  color: #17416f;
  max-width: 100%;
  font-size: 12px;
}
.msg-file:hover { border-color: #8fbcef; background: #f6fbff; text-decoration: none; }
.msg-file .fi {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #eaf3ff, #cfe2f8);
  color: #2a6cb0;
}
.msg-file .fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
audio { max-width: min(100%, 300px); margin-top: 4px; display: block; }

.buzz-card {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  border-radius: 7px;
  background: linear-gradient(180deg, #fff6d6, #ffe6a1);
  border: 1px solid #e2b93f;
  color: #7a5400;
  font-weight: bold;
  font-size: 12.5px;
  box-shadow: 0 1px 0 #fff inset;
}

.typing-line {
  height: 17px;
  padding: 0 clamp(10px, 2.4vw, 20px);
  font-size: 11px;
  color: #7b93ad;
  font-style: italic;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.composer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #eef5fd, #e2ecf8);
  padding: 6px 8px 8px;
}
.composer-tools {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.tool {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  padding: 3px 5px;
  cursor: pointer;
  color: #3a5b80;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  line-height: 1;
}
.tool:hover { background: #fff; border-color: var(--line-soft); }
.tool.on { background: #fff; border-color: #8fbcef; box-shadow: 0 0 0 2px rgba(79, 150, 232, .16); }
.tool-sep { width: 1px; height: 16px; background: var(--line-soft); margin: 0 3px; }
.composer-row { display: flex; gap: 6px; align-items: flex-end; }
.composer textarea {
  flex: 1;
  min-height: 56px;
  max-height: 150px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(9, 40, 80, .1);
  resize: none;
  outline: none;
  line-height: 1.45;
}
.composer textarea:focus { border-color: #4f96e8; }
.composer .send-col { display: flex; flex-direction: column; gap: 4px; }
.composer .send-col .btn { min-height: 56px; padding-inline: 16px; }

/* bảng emoji */
.emoji-pop {
  position: absolute;
  z-index: 40;
  width: 268px;
  border: 1px solid #7f9ec1;
  border-radius: 7px;
  background: #f6faff;
  box-shadow: 0 12px 30px rgba(6, 40, 80, .3);
  padding: 6px;
}
.emoji-pop .emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  max-height: 190px;
  overflow-y: auto;
}
.emoji-pop button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  font-size: 18px;
  line-height: 1;
  padding: 4px 0;
  cursor: pointer;
}
.emoji-pop button:hover { background: #fff; border-color: #c9dcef; }
.emoji-pop .pop-head {
  font-size: 11px;
  color: #5b7695;
  padding: 2px 4px 6px;
  font-weight: bold;
}

/* màn hình chào */
.empty {
  flex: 1;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 40px);
  text-align: center;
  background:
    radial-gradient(500px 320px at 50% 10%, #eaf4ff, rgba(234, 244, 255, 0) 70%),
    #fbfdff;
}
.empty-inner { max-width: 420px; }
.empty h2 {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  color: #12406f;
  margin: 0 0 8px;
}
.empty p { color: #63809f; font-size: 12.5px; line-height: 1.6; margin: 0 0 14px; }
.empty .quick { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* --------------------------- modal --------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(4, 24, 48, .55);
  display: grid;
  place-items: center;
  padding: 16px;
  backdrop-filter: blur(1.5px);
}
.modal {
  width: min(100%, 430px);
  border: 1px solid #3f6b9e;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-win);
  overflow: hidden;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}
.modal.wide { width: min(100%, 560px); }
.modal-body { padding: 14px; overflow-y: auto; }
.modal-foot {
  display: flex;
  gap: 7px;
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #f7fafd, #e8f0fa);
}
.modal-close {
  margin-left: auto;
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  opacity: .85;
}
.modal-close:hover { opacity: 1; }

.profile-head {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line-soft);
}
.profile-head .pn { font-size: 15px; font-weight: bold; color: #10396a; }
.profile-head .pu { font-size: 11.5px; color: #6b83a1; }
.profile-head .pm { font-size: 11.5px; color: #54708f; margin-top: 3px; }

.req-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
  margin-bottom: 6px;
}
.req-row .grow { flex: 1; min-width: 0; }

.room-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #fff;
  margin-bottom: 6px;
}
.room-row .grow { flex: 1; min-width: 0; }
.room-row .rn { font-weight: bold; font-size: 12.5px; color: #123a68; }
.room-row .rt { font-size: 11px; color: #6b83a1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.teen-box { display: grid; gap: 8px; }
.teen-out {
  min-height: 64px;
  padding: 8px;
  border: 1px dashed #9dbadb;
  border-radius: 5px;
  background: #fff;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.toast-wrap {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(340px, calc(100vw - 28px));
}
.toast {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 11px;
  border: 1px solid #8fb6df;
  border-radius: 7px;
  background: linear-gradient(180deg, #f8fcff, #e6f1fd);
  box-shadow: 0 8px 24px rgba(6, 40, 80, .25);
  font-size: 12px;
  color: #17416f;
  animation: toastIn .22s ease both;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* rung cửa sổ khi buzz */
@keyframes ymShake {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  15% { transform: translate(-6px, 2px) rotate(-.5deg); }
  30% { transform: translate(6px, -3px) rotate(.5deg); }
  45% { transform: translate(-5px, -2px) rotate(-.4deg); }
  60% { transform: translate(5px, 3px) rotate(.4deg); }
  75% { transform: translate(-3px, 1px) rotate(-.2deg); }
  90% { transform: translate(3px, -1px) rotate(.2deg); }
}
.shake { animation: ymShake .55s cubic-bezier(.36, .07, .19, .97) both; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 860px) {
  .login-inner { grid-template-columns: 1fr; }
  .login-hero { border-right: none; border-bottom: 1px solid var(--line-soft); }
  .hero-list { display: none; }
  .hero-stat { margin-top: 12px; }
  .app { padding: 0; gap: 0; grid-template-rows: 34px 1fr 20px; }
  .app-title { border-radius: 0; }
  .app-shell {
    grid-template-columns: 1fr;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .side { border-right: none; }
  .app-shell.chatting .side { display: none; }
  .app-shell:not(.chatting) .chat-area { display: none; }
  .chat-head .back-btn { display: inline-flex; }
  .msg-body { max-width: 84%; }
  .app-status { border-radius: 0; border-left: none; border-right: none; border-bottom: none; }
  .composer textarea { min-height: 44px; }
  .composer .send-col .btn { min-height: 44px; }
}
@media (min-width: 861px) {
  .chat-head .back-btn { display: none; }
}
@media (max-width: 420px) {
  .status-pick { grid-template-columns: repeat(2, 1fr); }
  .tab { max-width: 140px; }
}

/* ============================ ADMIN ============================ */
.admin-body {
  min-height: 100%;
  background: linear-gradient(165deg, #082f59, #041d36);
  padding: clamp(12px, 3vw, 28px);
}
.admin-wrap { max-width: 1100px; margin: 0 auto; display: grid; gap: 14px; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat-card {
  padding: 12px;
  border: 1px solid #3f6b9e;
  border-radius: 8px;
  background: linear-gradient(180deg, #f8fbff, #e6f0fb);
  box-shadow: 0 6px 18px rgba(4, 26, 52, .35);
}
.stat-card b { display: block; font-size: 22px; color: #10396a; }
.stat-card span { font-size: 11.5px; color: #63809f; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: 6px; background: #fff; }
table.ym { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 520px; }
table.ym th, table.ym td { padding: 7px 9px; text-align: left; border-bottom: 1px solid #eaf1f9; }
table.ym th { background: #eef5fd; color: #35527a; font-size: 11.5px; position: sticky; top: 0; }
table.ym tr:hover td { background: #f7fbff; }
.pill {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 10.5px;
  font-weight: bold;
  border: 1px solid transparent;
}
.pill.ok { background: #e6f7e4; color: #2c7a26; border-color: #bfe3ba; }
.pill.bad { background: #fdecea; color: #93322a; border-color: #f0b8b2; }
.pill.admin { background: #e8f0ff; color: #1d4f9c; border-color: #c3d8f7; }
