/* ==========================================================================
   Souch dlc — cabinet, social and admin surfaces
   Layout follows the reference: hero banner, then a card grid on a rail.
   ========================================================================== */

/* ============================== CABINET ================================= */

.sd-cabinet {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 20px;
  width: 100%;
  max-width: var(--content);
  margin: 0 auto;
  padding: 20px var(--pad-x) 72px;
  align-items: start;
}

/* ------------------------------- rail ---------------------------------- */

.sd-side {
  position: sticky;
  top: 96px;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-panel);
  background: rgba(10, 10, 12, 0.62);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 var(--c-white-6),
    0 12px 34px -18px rgba(0, 0, 0, 0.9);
}

/* Identity block sits above the rail, like the reference avatar chip. */
.sd-side__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-bottom: 6px;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-panel);
  background: rgba(10, 10, 12, 0.62);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
}

.sd-side__user img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.sd-side__user-name {
  display: block;
  font-size: 13.5px;
  font-weight: 500;
}

.sd-side__user-meta {
  display: block;
  font-size: 11.5px;
  color: var(--c-white-48);
}

/* Rail column: identity card, then the floating menu. Both stick together so
   the account chip never scrolls away on long tabs. */
.sd-side__wrap {
  position: sticky;
  top: 96px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-self: start;
}

.sd-side__wrap .sd-side {
  position: static;
  top: auto;
}

.sd-side__link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  font-size: 13.5px;
  color: var(--c-white-48);
  text-align: left;
  transition:
    color 0.2s var(--ease-soft),
    background 0.2s var(--ease-soft),
    border-color 0.2s var(--ease-soft);
}

.sd-side__link:hover {
  color: var(--c-white);
  background: var(--c-white-4);
}

.sd-side__link.is-active {
  color: var(--c-white);
  border-color: var(--c-accent-24);
  background: var(--c-accent-12);
}

.sd-side__link.is-active .sd-i {
  color: var(--c-accent);
}

.sd-side__group {
  padding: 12px 12px 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-white-24);
}

/* ------------------------------ content -------------------------------- */

.sd-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* Hero banner at the top of the cabinet */
.sd-cab-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-panel);
  background:
    radial-gradient(ellipse 70% 140% at 8% 0%, rgba(255, 255, 255, 0.16), transparent 62%),
    radial-gradient(ellipse 50% 120% at 100% 100%, rgba(201, 201, 201, 0.08), transparent 60%),
    rgba(10, 10, 12, 0.62);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  box-shadow: inset 0 1px 0 var(--c-white-6);
}

.sd-cab-hero__avatar {
  position: relative;
  flex: 0 0 auto;
}

.sd-cab-hero__avatar img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--c-white-12);
}

.sd-cab-hero__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.sd-cab-hero__name {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.sd-cab-hero__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Summary tiles */
.sd-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.sd-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-control);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.2s var(--ease-soft), background 0.2s var(--ease-soft);
}

.sd-tile:hover {
  border-color: var(--c-accent-24);
  background: var(--c-accent-6);
}

.sd-tile__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-white-48);
}

.sd-tile__value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.sd-tile__hint {
  font-size: 12px;
  color: var(--c-white-48);
}

.sd-tile .sd-i {
  color: var(--c-accent);
}

/* ------------------------------ cards ---------------------------------- */

.sd-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-panel);
  background: rgba(10, 10, 12, 0.58);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  box-shadow:
    inset 0 1px 0 var(--c-white-6),
    0 12px 34px -20px rgba(0, 0, 0, 0.9);
}

.sd-card__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.sd-card__title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sd-card__hint {
  font-size: 12px;
  color: var(--c-white-48);
}

/* ============================== SOCIALS ================================= */

/* Channel / friend rows */
.sd-people {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sd-person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-control);
  background: rgba(255, 255, 255, 0.02);
}

.sd-person img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
}

.sd-person__name {
  font-size: 13.5px;
  font-weight: 500;
}

.sd-person__meta {
  font-size: 12px;
  color: var(--c-white-48);
}

.sd-person__actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* Presence dot */
.sd-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-white-24);
}

.sd-dot.is-on {
  background: #34d399;
  box-shadow: 0 0 8px rgba(52, 211, 153, 0.7);
}

