.promotion-card {
  margin-block: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow-wrap: anywhere;
  min-width: 0;
}
.promotion-card h3 { margin-block: 10px 6px; }
.promotion-card p { white-space: pre-wrap; line-height: 1.7; margin-bottom: 8px; }
.promotion-card a { display: inline-flex; align-items: center; min-height: 44px; }
#sidebar-promotion { max-height: 32dvh; overflow-y: auto; flex-shrink: 0; }
#sidebar-promotion .promotion-card { margin: 8px 14px; }
.brand { flex-wrap: wrap; overflow-wrap: anywhere; }
fieldset { min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
:root {
  font-family: Tahoma, Arial, sans-serif;
  color-scheme: dark;
  --bg: #11151e;
  --panel: #191e2a;
  --panel2: #202736;
  --border: #2b3344;
  --text: #edf0fa;
  --muted: #919bb2;
  --accent: #8794ff;
  --accent2: #6979ed;
  --bubble: #323b64;
  --green: #5ad3ac;
  --danger: #ff8c97;
  --shadow: 0 18px 70px #0005;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
body.light {
  color-scheme: light;
  --bg: #edf0f6;
  --panel: #fff;
  --panel2: #f3f5fb;
  --border: #e0e4ed;
  --text: #222a40;
  --muted: #737c90;
  --bubble: #e1e5ff;
  --shadow: 0 18px 70px #2222;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
  color: inherit;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 14px;
  transition: background 0.15s;
}
button:hover {
  background: var(--panel2);
}
button:disabled {
  opacity: 0.45;
  cursor: wait;
}
input,
textarea,
select {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: 11px;
  min-width: 0;
  width: 100%;
  outline: 0;
}
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #8794ff18;
}
textarea {
  resize: vertical;
  min-height: 72px;
}
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a {
  color: var(--accent);
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h2 {
  font-size: 19px;
}
h3 {
  font-size: 15px;
}
small,
.muted {
  color: var(--muted);
  line-height: 1.8;
}
.primary {
  background: var(--accent2);
  color: white;
}
.primary:hover {
  background: #7b89f6;
}
.danger {
  color: var(--danger);
}
.outline {
  border: 1px solid var(--border);
}
.icon {
  width: 39px;
  height: 39px;
  padding: 7px;
  display: inline-grid;
  place-items: center;
  font-size: 20px;
  flex-shrink: 0;
}
.icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.between {
  justify-content: space-between;
}
.stack {
  display: grid;
  gap: 16px;
}
.full {
  width: 100%;
}
.hidden {
  display: none !important;
}
.badge {
  background: #6979ed25;
  color: var(--accent);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 11px;
}
.brand {
  font-size: 25px;
  font-weight: bold;
  letter-spacing: -1px;
}
.brand img {
  height: 40px;
  width: 40px;
}
.avatar {
  width: 45px;
  height: 45px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #6979ed24;
  color: #a9b3ff;
  font-weight: bold;
  font-size: 18px;
  flex-shrink: 0;
}
.avatar.big {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  font-size: 29px;
}
.boot {
  display: grid;
  place-content: center;
  gap: 10px;
  height: 100dvh;
  font-size: 32px;
  text-align: center;
}
.boot span {
  font-size: 13px;
  color: var(--muted);
}
.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 100dvh;
  max-width: 1440px;
  margin: auto;
}
.auth-story {
  padding: 70px 12%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: radial-gradient(ellipse at 40% 40%, #38457d50, transparent 60%);
  border-inline-end: 1px solid var(--border);
}
.auth-story h1 {
  font-size: clamp(35px, 4vw, 58px);
  line-height: 1.6;
  letter-spacing: -2px;
  max-width: 480px;
  margin: 40px 0 18px;
}
.auth-story h1 em {
  color: var(--accent);
  font-style: normal;
}
.auth-story p {
  color: var(--muted);
  line-height: 2;
  max-width: 370px;
}
.auth-art {
  position: relative;
  margin: 40px 0;
  height: 150px;
}
.art-message {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px 24px;
  background: var(--panel);
  width: 80%;
  box-shadow: var(--shadow);
}
.art-message.second {
  margin: 12px 20% 0 0;
  background: var(--bubble);
}
.auth-form {
  max-width: 430px;
  width: 100%;
  margin: auto;
  padding: 30px;
}
.auth-form h2 {
  font-size: 28px;
  margin-top: 24px;
}
.label {
  display: grid;
  gap: 9px;
  font-size: 12px;
  color: var(--muted);
}
.auth-note {
  font-size: 11px;
  line-height: 2;
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 24px;
}
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  margin-bottom: 22px;
}
.tabs button {
  border-radius: 0;
  padding: 13px 6px;
  color: var(--muted);
}
.tabs button.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: 74px 310px minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}
.rail {
  background: var(--bg);
  border-inline-end: 1px solid var(--border);
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 14px;
  padding: 24px 12px;
}
.rail img {
  height: 39px;
  width: 39px;
  margin-bottom: 25px;
}
.rail .active {
  color: var(--accent);
  background: #6979ed24;
}
.rail .spacer {
  flex: 1;
}
.rail .avatar {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  font-size: 15px;
}
.sidebar {
  background: var(--panel);
  border-inline-end: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-head {
  padding: 29px 22px 14px;
}
.sidebar-head h1 {
  font-size: 23px;
  margin: 0;
}
.searchbox {
  margin: 7px 20px 0;
  position: relative;
}
.searchbox input {
  font-size: 12px;
  padding: 12px;
}
.filterbar {
  display: flex;
  gap: 3px;
  padding: 14px 18px;
}
.filterbar button {
  font-size: 12px;
  padding: 8px 11px;
  color: var(--muted);
}
.filterbar button.active {
  background: #6979ed20;
  color: var(--accent);
}
.conversation-list {
  overflow-y: auto;
  padding: 0 10px;
  flex: 1;
}
.chat-item {
  width: 100%;
  display: flex;
  gap: 11px;
  text-align: start;
  padding: 15px 12px;
  margin: 2px 0;
  border-radius: 13px;
}
.chat-item.active {
  background: #6979ed23;
}
.chat-item .meta {
  flex: 1;
  overflow: hidden;
}
.chat-item strong {
  font-size: 13px;
}
.chat-item p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  color: var(--muted);
  margin: 8px 0 0;
}
.chat-item .count {
  background: var(--accent2);
  color: white;
  border-radius: 7px;
  font-size: 10px;
  min-width: 19px;
  padding: 3px;
  height: 20px;
}
.sidebar-foot {
  padding: 15px 22px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
}
.dot {
  height: 6px;
  width: 6px;
  border-radius: 50%;
  background: var(--green);
}
.dot.off {
  background: #ecb16a;
}
.chat-area {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-image: radial-gradient(#7384aa0e 1px, transparent 1px);
  background-size: 22px 22px;
}
.chat-header {
  height: 87px;
  padding: 18px 30px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header h2 {
  font-size: 15px;
  margin: 0 0 6px;
}
.chat-header small {
  font-size: 10px;
}
.chat-header .tools {
  margin-inline-start: auto;
}
.mobile-back {
  display: none;
}
.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 30px;
}
.empty-symbol {
  width: 100px;
  height: 100px;
  border-radius: 34px;
  background: linear-gradient(145deg, #6979ed30, #6979ed08);
  display: grid;
  place-items: center;
  margin-bottom: 30px;
  border: 1px solid #6979ed30;
}
.empty-symbol img {
  height: 52px;
}
.empty-state h2 {
  font-size: 24px;
  margin-bottom: 12px;
}
.empty-state p {
  font-size: 13px;
  color: var(--muted);
  line-height: 2;
  max-width: 330px;
}
.empty-features {
  display: flex;
  gap: 15px;
  margin-top: 30px;
  font-size: 10px;
  color: var(--muted);
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 25px clamp(18px, 5vw, 80px);
  display: flex;
  flex-direction: column;
  gap: 13px;
  scroll-behavior: smooth;
}
.date-divider {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  margin: 5px auto 16px;
  background: var(--panel);
  padding: 7px 16px;
  border-radius: 20px;
}
.message {
  align-self: flex-end;
  max-width: 78%;
  min-width: 120px;
  background: var(--panel2);
  border: 1px solid var(--border);
  padding: 12px 15px 8px;
  border-radius: 17px 17px 17px 4px;
  position: relative;
}
.message.mine {
  align-self: flex-start;
  background: var(--bubble);
  border-color: #8393ff25;
  border-radius: 17px 17px 4px 17px;
}
.message .sender {
  font-size: 10px;
  color: var(--accent);
  margin-bottom: 7px;
}
.message .body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.95;
  font-size: 13px;
}
.message.deleted .body {
  font-style: italic;
  color: var(--muted);
}
.message .time {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
  font-size: 9px;
  color: var(--muted);
  margin-top: 6px;
}
.message .time button {
  padding: 0 5px;
  font-size: 15px;
  line-height: 15px;
}
.message .reply-label {
  border-inline-start: 2px solid var(--accent);
  padding: 5px 8px;
  color: var(--accent);
  font-size: 10px;
  margin-bottom: 9px;
}
.message img {
  max-width: 280px;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border-radius: 9px;
}
.message audio {
  max-width: 260px;
  width: 100%;
  height: 38px;
}
.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: #8794ff12;
  border-radius: 9px;
  text-decoration: none;
  font-size: 12px;
}
.file-card strong {
  display: block;
  font-size: 11px;
}
.reaction-list {
  font-size: 11px;
  margin-top: 4px;
}
.composer-wrap {
  padding: 12px 24px 17px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 9px;
  border-radius: 16px;
}
.composer textarea {
  background: transparent;
  border: 0;
  box-shadow: none;
  min-height: 40px;
  height: 40px;
  max-height: 130px;
  resize: none;
  padding: 10px 4px;
  flex: 1;
  font-size: 13px;
}
.composer .send {
  width: 43px;
  height: 43px;
  border-radius: 13px;
  background: var(--accent2);
  color: white;
  flex-shrink: 0;
}
.composer-note {
  font-size: 9px;
  color: var(--muted);
  padding: 8px 10px 0;
  display: flex;
  justify-content: space-between;
}
.reply-bar {
  padding: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--accent);
}
.load-more {
  align-self: center;
  font-size: 11px;
  color: var(--accent);
}
.panel-page {
  overflow: auto;
  flex: 1;
  padding: 32px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.page-heading {
  margin-bottom: 30px;
}
.page-heading p {
  color: var(--muted);
  font-size: 12px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 25px;
}
.stat {
  border: 1px solid var(--border);
  background: var(--panel);
  padding: 22px;
  border-radius: 16px;
}
.stat strong {
  display: block;
  font-size: 26px;
  margin: 12px 0;
}
.stat span {
  font-size: 11px;
  color: var(--muted);
}
.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 22px;
}
.admin-nav button {
  border: 1px solid var(--border);
  font-size: 12px;
}
.admin-nav .active {
  background: var(--accent2);
  color: white;
}
.section {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 16px;
  margin-bottom: 20px;
}
.section p {
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: start;
  font-size: 12px;
}
th,
td {
  text-align: start;
  padding: 14px 9px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-weight: normal;
}
table button {
  font-size: 11px;
  padding: 7px 9px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.check input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent2);
}
.policy-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 20px;
}
.policy-fields .label {
  font-size: 11px;
}
.policy-fields .check {
  font-size: 12px;
}
.result-code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  direction: ltr;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  font-family: monospace;
  font-size: 12px;
  max-height: 300px;
  overflow: auto;
}
.member-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border);
}
.member-row .details {
  flex: 1;
}
.member-row strong {
  font-size: 12px;
}
.member-row small {
  display: block;
  font-size: 10px;
}
.error {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.8;
}
.recording {
  color: #ff8c97 !important;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  50% {
    opacity: 0.4;
  }
}
dialog {
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: min(600px, calc(100% - 30px));
  max-height: 88dvh;
  padding: 0;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: #070b14b3;
  backdrop-filter: blur(4px);
}
dialog > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
dialog h2 {
  margin: 0;
  font-size: 17px;
}
#dialog-body {
  padding: 24px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--panel2);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px 23px;
  border-radius: 12px;
  transition: transform 0.2s;
  z-index: 10;
  max-width: 90vw;
  font-size: 12px;
}
#toast.show {
  transform: translateX(-50%) translateY(0);
}
.notice {
  padding: 13px 17px;
  background: #6979ed12;
  color: var(--accent);
  border: 1px solid #6979ed28;
  border-radius: 11px;
  font-size: 11px;
  line-height: 1.9;
}
.search-results {
  max-height: 300px;
  overflow: auto;
}
.search-results button {
  width: 100%;
  text-align: start;
}
.hint {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.9;
}
.zero {
  padding: 35px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 2;
}
.json-editor {
  direction: ltr;
  text-align: left;
  font: 12px/1.7 monospace;
  min-height: 190px;
}
.desktop-label {
  display: inline;
}
.message-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.message-action-grid button {
  border: 1px solid var(--border);
}
@media (min-width: 1500px) {
  .workspace {
    grid-template-columns: 85px 350px minmax(0, 1fr);
  }
  .messages {
    padding-inline: 12%;
  }
}
@media (max-width: 1000px) {
  .workspace {
    grid-template-columns: 64px 270px minmax(0, 1fr);
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .chat-header {
    padding: 16px;
  }
  .message {
    max-width: 90%;
  }
}
@media (max-width: 700px) {
  .auth {
    display: block;
  }
  .auth-story {
    padding: 28px;
    border: 0;
  }
  .auth-story h1,
  .auth-story p,
  .auth-art,
  .auth-story footer {
    display: none;
  }
  .auth-form {
    padding: 20px 30px;
  }
  .workspace {
    grid-template-columns: 58px minmax(0, 1fr);
  }
  .rail {
    padding: 20px 8px;
  }
  .sidebar {
    width: auto;
  }
  .chat-area {
    display: none;
  }
  .workspace.chat-open {
    display: block;
  }
  .workspace.chat-open .rail,
  .workspace.chat-open .sidebar {
    display: none;
  }
  .workspace.chat-open .chat-area {
    display: flex;
    height: 100dvh;
  }
  .mobile-back {
    display: inline-grid;
  }
  .chat-header {
    height: 76px;
    gap: 8px;
    padding: 12px;
  }
  .chat-header .avatar {
    width: 36px;
    height: 36px;
    border-radius: 12px;
  }
  .chat-header h2 {
    font-size: 13px;
  }
  .chat-header .tools {
    gap: 0;
  }
  .chat-header .tools .icon {
    width: 33px;
  }
  .messages {
    padding: 18px 12px;
  }
  .composer-wrap {
    padding: 8px 8px max(10px, env(safe-area-inset-bottom));
  }
  .composer {
    gap: 3px;
  }
  .composer .icon {
    width: 33px;
  }
  .composer-note {
    font-size: 8px;
  }
  .panel-page {
    padding: 19px 13px;
  }
  .cards {
    gap: 9px;
  }
  .stat {
    padding: 15px;
  }
  .stat strong {
    font-size: 22px;
  }
  .section {
    padding: 17px;
  }
  .form-grid,
  .policy-fields {
    grid-template-columns: 1fr;
  }
  .desktop-label {
    display: none;
  }
  .message audio {
    max-width: 220px;
  }
  .message {
    max-width: 88%;
  }
  dialog > header {
    padding: 14px 18px;
  }
  #dialog-body {
    padding: 18px;
  }
  .empty-features {
    flex-wrap: wrap;
    justify-content: center;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
