:root {
  --bg: #07080b;
  --panel: #101116;
  --panel-2: #171922;
  --line: rgba(255,255,255,.09);
  --text: #f7f7fb;
  --muted: #8c92a3;
  --red: #e02232;
  --red-2: #ff4051;
  --red-soft: rgba(224,34,50,.16);
  --green: #32d583;
  --yellow: #f5c044;
  --topbar-height: 76px;
  --panel-title-height: 48px;
  --control-height: 34px;
}
* { box-sizing: border-box; }
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.22) rgba(0,0,0,.18);
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: rgba(0,0,0,.18);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(224,34,50,.38));
  border: 2px solid rgba(0,0,0,.18);
  border-radius: 999px;
}
*::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(255,255,255,.26), rgba(255,64,81,.55));
}
*::-webkit-scrollbar-corner { background: transparent; }
html, body { height: 100%; }
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.ui-icon {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}
.mobile-nav { display: none; }
button, input, textarea, select { font: inherit; }
button {
  border: 0;
  border-radius: 8px;
  background: var(--red);
  color: white;
  padding: 10px 14px;
  font-weight: 800;
  cursor: pointer;
}
button:hover { background: var(--red-2); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost {
  background: #1a1d27;
  color: var(--text);
  border: 1px solid var(--line);
}
button.ghost:hover { border-color: rgba(255,255,255,.2); background: #222633; }
button.danger { background: #68141c; }
button.small { padding: 8px 10px; font-size: 12px; }
button.mini { padding: 5px 8px; font-size: 11px; }
button.full { width: 100%; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  background: #0b0c11;
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  outline: none;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.muted { color: var(--muted); }
.eyebrow {
  color: var(--red-2);
  font-weight: 900;
  text-transform: uppercase;
  font-size: 12px;
}
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 25% 20%, rgba(224,34,50,.20), transparent 34%),
    linear-gradient(150deg, #07080b 0%, #11131a 56%, #22070b 100%);
}
.login-shell { width: min(440px, calc(100vw - 32px)); }
.login-panel {
  border: 1px solid var(--line);
  background: rgba(16,17,22,.92);
  padding: 34px;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
  text-align: center;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--red), #7d111a);
  color: white;
  font-weight: 1000;
}
.brand-logo {
  width: 46px;
  height: 46px;
  display: block;
  flex: 0 0 46px;
  object-fit: contain;
  filter: drop-shadow(0 0 12px rgba(224,34,50,.32));
}
.login-logo {
  width: 104px;
  height: 104px;
  margin: 0 auto 10px;
}
.login-panel h1 { margin: 10px 0 8px; font-size: 32px; }
.login-form { display: grid; gap: 14px; margin-top: 24px; }
.login-form label, .profile-form label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.profile-form label.inline-check { display: flex; align-items: center; gap: 8px; color: var(--text); }
.profile-form label.inline-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.login-form button { margin-top: 6px; }
.alert {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 16px;
}
.alert.danger { border-color: rgba(224,34,50,.45); background: var(--red-soft); color: #ffdbe0; }
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: 330px 1fr;
  overflow: hidden;
}
body.accounts-collapsed .app-shell { grid-template-columns: 66px 1fr; }
.accounts-rail {
  border-right: 1px solid var(--line);
  background: #0b0c11;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.rail-head {
  height: var(--topbar-height);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #0d0f15;
}
.brand-row { min-width: 0; display: flex; align-items: center; gap: 12px; }
.brand-row b { display: block; line-height: 1.05; letter-spacing: .04em; }
.brand-row span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-head-tools { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.rail-collapse-toggle { width: 34px; height: 34px; }
body.accounts-collapsed .rail-head {
  height: auto;
  min-height: var(--topbar-height);
  padding: 10px;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}
body.accounts-collapsed .brand-row { justify-content: center; }
body.accounts-collapsed .brand-row > div,
body.accounts-collapsed .logout,
body.accounts-collapsed .limit-card,
body.accounts-collapsed .rail-actions,
body.accounts-collapsed .search-box,
body.accounts-collapsed .new-replies-section,
body.accounts-collapsed .account-list {
  display: none;
}
body.accounts-collapsed .brand-logo { width: 38px; height: 38px; flex-basis: 38px; }
body.accounts-collapsed .rail-collapse-toggle .ui-icon { transform: rotate(180deg); }
.logout {
  flex: 0 0 auto;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
}
.logout:hover { color: #fff; border-color: var(--line); background: rgba(255,255,255,.045); }
.limit-card {
  margin: 14px;
  padding: 12px;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.limit-card span { display: block; color: var(--muted); font-size: 11px; }
.limit-card b { font-size: 20px; }
.rail-actions { padding: 0 14px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.search-box { padding: 0 14px 12px; }
.new-replies-section {
  padding: 0 8px 8px;
  border-bottom: 1px solid var(--line);
}
.new-replies-section.hidden { display: none; }
.rail-section-title {
  padding: 0 8px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.rail-section-title b { color: var(--text); font-size: 13px; }
.rail-section-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.rail-mini-button {
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 7px;
  background: rgba(255,255,255,.045);
  color: rgba(255,255,255,.72);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.rail-mini-button:hover {
  border-color: rgba(255,255,255,.20);
  background: rgba(255,255,255,.075);
  color: #fff;
}
.rail-mini-button:disabled {
  cursor: default;
  opacity: .55;
}
.rail-section-title #new-replies-count {
  min-width: 20px;
  height: 20px;
  padding: 1px 6px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 19px;
}
.reply-list {
  max-height: 238px;
  overflow: auto;
}
.reply-row {
  background: rgba(224,34,50,.07);
  border-color: rgba(224,34,50,.22);
}
.reply-row .reply-account {
  display: block;
  margin-top: 2px;
  color: rgba(255,255,255,.48);
  font-style: normal;
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dialog-toolbar {
  display: grid;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,.045);
}
.dialog-toolbar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.segmented {
  min-height: var(--control-height);
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255,255,255,.04);
}
.segmented button {
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 7px;
  font-size: 12px;
}
.segmented button.active { background: var(--red); color: #fff; }
.dialog-tools { display: inline-flex; gap: 6px; }
.quick-contact-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--control-height);
  gap: 6px;
  min-height: var(--control-height);
}
.quick-contact-form input {
  height: var(--control-height);
  min-width: 0;
  border-radius: 8px;
  font-size: 13px;
}
.quick-contact-form .icon-button {
  border-color: rgba(224,34,50,.42);
}
.quick-contact-form.loading input,
.quick-contact-form.loading .icon-button {
  opacity: .68;
}
.icon-button {
  width: var(--control-height);
  height: var(--control-height);
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
}
.icon-button .ui-icon { width: 16px; height: 16px; }
.group-create-button {
  border-color: rgba(224,34,50,.46);
  background: rgba(224,34,50,.13);
  color: #ffd8dd;
}
.group-create-button:hover { background: rgba(224,34,50,.24); }
.account-list, .dialog-list {
  overflow: auto;
  min-height: 0;
  padding: 8px;
}
.account-row, .dialog-row {
  width: 100%;
  display: grid;
  gap: 10px;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  padding: 9px;
  border-radius: 10px;
  color: var(--text);
  margin-bottom: 4px;
}
.account-row { grid-template-columns: 44px minmax(0, 1fr) auto; }
.dialog-row { grid-template-columns: 44px minmax(0, 1fr) auto auto auto auto auto; }
.account-row:hover, .dialog-row:hover { background: #141720; }
.account-row.active, .dialog-row.active {
  background: linear-gradient(90deg, var(--red-soft), rgba(255,255,255,.03));
  border-color: rgba(224,34,50,.42);
}
.account-row.restricted {
  background: rgba(247, 188, 45, .10);
  border-color: rgba(247, 188, 45, .26);
}
.account-row.restricted:hover { background: rgba(247, 188, 45, .16); }
.account-row.restricted.active {
  background: linear-gradient(90deg, rgba(247, 188, 45, .22), rgba(255,255,255,.03));
  border-color: rgba(247, 188, 45, .48);
}
.account-row.slipped {
  background: rgba(255, 31, 47, .16);
  border-color: rgba(255, 31, 47, .52);
}
.account-row.slipped:hover { background: rgba(255, 31, 47, .24); }
.account-row.slipped.active {
  background: linear-gradient(90deg, rgba(255, 31, 47, .32), rgba(255,255,255,.04));
  border-color: rgba(255, 31, 47, .76);
}
.account-row.account-pinned {
  border-color: rgba(255, 194, 87, .38);
  background: rgba(255, 194, 87, .06);
}
.account-row.account-pinned.active {
  background: linear-gradient(90deg, rgba(255, 194, 87, .16), rgba(224,34,50,.12));
  border-color: rgba(255, 194, 87, .58);
}
.account-row em {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.account-pin-icon {
  width: 13px;
  height: 13px;
  color: #ffc257;
  flex: 0 0 auto;
}
.dialog-row.pinned {
  border-color: rgba(255, 194, 87, .34);
  background: rgba(255, 194, 87, .07);
}
.dialog-row.pinned.active {
  background: linear-gradient(90deg, rgba(255, 194, 87, .17), rgba(224,34,50,.11));
  border-color: rgba(255, 194, 87, .52);
}
.dialog-row.has-unread {
  border-color: rgba(92, 185, 255, .42);
  background: rgba(92, 185, 255, .08);
}
.dialog-row.has-unread:hover { background: rgba(92, 185, 255, .13); }
.dialog-row.has-unread.active {
  background: linear-gradient(90deg, rgba(92, 185, 255, .18), rgba(224,34,50,.10));
  border-color: rgba(92, 185, 255, .60);
}
.dialog-row.label-blue { border-color: rgba(69, 146, 255, .36); background: rgba(69, 146, 255, .07); }
.dialog-row.label-green { border-color: rgba(45, 198, 127, .34); background: rgba(45, 198, 127, .07); }
.dialog-row.label-purple { border-color: rgba(174, 124, 255, .36); background: rgba(174, 124, 255, .08); }
.dialog-row.label-cyan { border-color: rgba(61, 209, 230, .34); background: rgba(61, 209, 230, .07); }
.dialog-row.label-teal { border-color: rgba(36, 184, 160, .34); background: rgba(36, 184, 160, .07); }
.dialog-row.label-indigo { border-color: rgba(118, 143, 255, .36); background: rgba(118, 143, 255, .08); }
.dialog-row.label-blue.active { background: linear-gradient(90deg, rgba(69, 146, 255, .20), rgba(255,255,255,.04)); }
.dialog-row.label-green.active { background: linear-gradient(90deg, rgba(45, 198, 127, .20), rgba(255,255,255,.04)); }
.dialog-row.label-purple.active { background: linear-gradient(90deg, rgba(174, 124, 255, .21), rgba(255,255,255,.04)); }
.dialog-row.label-cyan.active { background: linear-gradient(90deg, rgba(61, 209, 230, .19), rgba(255,255,255,.04)); }
.dialog-row.label-teal.active { background: linear-gradient(90deg, rgba(36, 184, 160, .19), rgba(255,255,255,.04)); }
.dialog-row.label-indigo.active { background: linear-gradient(90deg, rgba(118, 143, 255, .20), rgba(255,255,255,.04)); }
.dialog-pin {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffc257;
}
.dialog-pin .ui-icon { width: 14px; height: 14px; }
.account-row span, .dialog-row span { min-width: 0; }
.account-row b, .dialog-row b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-row small, .dialog-row small {
  display: block;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
}
.dialog-tags {
  display: block;
  color: #ff9aa8;
  font-size: 11px;
  font-style: normal;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 3px;
}
.dialog-status {
  font-style: normal;
  color: #ffccd3;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 3px 6px;
  font-size: 10px;
  max-width: 82px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dialog-label-dot {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  justify-self: end;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
}
.dialog-label-dot.blue { background: #4592ff; }
.dialog-label-dot.green { background: #2dc67f; }
.dialog-label-dot.purple { background: #ae7cff; }
.dialog-label-dot.cyan { background: #3dd1e6; }
.dialog-label-dot.teal { background: #24b8a0; }
.dialog-label-dot.indigo { background: #768fff; }
.dialog-read-status {
  min-width: 24px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
}
.dialog-read-status .message-status {
  min-width: 18px;
  font-size: 12px;
}
.dialog-presence {
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  color: rgba(255,255,255,.62);
  background: rgba(255,255,255,.035);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}
.dialog-presence.online {
  color: #aaf4ce;
  border-color: rgba(50,213,131,.34);
  background: rgba(50,213,131,.10);
}
.dialog-row.has-unread b { font-weight: 900; }
.dialog-row.has-unread small { color: rgba(236,246,255,.88); }
.dialog-scheduled {
  max-width: 118px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border: 1px solid rgba(64, 156, 255, .42);
  border-radius: 999px;
  background: rgba(64, 156, 255, .12);
  color: #9ed4ff;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
}
.dialog-scheduled .ui-icon {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}
.dialog-scheduled span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-row em { font-style: normal; color: var(--muted); font-size: 11px; }
.account-row.restricted em { color: #ffd879; }
.account-row.slipped em { color: #ffb0b8; }
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #252a36;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  overflow: hidden;
  position: relative;
}
.avatar span { position: relative; z-index: 0; }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; z-index: 1; }
.avatar.lg { width: 48px; height: 48px; }
.avatar.xl { width: 82px; height: 82px; margin: 0 auto 12px; border: 3px solid rgba(224,34,50,.38); }
.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(680px, 1fr) 340px;
}
.chat-zone {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.thread-head {
  height: var(--topbar-height);
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #0d0f15;
}
.thread-head h1 { margin: 0; font-size: 20px; }
.thread-head span { color: var(--muted); font-size: 13px; }
.thread-actions { display: flex; align-items: center; gap: 8px; }
.pill {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.pill.off { background: #272a33; color: var(--muted); }
.pill.on { background: rgba(50,213,131,.16); color: var(--green); }
.pill.wait { background: rgba(245,192,68,.16); color: var(--yellow); }
.chat-layout {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 310px 1fr;
}
.dialog-panel {
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #101116;
  display: flex;
  flex-direction: column;
}
.panel-title {
  min-height: var(--panel-title-height);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.panel-title span { color: var(--muted); font-size: 12px; }
.presence-indicator {
  width: fit-content;
  margin-top: 5px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 999px;
  color: rgba(255,255,255,.68);
  background: rgba(255,255,255,.04);
  font-size: 11px;
  font-weight: 800;
}
.presence-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,.42);
}
.presence-indicator.online {
  color: #b9f9d8;
  border-color: rgba(50,213,131,.34);
  background: rgba(50,213,131,.10);
}
.presence-indicator.online::before {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(50,213,131,.13);
}
.presence-indicator.hidden { display: none; }
.unread {
  min-width: 22px;
  height: 22px;
  padding: 1px 7px 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  line-height: 21px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.messages-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(11,12,17,.94), rgba(11,12,17,.94)),
    repeating-linear-gradient(135deg, rgba(224,34,50,.08), rgba(224,34,50,.08) 1px, transparent 1px, transparent 18px);
}
.messages {
  flex: 1;
  overflow: auto;
  padding: 18px 22px;
  min-height: 0;
}
.virtual-spacer {
  flex: 0 0 auto;
  min-height: 0;
}
.msg { display: flex; margin: 7px 0; align-items: flex-end; gap: 8px; }
.msg.out { justify-content: flex-end; }
.msg.has-avatar { justify-content: flex-start; }
.msg .bubble { cursor: default; }
.msg .bubble:hover { border-color: rgba(255,255,255,.18); }
.message-avatar {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #252936;
  color: rgba(255,255,255,.76);
  font-size: 12px;
  font-weight: 900;
}
.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  grid-area: 1 / 1;
}
.message-avatar span { grid-area: 1 / 1; }
.message-avatar.profile-clickable {
  padding: 0;
  border: 0;
  cursor: pointer;
}
.message-avatar.profile-clickable:hover,
.message-avatar.profile-clickable:focus-visible {
  background: #333848;
  outline: 2px solid rgba(255,255,255,.18);
  outline-offset: 2px;
}
.bubble {
  max-width: min(680px, 78%);
  background: #20232d;
  border: 1px solid rgba(255,255,255,.08);
  padding: 7px 10px 5px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.msg.out .bubble {
  background: linear-gradient(135deg, #8f1722, #d92334);
  border-color: rgba(255,255,255,.16);
}
.msg.scheduled.out .bubble {
  background: linear-gradient(135deg, #135c8f, #1f8bd6);
  border-color: rgba(158,212,255,.32);
  box-shadow: 0 8px 24px rgba(19,92,143,.24);
}
.msg.deleted .bubble,
.msg.deleted.out .bubble {
  background: #26070b;
  border-color: rgba(255,64,81,.48);
  color: #ffd6dc;
  box-shadow: 0 8px 24px rgba(120,0,16,.24);
}
.msg.deleted .bubble-text,
.msg.deleted .attachment,
.msg.deleted .message-reactions {
  opacity: .58;
}
.deleted-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin: 0 0 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,64,81,.2);
  border: 1px solid rgba(255,64,81,.38);
  color: #ffd7dc;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: lowercase;
}
.sender { color: #ffb3bc; font-size: 12px; font-weight: 800; margin-bottom: 2px; }
.sender.profile-clickable {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #ffb3bc;
  text-align: left;
  cursor: pointer;
}
.sender.profile-clickable:hover,
.sender.profile-clickable:focus-visible {
  background: transparent;
  color: #ffd5db;
  text-decoration: underline;
  outline: 0;
}
.reply-preview {
  margin: 0 0 5px;
  padding: 5px 7px;
  border-left: 2px solid rgba(255,255,255,.42);
  border-radius: 7px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.78);
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
}
.forward-preview {
  display: grid;
  gap: 2px;
  margin: 0 0 5px;
  padding: 6px 8px;
  border: 1px solid rgba(255,255,255,.14);
  border-left: 2px solid rgba(255,194,87,.7);
  border-radius: 7px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.84);
  font-size: 12px;
  line-height: 1.25;
}
.forward-preview b,
.forward-preview span {
  display: block;
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.forward-preview b {
  color: #ffe1a6;
  font-size: 12px;
}
.bubble-text { line-height: 1.34; white-space: pre-wrap; word-break: break-word; }
.scheduled-message-badge {
  width: fit-content;
  max-width: 100%;
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid rgba(64, 156, 255, .44);
  border-radius: 999px;
  background: rgba(64, 156, 255, .15);
  color: #d6ecff;
  font-size: 12px;
  font-weight: 850;
}
.scheduled-message-badge .ui-icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}
.message-reactions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.message-reaction {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.11);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.message-reaction.mine {
  border-color: rgba(64, 156, 255, .46);
  background: rgba(64, 156, 255, .18);
  color: #dff0ff;
}
.message-reaction-emoji {
  font-size: 14px;
  line-height: 1;
}
.message-reaction-count {
  min-width: 8px;
  color: rgba(255,255,255,.74);
  font-size: 11px;
  line-height: 1;
}
.bubble time {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 3px;
  text-align: right;
  color: rgba(255,255,255,.58);
  font-size: 10px;
}
.message-status {
  min-width: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: rgba(255,255,255,.72);
  font-weight: 900;
  letter-spacing: 0;
}
.message-status.pending { color: rgba(255,255,255,.48); }
.message-status.scheduled, .message-status.native_scheduled { color: #bfe4ff; }
.message-status.scheduled .ui-icon, .message-status.native_scheduled .ui-icon { width: 13px; height: 13px; }
.message-status.delivered, .message-status.read { color: #9ee8ff; }
.message-status.failed { color: #ffd1d6; }
.attachment { margin-top: 6px; border-radius: 10px; overflow: hidden; max-width: 340px; }
.attachment[data-photo-viewer-src],
.avatar img[data-photo-viewer-src],
.thread-head .avatar img[data-photo-viewer-src],
.participant-profile-head .avatar img[data-photo-viewer-src] {
  cursor: zoom-in;
}
.attachment.image, .attachment.video {
  display: block;
  width: min(340px, 100%);
  max-height: 360px;
  object-fit: contain;
  background: #050507;
}
.attachment.image {
  min-height: 132px;
  aspect-ratio: 4 / 3;
}
.attachment.video {
  min-height: 150px;
  aspect-ratio: 16 / 9;
}
.video-card {
  position: relative;
  display: block;
  width: min(340px, 100%);
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 1px solid rgba(255,255,255,.1);
  background: linear-gradient(135deg, rgba(255,255,255,.08), rgba(224,34,50,.12));
  color: var(--text);
  cursor: pointer;
}
.video-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.video-card.no-poster {
  display: grid;
  place-items: center;
  min-height: 150px;
}
.video-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(0,0,0,.62);
  border: 1px solid rgba(255,255,255,.24);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  padding-left: 3px;
}
.video-label {
  position: absolute;
  left: 9px;
  bottom: 8px;
  max-width: calc(100% - 18px);
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(0,0,0,.62);
  color: rgba(255,255,255,.92);
  font-size: 12px;
  font-weight: 700;
}
.video-card.no-poster .video-label {
  position: static;
  background: transparent;
  padding-top: 54px;
}
.attachment.sticker { display: block; width: min(160px, 45vw); max-height: 180px; object-fit: contain; background: transparent; }
.attachment.audio {
  width: min(300px, 70vw);
  height: 42px;
  display: block;
}
.attachment.file, .attachment.poster {
  padding: 10px;
  background: rgba(255,255,255,.08);
  color: var(--text);
}
.attachment.poster img { width: 100%; display: block; border-radius: 8px; margin-bottom: 6px; }
.attachment.poster img[data-photo-viewer-src] { cursor: zoom-in; }
.attachment.call,
.attachment.control,
.service-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.075);
  color: rgba(255,255,255,.88);
  font-size: 13px;
  font-weight: 750;
}
.attachment.call {
  border-radius: 999px;
}
.attachment.call .call-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  padding: 3px;
  background: rgba(255,255,255,.12);
  color: currentColor;
  flex: 0 0 auto;
}
.attachment.call.missed {
  color: #ffd5da;
  border-color: rgba(255,91,110,.34);
  background: rgba(224,34,50,.16);
}
.attachment.call.cancelled {
  color: #ffd9aa;
  border-color: rgba(255,172,80,.3);
  background: rgba(255,172,80,.12);
}
.attachment.call.outgoing {
  color: #d9fff1;
  border-color: rgba(55,214,154,.28);
  background: rgba(55,214,154,.12);
}
.attachment.call.incoming {
  color: #d9ecff;
  border-color: rgba(97,166,255,.28);
  background: rgba(97,166,255,.12);
}
.attachment.control,
.service-line {
  border-radius: 10px;
  color: rgba(255,255,255,.66);
  font-size: 12px;
  font-weight: 700;
}
.inline-keyboard {
  display: grid;
  gap: 6px;
  margin-top: 7px;
  max-width: 340px;
}
.inline-keyboard-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.inline-keyboard-button {
  min-height: 32px;
  flex: 1 1 120px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 9px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.inline-keyboard-button:hover:not(:disabled) {
  border-color: rgba(224,34,50,.55);
  background: rgba(224,34,50,.18);
}
.inline-keyboard-button:disabled,
.inline-keyboard-empty {
  opacity: .55;
  cursor: default;
}
.inline-keyboard-button.loading {
  opacity: .72;
}
.compose {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #0d0f15;
}
.scheduled-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  background: rgba(224,34,50,.06);
}
.scheduled-panel.hidden { display: none; }
.scheduled-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.scheduled-head b {
  min-width: 22px;
  min-height: 22px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(224,34,50,.22);
  color: #fff;
  font-size: 12px;
}
.scheduled-list {
  display: grid;
  gap: 6px;
}
.scheduled-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  background: rgba(0,0,0,.18);
}
.scheduled-row b,
.scheduled-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scheduled-row b { font-size: 12px; color: #fff; }
.scheduled-row span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.scheduled-row.sending { border-color: rgba(255,194,87,.35); }
.scheduled-row.failed { border-color: rgba(224,34,50,.42); }
.scheduled-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  margin-top: 0;
  overflow: visible;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.scheduled-row button {
  min-height: 28px;
  padding: 0 8px;
  border-radius: 8px;
}
.reply-panel {
  grid-column: 1 / -1;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-left: 3px solid var(--red-2);
  border-radius: 9px;
  background: rgba(255,255,255,.055);
  color: rgba(255,255,255,.82);
  font-size: 13px;
  overflow: hidden;
}
.reply-panel.hidden { display: none; }
.reply-panel span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-media-panel {
  grid-column: 1 / -1;
  min-height: 56px;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.1);
  border-left: 3px solid rgba(73,159,255,.88);
  border-radius: 9px;
  background: rgba(255,255,255,.055);
  overflow: hidden;
}
.pending-media-panel.hidden { display: none; }
.pending-media-preview {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.72);
  font-size: 11px;
  font-weight: 800;
}
.pending-media-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pending-media-info {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.pending-media-info b,
.pending-media-info span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-media-info b { color: #fff; font-size: 13px; }
.pending-media-info span { color: var(--muted); font-size: 12px; }
.pending-media-panel button {
  min-height: 30px;
  padding: 0 8px;
  border-radius: 8px;
}
.mention-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  max-height: 218px;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 9px;
  background: rgba(18,22,31,.98);
  box-shadow: 0 12px 26px rgba(0,0,0,.28);
}
.mention-panel.hidden { display: none; }
.mention-option {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 0;
  border-radius: 8px;
  color: rgba(255,255,255,.88);
  background: transparent;
  text-align: left;
}
.mention-option:hover,
.mention-option.active {
  background: rgba(224,34,50,.18);
  color: #fff;
}
.mention-option .avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
}
.mention-option-main,
.mention-option-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-option-main {
  font-size: 13px;
  font-weight: 800;
}
.mention-option-meta {
  color: var(--muted);
  font-size: 12px;
}
.attach-button {
  align-self: end;
  width: 44px;
  height: 44px;
  color: var(--muted);
  border-color: rgba(255,255,255,.1);
}
.schedule-button {
  align-self: end;
  width: 44px;
  height: 44px;
  color: var(--muted);
  border-color: rgba(255,255,255,.1);
}
.attach-button:not(:disabled):hover,
.schedule-button:not(:disabled):hover {
  color: #fff;
  border-color: rgba(224,34,50,.45);
}
.compose textarea { min-height: 44px; max-height: 140px; }
.send-icon-button {
  align-self: end;
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
}
.send-icon-button .ui-icon {
  width: 19px;
  height: 19px;
  margin-left: 2px;
}
.passport-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #090a0f;
  padding: 14px;
}
.side-profile-switch {
  position: sticky;
  top: 0;
  z-index: 4;
  margin-bottom: 12px;
  background: #090a0f;
  box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.side-profile-switch button {
  min-height: 34px;
  font-size: 12px;
  font-weight: 900;
}
[data-profile-scope][hidden] { display: none !important; }
.passport-card, .side-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.passport-card { text-align: center; }
.passport-card h2 { margin: 4px 0; }
.passport-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, .82fr);
  gap: 8px;
  margin-top: 14px;
  text-align: left;
}
.passport-grid div:first-child { grid-column: 1 / -1; }
.passport-grid div {
  background: #0b0c11;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
}
.passport-grid span { display: block; color: var(--muted); font-size: 11px; }
.passport-grid b { overflow-wrap: anywhere; }
#passport-phone { white-space: nowrap; overflow-wrap: normal; word-break: normal; font-size: 15px; }
.lead-profile-summary {
  display: grid;
  gap: 8px;
  justify-items: center;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}
.lead-profile-summary h2 {
  margin: 2px 0 0;
  max-width: 100%;
  font-size: 18px;
  overflow-wrap: anywhere;
}
.lead-profile-summary p {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.lead-profile-grid {
  width: 100%;
  margin-top: 6px;
}
.lead-profile-grid div:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  column-gap: 6px;
  align-items: center;
}
.lead-profile-grid div:first-child span {
  grid-column: 1 / -1;
}
.lead-profile-grid div:first-child b {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}
.lead-profile-extra {
  width: 100%;
  display: grid;
  gap: 6px;
  margin-top: 4px;
  text-align: left;
}
.lead-profile-extra div {
  display: grid;
  grid-template-columns: minmax(88px, .55fr) minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 7px 0;
  border-top: 1px solid rgba(255,255,255,.06);
}
.lead-profile-extra span {
  color: var(--muted);
  font-size: 11px;
}
.lead-profile-extra b {
  min-width: 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.lead-copy-phone {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}
.profile-form { margin-top: 14px; display: grid; gap: 8px; text-align: left; }
.profile-name-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}
.privacy-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  text-align: left;
}
.privacy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}
.privacy-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}
.privacy-row {
  display: grid;
  gap: 7px;
}
.privacy-row > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.privacy-choice {
  min-height: 38px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
}
.privacy-choice.phone,
.privacy-choice.triple { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.privacy-choice button {
  min-width: 0;
  min-height: 30px;
  padding: 0 9px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}
.privacy-choice button.active {
  background: var(--red);
  color: #fff;
}
.privacy-choice button:disabled {
  opacity: .62;
  cursor: wait;
}
.dialog-meta-form { display: grid; gap: 10px; text-align: left; }
.dialog-meta-form label { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.group-manage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: linear-gradient(90deg, rgba(224,34,50,.13), rgba(255,255,255,.025));
}
.group-manage-bar.hidden { display: none; }
.group-manage-bar b {
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.group-manage-bar span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}
.group-manage-bar .ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  white-space: nowrap;
}
.group-manage-bar .ui-icon { width: 14px; height: 14px; }
.side-actions, .tool-row, .tool-grid {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.tool-grid button { flex: 1 1 92px; }
.tool-form {
  display: grid;
  gap: 8px;
  text-align: left;
}
.tool-form + .tool-form { margin-top: 12px; }
.chat-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  background: rgba(255,255,255,.035);
}
.chat-settings-grid label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,.72);
  font-size: 12px;
}
.chat-settings-grid input { width: 14px; height: 14px; }
.session-row, .log-row {
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}
.session-row b, .log-row b { display: block; font-size: 13px; }
.session-row span, .log-row span, .log-row time { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; overflow-wrap: anywhere; }
.empty {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}
.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #141720;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.danger { border-color: rgba(224,34,50,.55); background: #250b10; }
.message-menu {
  position: fixed;
  z-index: 40;
  width: 210px;
  padding: 6px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  background: #11131a;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.message-menu.hidden { display: none; }
.message-menu button {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-size: 13px;
}
.message-menu button:hover { background: rgba(255,255,255,.08); }
.message-menu button.danger-menu { color: #ffb5bd; }
.message-menu button:disabled {
  opacity: .38;
  pointer-events: none;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
}
dialog::backdrop { background: rgba(0,0,0,.7); }
.photo-viewer-open { overflow: hidden; }
.portal-photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 72px 16px 24px;
}
.portal-photo-viewer.open { display: flex; }
.portal-photo-viewer__backdrop {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0,0,0,.84);
  cursor: zoom-out;
}
.portal-photo-viewer__toolbar {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  display: flex;
  gap: 8px;
}
.portal-photo-viewer__btn {
  min-width: 42px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(18,20,28,.92);
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  box-shadow: 0 12px 32px rgba(0,0,0,.32);
}
.portal-photo-viewer__btn:hover,
.portal-photo-viewer__btn:focus-visible {
  background: rgba(40,44,58,.96);
  outline: 2px solid rgba(255,255,255,.2);
  outline-offset: 2px;
}
.portal-photo-viewer__btn.wide { min-width: 82px; }
.portal-photo-viewer__canvas {
  position: relative;
  z-index: 1;
  width: calc(100vw - 32px);
  height: calc(100vh - 112px);
  display: grid;
  place-items: center;
  overflow: hidden;
}
.portal-photo-viewer__image {
  max-width: min(100%, 1280px);
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 22px 80px rgba(0,0,0,.55);
  transition: transform .16s ease;
  transform-origin: center;
}
.portal-photo-viewer__image.is-rotated {
  max-width: min(calc(100vh - 112px), 1280px);
  max-height: calc(100vw - 32px);
}
.dialog-card { width: 420px; padding: 18px; display: grid; gap: 12px; }
.dialog-card .hidden { display: none; }
.group-dialog-card { width: min(620px, calc(100vw - 28px)); }
.group-dialog-card.batch-mode { width: min(780px, calc(100vw - 28px)); }
.corporate-dialog-card { width: min(760px, calc(100vw - 28px)); }
.participant-profile-card { width: min(560px, calc(100vw - 28px)); }
.participant-profile-head {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}
.participant-profile-head .avatar.xl {
  margin: 0;
}
.participant-profile-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  overflow-wrap: anywhere;
}
.participant-profile-head p {
  margin: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.participant-profile-grid {
  margin-top: 0;
}
.participant-profile-extra {
  max-height: 180px;
  overflow: auto;
}
.participant-profile-card .dialog-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.dialog-section {
  display: grid;
  gap: 12px;
}
.dialog-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}
.dialog-tabs button {
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
}
.dialog-tabs button.active {
  color: #fff;
  background: rgba(255,255,255,.10);
}
.dialog-label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}
.dialog-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.corporate-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: center;
  gap: 10px;
}
.corporate-progress progress {
  width: 100%;
  height: 10px;
  accent-color: var(--red);
}
.corporate-progress span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}
.corporate-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.corporate-summary div {
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}
.corporate-summary b,
.corporate-summary span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.corporate-summary span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.corporate-preview {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
}
.corporate-preview-row {
  display: grid;
  gap: 4px;
  padding: 9px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(0,0,0,.18);
}
.corporate-preview-row b,
.corporate-preview-row span,
.corporate-preview-row p {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.corporate-preview-row span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.corporate-preview-row p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.corporate-preview-row.group {
  border-color: rgba(89, 159, 255, .28);
}
.corporate-preview-row.schedule {
  border-color: rgba(255, 255, 255, .08);
}
.corporate-mixed-settings {
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
}
.corporate-mixed-grid {
  display: grid;
  grid-template-columns: .7fr minmax(0, 1.4fr) .65fr;
  gap: 8px;
}
.corporate-mixed-grid input,
.corporate-mixed-grid select,
.corporate-mixed-settings textarea,
.corporate-mixed-settings select {
  width: 100%;
  min-width: 0;
}
.corporate-mixed-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.corporate-mixed-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.corporate-mixed-checks input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--red);
}
.corporate-run-log {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}
.corporate-log-row {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
}
.corporate-log-row b,
.corporate-log-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.corporate-log-row b { font-size: 12px; color: #fff; }
.corporate-log-row span { font-size: 12px; color: var(--muted); }
.corporate-log-row.running {
  border-color: rgba(255,194,87,.28);
  background: rgba(255,194,87,.08);
}
.corporate-log-row.ok {
  border-color: rgba(64,156,255,.38);
  background: rgba(64,156,255,.10);
}
.corporate-log-row.failed {
  border-color: rgba(224,34,50,.44);
  background: rgba(224,34,50,.12);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.group-settings-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  background: rgba(255,255,255,.035);
}
.group-settings-box label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(255,255,255,.76);
  font-size: 12px;
}
.group-settings-box input { width: 14px; height: 14px; }
.group-batch-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 8px;
}
.group-batch-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.84);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}
.group-batch-options input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--red);
}
.group-reaction-box {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(180px, 1fr) 64px;
  gap: 8px;
  align-items: center;
}
.group-reaction-box label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.035);
  color: rgba(255,255,255,.84);
  font-size: 12px;
  line-height: 1.2;
}
.group-reaction-box input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
  accent-color: var(--red);
}
.group-reaction-box select,
.group-reaction-box input[type="text"],
.group-reaction-box input:not([type]) {
  width: 100%;
  min-width: 0;
}
.group-batch-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}
.group-batch-settings {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.group-batch-settings input {
  width: 100%;
  min-width: 0;
}
.group-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.group-action-grid.hidden { display: none; }
.group-action-grid .ghost { min-height: 34px; }
.danger-lite {
  color: #ffc6cb;
  border-color: rgba(224,34,50,.35);
}
@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 290px 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .passport-panel { display: none; }
}
@media (max-width: 850px) {
  .app-shell { grid-template-columns: 1fr; }
  .accounts-rail { display: none; }
  .chat-layout { grid-template-columns: 1fr; }
  .dialog-panel { display: none; }
  .group-settings-box, .group-action-grid, .group-batch-options, .group-reaction-box { grid-template-columns: minmax(0, 1fr); }
  .corporate-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .corporate-mixed-grid,
  .corporate-mixed-checks { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px), (orientation: portrait) and (max-width: 1180px) {
  html, body { min-width: 0; overflow: hidden; }
  body {
    display: flex;
    flex-direction: column;
  }
  .mobile-nav {
    flex: 0 0 auto;
    min-height: 48px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border-bottom: 1px solid var(--line);
    background: #0d0f15;
    z-index: 20;
  }
  .mobile-nav button {
    min-width: 0;
    min-height: 36px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.045);
    color: var(--muted);
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .mobile-nav button.active {
    background: var(--red);
    color: #fff;
    border-color: rgba(255,255,255,.16);
  }
  .app-shell {
    flex: 1 1 auto;
    height: auto;
    min-height: 0;
    width: 100%;
    display: block;
    overflow: hidden;
  }
  body.accounts-collapsed .app-shell {
    grid-template-columns: 1fr;
  }
  body.accounts-collapsed .brand-row > div { display: block; }
  body.accounts-collapsed .logout { display: inline-flex; }
  body.accounts-collapsed .limit-card { display: grid; }
  body.accounts-collapsed .rail-actions { display: grid; }
  body.accounts-collapsed .search-box,
  body.accounts-collapsed .new-replies-section:not(.hidden) { display: block; }
  body.accounts-collapsed .account-list { display: block; }
  body.accounts-collapsed .rail-head {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    flex-direction: row;
    justify-content: space-between;
  }
  body.accounts-collapsed .brand-logo {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
  }
  .accounts-rail,
  .workspace,
  .chat-zone,
  .chat-layout,
  .messages-panel,
  .passport-panel {
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
  }
  .accounts-rail,
  .workspace,
  .chat-zone,
  .chat-layout {
    display: flex;
    flex-direction: column;
  }
  .workspace {
    grid-template-columns: 1fr;
  }
  .accounts-rail {
    border-right: 0;
  }
  .rail-head,
  .thread-head {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
  }
  .rail-head {
    gap: 10px;
  }
  .brand-row > div,
  .thread-head > div {
    min-width: 0;
  }
  .thread-head {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
  }
  .thread-head .avatar.lg {
    width: 40px;
    height: 40px;
  }
  .thread-head h1 {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .thread-head span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }
  .thread-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }
  .thread-actions .pill {
    margin-right: auto;
  }
  .limit-card {
    margin: 10px;
    padding: 9px;
  }
  .limit-card b {
    font-size: 16px;
  }
  .rail-actions,
  .search-box {
    padding-left: 10px;
    padding-right: 10px;
  }
  .account-list,
  .dialog-list {
    flex: 1 1 auto;
    padding: 8px 6px 12px;
  }
  .account-row,
  .dialog-row {
    border-radius: 8px;
    padding: 8px;
    gap: 8px;
  }
  .dialog-row {
    grid-template-columns: 40px minmax(0, 1fr) auto auto auto auto;
  }
  .dialog-row .unread {
    grid-column: auto;
  }
  .dialog-row .dialog-status,
  .dialog-row .dialog-label-dot,
  .dialog-row .dialog-presence {
    display: none;
  }
  .dialog-toolbar {
    padding: 8px 10px;
    gap: 6px;
  }
  .dialog-toolbar-top {
    gap: 6px;
  }
  .dialog-toolbar .segmented {
    flex: 1 1 auto;
  }
  .dialog-toolbar .segmented button {
    flex: 1 1 0;
  }
  .messages {
    padding: 12px 10px;
  }
  .bubble {
    max-width: 88%;
  }
  .message-avatar {
    width: 24px;
    height: 24px;
    flex-basis: 24px;
  }
  .compose {
    flex: 0 0 auto;
    grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
    gap: 7px;
    padding: 8px;
  }
  .attach-button,
  .schedule-button,
  .send-icon-button {
    width: 42px;
    height: 42px;
    border-radius: 10px;
  }
  .compose textarea {
    min-height: 42px;
    max-height: 108px;
    padding: 10px;
  }
  .passport-panel {
    display: block;
    border-left: 0;
    padding: 10px;
  }
  .passport-card,
  .side-section {
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
  }
  .passport-grid,
  .profile-name-grid,
  .group-settings-box,
  .corporate-summary,
  .group-action-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .dialog-card {
    width: min(420px, calc(100vw - 20px));
    max-height: calc(100vh - 72px);
    overflow: auto;
    padding: 14px;
  }
  .dialog-actions {
    flex-wrap: wrap;
  }
  .dialog-actions button {
    flex: 1 1 120px;
  }
  .participant-profile-head {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
  }
  body[data-mobile-view="accounts"] .workspace,
  body[data-mobile-view="dialogs"] .accounts-rail,
  body[data-mobile-view="chat"] .accounts-rail,
  body[data-mobile-view="profile"] .accounts-rail {
    display: none;
  }
  body[data-mobile-view="accounts"] .accounts-rail {
    display: flex;
  }
  body[data-mobile-view="dialogs"] .passport-panel,
  body[data-mobile-view="dialogs"] .messages-panel,
  body[data-mobile-view="chat"] .passport-panel,
  body[data-mobile-view="chat"] .dialog-panel,
  body[data-mobile-view="profile"] .chat-zone {
    display: none;
  }
  body[data-mobile-view="dialogs"] .dialog-panel,
  body[data-mobile-view="chat"] .messages-panel,
  body[data-mobile-view="profile"] .workspace,
  body[data-mobile-view="profile"] .passport-panel {
    display: flex;
  }
  body[data-mobile-view="dialogs"] .thread-head {
    display: none;
  }
  body[data-mobile-view="profile"] .passport-panel {
    display: block;
  }
}