.sd-dot.is-idle {
  background: #fbbf24;
}

/* ================================ ADMIN ================================= */

.sd-admin {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 20px var(--pad-x) 72px;
  align-items: start;
}

.sd-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}

.sd-table__scroll {
  overflow-x: auto;
  border: 1px solid var(--c-white-6);
  border-radius: var(--r-control);
}

.sd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sd-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--c-white-48);
  border-bottom: 1px solid var(--c-white-6);
  white-space: nowrap;
}

.sd-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-white-4);
  color: var(--c-white-72);
  vertical-align: middle;
}

.sd-admin .sd-table td {
  white-space: nowrap;
}

.sd-table tr:last-child td {
  border-bottom: none;
}

.sd-table tbody tr:hover td {
  background: var(--c-white-4);
}

@media (max-width: 980px) {
  .sd-cabinet,
  .sd-admin {
    grid-template-columns: minmax(0, 1fr);
  }

  .sd-side {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sd-side__group {
    display: none;
  }

  .sd-chat {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }
}


/* ------------------------------- commerce -------------------------------- */

.sd-commerce {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sd-commerce__row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
}

.sd-commerce__row + .sd-commerce__row {
  margin-top: 10px;
}

.sd-commerce__row strong {
  font-weight: 600;
  color: var(--c-text);
}

.sd-form__row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sd-form__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-dim);
  min-width: 110px;
}

.sd-tag {
  font-family: var(--f-mono, monospace);
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 8px;
  color: var(--c-accent);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
}

.sd-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--c-text-dim);
  background: rgba(255, 255, 255, 0.06);
}

.sd-table tr.is-masked td {
  color: var(--c-text-dim);
  opacity: 0.75;
}


/* ==========================================================================
   Chat (IRC-style) and friends
   ========================================================================== */

.sd-chat {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  height: calc(100vh - var(--island-h, 72px) - 150px);
  min-height: 520px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 22px;
  overflow: hidden;
  background: rgba(10, 12, 16, 0.55);
  backdrop-filter: blur(26px) saturate(1.25);
  -webkit-backdrop-filter: blur(26px) saturate(1.25);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.sd-chat__side {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 12px;
  min-height: 0;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.28);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sd-chat__group {
  padding: 12px 8px 7px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.sd-chat__chan {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--c-text-dim);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

.sd-chat__chan:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--c-text);
}

.sd-chat__chan.is-active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--c-accent);
}

.sd-chat__chan-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-chat__badge {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--c-accent);
  color: var(--c-accent-ink, #fff);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.sd-chat__main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.sd-chat__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.18);
}

.sd-chat__head-hash {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.1);
  color: var(--c-accent);
  font-size: 15px;
  font-weight: 700;
}

.sd-chat__head-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sd-chat__title {
  font-size: 14.5px;
  font-weight: 650;
  color: var(--c-text);
}

.sd-chat__sub {
  font-size: 11.5px;
  color: var(--c-text-dim);
}

.sd-chat__messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.sd-chat__messages::-webkit-scrollbar {
  width: 6px;
}

.sd-chat__messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.sd-chat__day {
  align-self: center;
  margin: 8px 0 4px;
  padding: 4px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--c-text-dim);
}

.sd-chat__empty {
  border: 0;
  background: none;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 100%;
  color: var(--c-text-dim);
  font-size: 12.5px;
}

/* ---------- messages ---------- */

.sd-msg {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  width: 100%;
  max-width: 780px;
}

.sd-msg.is-mine {
  flex-direction: row-reverse;
  margin-left: auto;
}

.sd-msg__ava {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--c-accent);
  font-size: 12.5px;
  font-weight: 700;
  overflow: hidden;
}

.sd-msg__ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sd-msg__ava.is-mine {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: var(--c-text);
}

.sd-msg__body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.sd-msg.is-mine .sd-msg__body {
  align-items: flex-end;
}

.sd-msg__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 1;
}

.sd-msg.is-mine .sd-msg__head {
  flex-direction: row-reverse;
}

.sd-msg__nick {
  font-size: 12px;
  font-weight: 650;
  color: var(--c-text);
}

.sd-msg__time {
  font-size: 10.5px;
  color: var(--c-text-dim);
}

.sd-msg__role {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--c-accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sd-msg__text {
  display: inline-block;
  width: fit-content;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 4px 14px 14px 14px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  line-height: 1.55;
  color: var(--c-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.sd-msg.is-mine .sd-msg__text {
  border-radius: 14px 4px 14px 14px;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.3);
}

/* ---------- mentions, links, replies ---------- */

/* A message that mentions me lights up a little, like a ping. */
.sd-msg.is-mentioned .sd-msg__body {
  position: relative;
}

.sd-msg.is-mentioned .sd-msg__body::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: -2px;
  left: -10px;
  right: -10px;
  border-left: 2px solid rgba(255, 255, 255, 0.75);
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), transparent 70%);
  pointer-events: none;
}

.sd-msg.is-mine.is-mentioned .sd-msg__body::before {
  border-left: 0;
  border-right: 2px solid rgba(255, 255, 255, 0.75);
  background: linear-gradient(270deg, rgba(255, 255, 255, 0.12), transparent 70%);
}

.sd-mention {
  appearance: none;
  display: inline;
  padding: 1px 5px;
  margin: 0 1px;
  border: 0;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--c-accent);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.sd-mention:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #e6e6e6;
}

.sd-mention.is-me {
  background: var(--c-accent);
  color: var(--c-accent-ink);
}

.sd-msg__link {
  color: var(--c-accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
  word-break: break-all;
}

.sd-msg__link:hover {
  color: #e6e6e6;
  border-bottom-color: rgba(230, 230, 230, 0.6);
}

.sd-msg__spacer {
  flex: 1;
}

/* Reply / mention actions stay invisible until the message is hovered. */
.sd-msg__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--c-text-dim);
  opacity: 0;
  cursor: pointer;
  transition: opacity 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.sd-msg:hover .sd-msg__action,
.sd-msg__action:focus-visible {
  opacity: 1;
}

.sd-msg__action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--c-text);
}

.sd-msg__quote {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 420px;
  padding: 6px 10px 6px 11px;
  border: 0;
  border-left: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px 8px 8px 4px;
  background: rgba(255, 255, 255, 0.07);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease;
}

.sd-msg__quote:hover {
  background: rgba(255, 255, 255, 0.14);
}

.sd-msg__quote-nick {
  font-size: 11px;
  font-weight: 650;
  color: var(--c-accent);
}

.sd-msg__quote-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--c-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-msg.is-flash .sd-msg__text {
  animation: sd-msg-flash 1.2s ease;
}

@keyframes sd-msg-flash {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
  30% {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35);
  }
}

/* Reply bar above the input. */
.sd-chat__reply {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 18px;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  background: rgba(255, 255, 255, 0.08);
}

.sd-chat__reply.is-hidden {
  display: none;
}

.sd-chat__reply-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  flex: 1;
}

.sd-chat__reply-nick {
  font-size: 11px;
  font-weight: 650;
  color: var(--c-accent);
}

.sd-chat__reply-quote {
  font-size: 12px;
  color: var(--c-text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-chat__reply-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--c-text-dim);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.sd-chat__reply-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--c-text);
}

/* @-suggestions float above the composer. */
.sd-chat__mentions {
  position: absolute;
  left: 18px;
  right: 74px;
  bottom: calc(100% - 6px);
  display: flex;
  flex-direction: column;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(12, 14, 18, 0.92);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: 0 22px 48px -22px rgba(0, 0, 0, 0.95);
  z-index: 5;
}

.sd-chat__mentions.is-hidden {
  display: none;
}

.sd-chat__mention {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--c-text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s ease;
}

.sd-chat__mention:hover,
.sd-chat__mention:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  outline: none;
}

.sd-chat__mention-ava {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.16);
  color: var(--c-accent);
  font-size: 10.5px;
  font-weight: 700;
}

.sd-chat__mention-ava img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sd-chat__mention-nick {
  font-weight: 550;
}

.sd-chat__compose {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.sd-chat__input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  max-height: 132px;
  padding: 11px 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--c-text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  outline: none;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.sd-chat__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 11px;
  background: var(--c-accent);
  color: var(--c-accent-ink, #fff);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sd-chat__send:hover {
  background: var(--c-accent-hover, #e6e6e6);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(255, 255, 255, 0.35);
}

.sd-chat__send:disabled {
  opacity: 0.55;
  cursor: default;
  transform: none;
  box-shadow: none;
}

/* ---------- attachments, voice, coords, party ---------- */

.sd-chat__tools {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding-bottom: 3px;
}

.sd-chat__tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--c-muted, rgba(255, 255, 255, 0.62));
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.sd-chat__tool:hover {
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.18);
}

.sd-chat__tool.is-recording {
  color: #fff;
  background: #d9534f;
  border-color: #d9534f;
  animation: sd-rec 1.2s ease-in-out infinite;
}

@keyframes sd-rec {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.sd-msg__media {
  display: block;
  width: auto;
  max-width: min(360px, 100%);
  max-height: 320px;
  margin-top: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: #000;
  object-fit: contain;
}

.sd-msg__voice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.sd-msg__voice audio {
  height: 34px;
  max-width: 260px;
}

.sd-msg__voice-len {
  font-size: 11px;
  color: var(--c-muted, rgba(255, 255, 255, 0.55));
  font-variant-numeric: tabular-nums;
}

.sd-msg__coords {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  cursor: default;
}

.sd-msg__party {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
}

.sd-msg__party-code {
  font-weight: 600;
  letter-spacing: 0.05em;
}

.sd-chat__party {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sd-chat__party.is-hidden {
  display: none;
}

.sd-chat__party .sd-chat__group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sd-chat__party-code {
  padding: 2px 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.sd-chat__party-member {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 9px;
  font-size: 12.5px;
}

.sd-chat__party-member:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sd-chat__party-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #8a8a8a;
}

.sd-chat__party-dot.is-online { background: #4ade80; }
.sd-chat__party-dot.is-idle { background: #fbbf24; }
.sd-chat__party-dot.is-dnd { background: #f87171; }

.sd-chat__party-nick {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-chat__party-crown {
  color: var(--c-accent);
  font-size: 11px;
}

.sd-chat__coords-form {
  position: fixed;
  left: 50%;
  bottom: 104px;
  z-index: 420;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(340px, calc(100vw - 32px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(12, 12, 12, 0.96);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.sd-chat__coords-title {
  font-size: 13px;
  font-weight: 600;
}

.sd-chat__coords-row {
  display: flex;
  gap: 8px;
}

.sd-chat__coords-field {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  color: var(--c-muted, rgba(255, 255, 255, 0.55));
}

.sd-chat__coords-field .sd-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-text);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}

.sd-chat__coords-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- online list ---------- */

.sd-online {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 9px;
  font-size: 12.5px;
  transition: background 0.18s ease;
}

.sd-online:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sd-online__nick {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--c-text);
  font-weight: 550;
}

.sd-chat__muted {
  padding: 7px 9px;
  font-size: 11.5px;
  color: var(--c-text-dim);
}

/* ---------- presence dot ---------- */

.sd-ava {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.sd-ava.is-on {
  background: #3ddc84;
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.16);
}

/* ---------- friends ---------- */

.sd-friends-wrap {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.sd-friends__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.sd-friends__add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sd-friends__section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sd-friends__label {
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.sd-friends__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.sd-friend {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 15px;
  background: rgba(12, 14, 18, 0.55);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.36);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sd-friend:hover {
  border-color: rgba(255, 255, 255, 0.35);
  transform: translateY(-2px);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.14);
}

.sd-friend__ava {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  overflow: hidden;
}

.sd-friend__avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sd-friend__ava .sd-ava {
  position: absolute;
  right: -2px;
  bottom: -2px;
  border: 2px solid #07080b;
}

.sd-friend__initial {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-accent);
}

.sd-friend__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.sd-friend__name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text);
}

.sd-friend__meta {
  font-size: 11.5px;
  color: var(--c-text-dim);
}

.sd-friend__actions {
  display: inline-flex;
  gap: 6px;
  flex-shrink: 0;
}

@media (max-width: 1180px) {
  .sd-chat {
    grid-template-columns: 170px minmax(0, 1fr);
  }
}


/* Chat and friends take the full cabinet width. */
.sd-content.is-wide {
  max-width: none;
}

.sd-content.is-wide > * {
  width: 100%;
}

/* Message bubbles grow with the text but never into a single letter column. */
.sd-msg__body {
  flex: 1 1 auto;
  min-width: 0;
}

.sd-msg__text {
  min-width: 92px;
  width: auto;
  max-width: min(58ch, 100%);
  font-size: 13.5px;
}

.sd-msg.is-mine .sd-msg__body {
  flex: 0 1 auto;
}


/* Compose field: the site's global field styles are more specific, so pin the
   chat input down here. */
.sd-chat .sd-chat__input,
.sd-chat .sd-chat__input:focus {
  flex: 1 1 auto;
  width: auto;
  max-width: none;
  height: 42px;
  padding: 0 15px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--c-text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.sd-chat .sd-chat__input:focus {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.12);
}

.sd-chat .sd-chat__input::placeholder {
  color: var(--c-text-dim);
}

/* --------------------------- custom select ------------------------------- */

.sd-select {
  position: relative;
  width: 100%;
}

.sd-select__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid var(--c-white-12);
  border-radius: var(--r-control);
  background: var(--c-white-4);
  color: var(--c-white);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease-soft), background var(--dur) var(--ease-soft);
}

.sd-select__btn:hover {
  border-color: var(--c-accent-48);
  background: var(--c-accent-6);
}

.sd-select__btn .sd-i {
  color: var(--c-white-48);
  transition: transform 0.2s var(--ease-soft);
}

.sd-select.is-open .sd-select__btn {
  border-color: var(--c-accent-48);
  background: var(--c-accent-6);
}

.sd-select.is-open .sd-select__btn .sd-i {
  transform: rotate(180deg);
}

.sd-select.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.sd-select__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  gap: 2px;
  max-height: 240px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--c-accent-24);
  border-radius: var(--r-control);
  background: rgba(8, 10, 14, 0.97);
  backdrop-filter: blur(28px) saturate(1.3);
  -webkit-backdrop-filter: blur(28px) saturate(1.3);
  box-shadow: 0 22px 54px -18px rgba(0, 0, 0, 0.95), 0 0 0 1px rgba(255, 255, 255, 0.08);
  animation: sd-rise 0.18s var(--ease-smooth) both;
}

.sd-select.is-open .sd-select__menu {
  display: flex;
}

.sd-select__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--c-white-72);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease;
}

.sd-select__option:hover {
  background: var(--c-accent-12);
  color: var(--c-white);
}

.sd-select__option.is-active {
  background: var(--c-accent-12);
  color: var(--c-accent);
}

.sd-select__tick {
  opacity: 0;
  color: var(--c-accent);
}

.sd-select__option.is-active .sd-select__tick {
  opacity: 1;
}

/* ------------------------------- responsive ------------------------------ */

@media (max-width: 720px) {
  .sd-chat {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    height: auto;
  }

  .sd-chat__side {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    overflow: visible;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sd-chat__group {
    width: 100%;
    padding: 4px 4px 2px;
  }

  .sd-chat__chan {
    width: auto;
    padding: 8px 12px;
  }

  .sd-chat__main {
    min-height: 420px;
  }

  .sd-chat__messages {
    min-height: 320px;
    padding: 16px 14px;
  }

  .sd-chat__compose {
    padding: 12px;
  }

  /* Actions stay visible on touch: there is no hover to reveal them. */
  .sd-msg__action {
    opacity: 0.7;
  }

  .sd-chat__reply {
    margin: 0 12px;
  }

  .sd-chat__mentions {
    left: 12px;
    right: 66px;
  }

  .sd-friends__head {
    align-items: flex-start;
  }

  .sd-friends__add {
    width: 100%;
  }

  .sd-friends__add .sd-input {
    flex: 1;
    max-width: none !important;
  }

  .sd-friends__list {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 420px) {
  .sd-msg__ava {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .sd-msg__text {
    max-width: 100%;
  }

  .sd-msg__quote {
    max-width: 100%;
  }

  .sd-chat__mentions {
    right: 12px;
  }
}
