/* Shell Pandora — sidebar shadcn-like + tokens Hydra (sem glass) */

:root {
  --shell-sidebar-w: 260px;
  --shell-sidebar-w-collapsed: 72px;
  --shell-topbar-h: 56px;
  --card: rgba(255, 255, 255, 0.04);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-fg: var(--c-text, #f0ece4);
}

.shell {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 40% at 100% 0%, rgba(0, 209, 255, 0.06), transparent 50%),
    var(--c-bg, #0c1018);
  color: var(--c-text, #f0ece4);
  font-family: var(--font, "Chakra Petch", "Segoe UI", system-ui, sans-serif);
}

/* ---- Sidebar ---- */
.shell-sidebar {
  position: sticky;
  top: 0;
  align-self: flex-start;
  z-index: 40;
  width: var(--shell-sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--card-border);
  background: linear-gradient(168deg, rgba(18, 24, 34, 0.98) 0%, rgba(12, 16, 24, 0.98) 100%);
  transition: width 0.2s ease;
  flex-shrink: 0;
}

.shell-sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #00d1ff;
}

.shell.is-collapsed .shell-sidebar {
  width: var(--shell-sidebar-w-collapsed);
}

.shell-sidebar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--shell-topbar-h);
  padding: 0 14px;
  border-bottom: 1px solid var(--card-border);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.shell-sidebar__mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #00d1ff;
  color: #0a0a0f;
  font-weight: 700;
  font-size: 1.05rem;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.shell-sidebar__brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  white-space: nowrap;
}

.shell-sidebar__brand-text strong {
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.shell-sidebar__brand-text span {
  font-size: 0.68rem;
  color: var(--c-muted, rgba(240, 236, 228, 0.62));
}

.shell.is-collapsed .shell-sidebar__brand-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.shell-sidebar__scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 12px 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 169, 176, 0.38) transparent;
}

.shell-nav__label {
  margin: 10px 8px 6px;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-muted, rgba(240, 236, 228, 0.5));
  white-space: nowrap;
}

.shell.is-collapsed .shell-nav__label {
  display: none;
}

.shell-nav__label::after {
  content: none;
}

.shell-nav__item,
.shell-nav__group-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  background: transparent;
  color: var(--c-muted, rgba(240, 236, 228, 0.7));
  text-decoration: none;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.shell-nav__item:hover,
.shell-nav__group-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--c-text, #f0ece4);
}

.shell-nav__item.is-active {
  background: rgba(0, 209, 255, 0.1);
  border-color: transparent;
  color: #00d1ff;
  box-shadow: inset 3px 0 0 #00d1ff;
}

.shell-nav__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  opacity: 0.9;
}

.shell-nav__icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell-nav__text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-nav__chevron {
  width: 14px;
  height: 14px;
  opacity: 0.6;
  transition: transform 0.15s;
  flex-shrink: 0;
}

.shell-nav__group.is-open > .shell-nav__group-btn .shell-nav__chevron {
  transform: rotate(180deg);
}

.shell.is-collapsed .shell-nav__text,
.shell.is-collapsed .shell-nav__chevron {
  display: none;
}

.shell.is-collapsed .shell-nav__item,
.shell.is-collapsed .shell-nav__group-btn {
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

.shell-nav__sub {
  display: none;
  flex-direction: column;
  gap: 2px;
  padding: 2px 0 6px 12px;
  margin-left: 18px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.shell-nav__group.is-open > .shell-nav__sub {
  display: flex;
}

.shell.is-collapsed .shell-nav__sub {
  display: none !important;
}

.shell-nav__sub .shell-nav__item {
  font-size: 0.82rem;
  padding: 7px 10px;
  color: var(--c-muted);
}

.shell-nav__sub .shell-nav__item.is-active {
  color: #00d1ff;
  box-shadow: inset 3px 0 0 #00d1ff;
}

.shell-nav__item.hidden,
.shell-nav__group.hidden {
  display: none !important;
}

.shell-sidebar__foot {
  border-top: 1px solid var(--card-border);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.shell-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
  background: var(--card);
  min-height: 44px;
}

.shell-user__avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(0, 209, 255, 0.2);
  border: 1px solid rgba(0, 209, 255, 0.4);
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #00d1ff;
  flex-shrink: 0;
  background-size: cover;
  background-position: center;
}

.shell-user__avatar--img {
  border-color: rgba(255, 255, 255, 0.18);
  color: transparent;
}

.shell-user__meta {
  min-width: 0;
  flex: 1;
}

.shell-user__name {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-user__logout {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.shell-user__logout:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--c-text);
}

.shell-user__alerts {
  position: relative;
  flex-shrink: 0;
}

.shell-user__notif {
  position: relative;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
}

.shell-user__notif:hover,
.shell-user__notif[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: var(--c-text);
}

.shell-user__notif.hidden {
  display: none !important;
}

.shell-notif-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 14px;
  height: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: #00d1ff;
  color: #0c1018;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
}

.shell-notif-badge.hidden {
  display: none !important;
}

.shell-notifs-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: min(280px, 72vw);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  border-radius: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(168deg, rgba(18, 24, 34, 0.98), rgba(12, 16, 24, 0.98));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 40;
  overflow: hidden;
}

.shell-notifs-panel.hidden {
  display: none !important;
}

.shell-notifs-panel__head {
  flex-shrink: 0;
  padding: 10px 12px 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--c-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.shell-notifs-panel__list {
  overflow-y: auto;
  max-height: 240px;
  padding: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 169, 176, 0.38) transparent;
}

.shell-notifs-panel__empty {
  margin: 0;
  padding: 12px;
  color: var(--c-muted);
  font-size: 0.82rem;
}

.shell-notif-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--c-text);
  padding: 8px 10px;
  cursor: pointer;
}

.shell-notif-item strong {
  font-size: 0.82rem;
}

.shell-notif-item span {
  font-size: 0.75rem;
  color: var(--c-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.shell-notif-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.shell-notif-item.is-unread {
  border-left: 2px solid #00d1ff;
}

.shell.is-collapsed .shell-user__meta {
  display: none;
}

.shell.is-collapsed .shell-notifs-panel {
  left: auto;
  right: 0;
}

.shell.is-collapsed .shell-user {
  flex-direction: column;
  justify-content: center;
  padding: 6px;
  gap: 4px;
}

.shell.is-collapsed .shell-user__logout {
  display: grid;
}

.shell-sidebar__tools {
  display: flex;
  gap: 6px;
}

.shell.is-collapsed .shell-sidebar__tools {
  flex-direction: column;
}

.shell-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--c-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
}

.shell-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.shell-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell-icon-btn--primary {
  background: rgba(0, 209, 255, 0.16);
  border-color: rgba(0, 209, 255, 0.45);
  color: #00d1ff;
}

.shell-icon-btn--primary:hover {
  background: rgba(0, 209, 255, 0.28);
}

.shell.is-collapsed .shell-icon-btn span {
  display: none;
}

/* ---- Main column ---- */
.shell-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--shell-topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--card-border);
  background: rgba(12, 16, 24, 0.96);
}

.shell-topbar__titles {
  min-width: 0;
  flex: 1;
}

.shell-topbar__titles h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
}

.shell-topbar__titles p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--c-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.shell-topbar .status {
  margin: 0;
  max-width: 280px;
  font-size: 0.78rem;
  color: var(--c-muted);
  text-align: right;
}

.shell-topbar .status--error {
  color: var(--c-danger, #ff6b8a);
}

.shell-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.shell-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.shell--show-online .shell-workspace {
  grid-template-columns: minmax(0, 1fr) 230px;
}

.shell-online-panel {
  display: none;
  min-width: 0;
  overflow-y: auto;
  padding: 14px 12px;
  border-left: 1px solid var(--card-border);
  background: rgba(0, 0, 0, 0.16);
}

.shell--show-online .shell-online-panel {
  display: block;
}

.shell-online-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.shell-online-panel__head h2 {
  margin: 0;
  font-size: 0.92rem;
  flex: 1 1 auto;
  min-width: 0;
}

.shell-online-panel__count {
  min-width: 22px;
  padding: 2px 7px;
  border: 1px solid rgba(0, 209, 255, 0.45);
  border-radius: 999px;
  color: var(--c-primary, #00d1ff);
  font-size: 0.72rem;
  text-align: center;
}

.shell-online-panel__close,
.shell-online-btn,
.shell-online-backdrop {
  display: none;
}

.shell-online-panel__hint {
  margin: 0 0 10px;
  color: var(--c-muted);
  font-size: 0.7rem;
  line-height: 1.35;
}

.shell-online-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.shell-online-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
}

.shell-online-user__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3dd68c;
  box-shadow: 0 0 7px rgba(61, 214, 140, 0.6);
}

.shell-online-user__info {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.shell-online-user__info--chatable {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.shell-online-user__info--chatable:hover strong {
  color: #00d1ff;
}

.shell-online-user__info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 500;
}

.shell-online-user__info small,
.shell-online-user__room {
  color: var(--c-muted);
  font-size: 0.65rem;
}

.shell-online-user__room {
  max-width: 62px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

.shell-frame.is-active {
  z-index: 2;
  visibility: visible;
  pointer-events: auto;
}

.shell-frame.is-parked {
  z-index: 1;
  /* opacity (não visibility/display) — mantém WS/decoder vivos */
  opacity: 0;
  pointer-events: none;
}

.shell-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.shell-content--pad {
  padding: 20px 22px 32px;
}

.shell--host,
.shell--host .shell-main {
  height: 100vh;
  max-height: 100vh;
}

html:has([data-shell-host="1"]),
html:has([data-shell-host="1"]) body {
  height: 100%;
  overflow: hidden;
}

.shell-room-badge {
  appearance: none;
  border: 1px solid rgba(0, 209, 255, 0.45);
  background: rgba(0, 209, 255, 0.14);
  color: #00d1ff;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-room-badge:hover {
  background: rgba(0, 209, 255, 0.26);
}

.shell-room-badge.hidden {
  display: none !important;
}

/* Página dentro do iframe do host — sem chrome duplicado */
html.is-embed .shell-sidebar,
html.is-embed .shell-backdrop {
  display: none !important;
}

html.is-embed .shell-menu-btn {
  display: none !important;
}

html.is-embed .shell-topbar__titles {
  display: none;
}

/* Mantém topbar só quando há status/ações (ex.: salas) */
html.is-embed .shell-topbar:not(:has(.shell-topbar__actions)) {
  display: none !important;
}

html.is-embed .shell-topbar:has(.shell-topbar__actions) {
  display: flex !important;
  position: sticky;
  top: 0;
  z-index: 5;
  justify-content: flex-end;
  height: auto;
  min-height: 40px;
  padding: 8px 14px;
}

html.is-embed .shell,
html.is-embed .shell-main {
  display: block;
  min-height: 100vh;
  height: 100%;
}

html.is-embed .shell-content,
html.is-embed .shell-content--pad {
  min-height: calc(100vh - 48px);
}

html.is-embed body {
  background: var(--c-bg, #0c1018);
}

/* ---- Sheet lateral (admin, tickets, etc.) ---- */
.hydra-sheet {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
}

.hydra-sheet.hidden {
  display: none !important;
}

.hydra-sheet__backdrop {
  appearance: none;
  border: 0;
  padding: 0;
  flex: 1;
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.hydra-sheet__panel {
  width: min(420px, 100vw);
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  background: linear-gradient(168deg, rgba(18, 24, 34, 0.98), rgba(12, 16, 24, 0.99));
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.35);
}

.hydra-sheet__panel--wide {
  width: min(520px, 100vw);
}

.hydra-sheet__accent {
  height: 3px;
  background: #00d1ff;
  flex-shrink: 0;
}

.hydra-sheet__head {
  position: relative;
  padding: 18px 20px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.hydra-sheet__eyebrow {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #00d1ff;
  margin-bottom: 4px;
}

.hydra-sheet__head h2 {
  margin: 0;
  font-size: 1.15rem;
  padding-right: 36px;
}

.hydra-sheet__sub {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--c-muted);
  word-break: break-all;
}

.hydra-sheet__close {
  position: absolute;
  top: 14px;
  right: 14px;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}

.hydra-sheet__close:hover {
  color: var(--c-text);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 0.35rem;
}

.hydra-sheet__body {
  flex: 1;
  overflow: auto;
  padding: 16px 20px 24px;
  min-height: 0;
}

.hydra-sheet__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.shell-chat-modal {
  position: fixed;
  inset: auto 18px 68px auto;
  z-index: 80;
  display: block;
  width: 380px;
  height: 520px;
  padding: 0;
  pointer-events: none;
}

.shell-chat-modal .hydra-sheet__backdrop {
  display: none;
}

.shell-chat-modal .hydra-sheet__panel {
  position: relative;
  width: 100%;
  height: 100%;
  max-height: 100%;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.65rem;
  box-shadow: -8px 12px 36px rgba(0, 0, 0, 0.45);
}

.shell-chat-modal .hydra-sheet__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 16px 10px;
}

.shell-chat-modal .hydra-sheet__eyebrow {
  display: none;
}

.shell-chat-modal .hydra-sheet__head h2 {
  min-width: 0;
  flex: 1;
  font-size: 1rem;
  padding-right: 28px;
}

.shell-chat-modal .hydra-sheet__sub {
  display: none;
}

.shell-chat-modal .hydra-sheet__close {
  top: 10px;
  right: 10px;
  padding: 3px 6px;
  font-size: 1.15rem;
}

.shell-chat__head-back {
  flex: 0 0 auto;
  align-self: auto;
  padding: 0 4px;
  background: transparent;
  font-size: 1.45rem;
  line-height: 1;
}

.shell-chat__head-back.hidden {
  display: none !important;
}

.shell-chat-modal .hydra-sheet__head .shell-chat__member-tools {
  flex: 0 0 auto;
  margin-right: 28px;
}

.shell-chat-modal .hydra-sheet__head .shell-chat__create-group {
  flex: 0 0 auto;
  margin-right: 28px;
}

.shell-chat-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  appearance: none;
  border: 1px solid rgba(0, 209, 255, 0.45);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(0, 209, 255, 0.14);
  color: #00d1ff;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}

.shell--show-online .shell-chat-btn {
  display: inline-flex;
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 81;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.shell-chat-btn:hover {
  background: rgba(0, 209, 255, 0.28);
}

.shell-chat-btn.hidden,
.shell-chat-toast.hidden,
.shell-chat__group-tools.hidden,
.shell-chat__member-tools.hidden,
.shell-chat__member-list.hidden {
  display: none !important;
}

.shell-chat-badge {
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: #ff6685;
  color: #0c1018;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
}

.shell-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shell-chat__toolbar {
  display: flex;
  justify-content: flex-end;
}

.shell-chat__create-group {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
}

.shell-chat__new {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
}

.shell-chat__new-row,
.shell-chat__group-tools,
.shell-chat__member-tools,
.shell-chat__form {
  display: flex;
  gap: 7px;
}

.shell-chat__conversation-tools {
  justify-content: flex-end;
  margin-bottom: 8px;
}

.shell-chat__conversation-tools select {
  flex: 1;
  max-width: none;
}

.shell-chat select,
.shell-chat input {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.28);
  color: var(--c-text);
  font: inherit;
  font-size: 0.75rem;
  padding: 8px 9px;
}

.shell-chat select:focus,
.shell-chat input:focus {
  outline: none;
  border-color: rgba(0, 209, 255, 0.7);
}

.shell-chat__new-row select,
.shell-chat__group-tools input,
.shell-chat__form input {
  flex: 1;
}

.shell-chat__group-tools {
  flex-wrap: wrap;
}

.shell-chat__group-tools select {
  width: 100%;
}

.shell-chat__layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 12px;
}

.shell-chat-modal .shell-chat__layout {
  grid-template-columns: 1fr;
  gap: 8px;
}

.shell-chat-modal .shell-chat__conversations {
  height: 100%;
  max-height: none;
  overflow-y: auto;
  border-right: 0;
  border-bottom: 0;
  padding: 0 0 8px;
}

.shell-chat__conversations {
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--card-border);
  padding-right: 10px;
}

.shell-chat__label {
  margin: 0 0 7px;
  color: var(--c-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.shell-chat__conversation-list,
.shell-chat__member-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.shell-chat__conversation-list button {
  position: relative;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--c-text);
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.shell-chat__conversation-row {
  display: flex;
  align-items: stretch;
  gap: 5px;
}

.shell-chat__conversation-row .shell-chat__conversation-open {
  flex: 1;
  width: auto;
  min-width: 0;
}

.shell-chat__delete {
  flex: 0 0 34px;
  border: 1px solid transparent;
  border-radius: 0.4rem;
  background: rgba(255, 255, 255, 0.03);
  color: var(--c-muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.shell-chat__delete:hover {
  border-color: rgba(255, 102, 133, 0.5);
  background: rgba(255, 102, 133, 0.14);
  color: #ff6685;
}

.shell-chat__delete-confirm {
  border-color: rgba(255, 102, 133, 0.5);
  background: rgba(255, 102, 133, 0.14);
  color: #ff9eb1;
}

.shell-chat__delete-confirm:hover {
  background: rgba(255, 102, 133, 0.26);
  color: #ffdce3;
}

.shell-chat__conversation-list .shell-chat__conversation-open:hover,
.shell-chat__conversation-list .shell-chat__conversation-open.is-active {
  border-color: rgba(0, 209, 255, 0.35);
  background: rgba(0, 209, 255, 0.12);
}

.shell-chat__conversation-list small {
  display: block;
  overflow: hidden;
  margin-top: 3px;
  color: var(--c-muted);
  font-size: 0.64rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-chat__unread {
  position: absolute;
  top: 7px;
  right: 7px;
  min-width: 17px;
  padding: 2px 5px;
  border-radius: 999px;
  background: #ff6685;
  color: #0c1018;
  font-size: 0.62rem;
  line-height: 1.1;
  text-align: center;
}

.shell-chat__conversation {
  min-width: 0;
  min-height: 0;
  display: none;
  flex-direction: column;
}

.shell-chat.is-conversation .shell-chat__conversations {
  display: none;
}

.shell-chat.is-conversation .shell-chat__conversation {
  display: flex;
}

.shell-chat__back {
  align-self: flex-start;
  border: 0;
  padding: 4px 7px;
  border-radius: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  color: var(--c-muted);
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.shell-chat__back:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--c-text);
}

.shell-chat__conversation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.shell-chat__conversation-head h3 {
  margin: 0;
  overflow: hidden;
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shell-chat__member-tools select {
  max-width: 130px;
}

.shell-chat__conversation-tools.shell-chat__member-tools select {
  max-width: none;
}

.shell-chat__member-list {
  flex-direction: row;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.shell-chat__member-list li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--c-muted);
  font-size: 0.66rem;
}

.shell-chat__member-list button {
  border: 0;
  background: transparent;
  color: var(--c-muted);
  cursor: pointer;
}

.shell-chat__messages {
  flex: 1;
  min-height: 160px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 1px solid var(--card-border);
  border-radius: 0.4rem;
  background: rgba(0, 0, 0, 0.18);
}

.shell-chat__message {
  max-width: 88%;
  min-width: 140px;
  min-height: 72px;
  align-self: flex-start;
  padding: 11px 13px 9px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 2px solid rgba(0, 209, 255, 0.55);
  border-radius: 0.55rem 0.55rem 0.55rem 0.2rem;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.045));
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

.shell-chat__message.is-own {
  align-self: flex-end;
  border-color: rgba(0, 209, 255, 0.35);
  border-left: 1px solid rgba(0, 209, 255, 0.35);
  border-right: 2px solid #00d1ff;
  border-radius: 0.55rem 0.55rem 0.2rem 0.55rem;
  background: linear-gradient(145deg, rgba(0, 209, 255, 0.2), rgba(0, 124, 170, 0.12));
}

.shell-chat__message strong,
.shell-chat__message small {
  display: block;
}

.shell-chat__message strong {
  margin-bottom: 3px;
  color: #8beaff;
  font-size: 0.68rem;
}

.shell-chat__message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.76rem;
  line-height: 1.35;
}

.shell-chat__message small {
  margin-top: 4px;
  text-align: right;
  color: var(--c-muted);
  font-size: 0.6rem;
}

.shell-chat-toast {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 90;
  max-width: min(280px, calc(100vw - 36px));
  padding: 10px 13px;
  border: 1px solid rgba(0, 209, 255, 0.48);
  border-radius: 0.5rem;
  background: linear-gradient(145deg, #121c28, #0c111a);
  color: var(--c-text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font: inherit;
  font-size: 0.75rem;
  text-align: left;
  cursor: pointer;
}

.shell-chat-toast:hover {
  border-color: #00d1ff;
  background: rgba(0, 209, 255, 0.16);
}

.shell-chat__form {
  margin-top: 8px;
}

.shell-chat__status,
.shell-chat__empty {
  margin: 6px 0 0;
  color: var(--c-muted);
  font-size: 0.7rem;
}

.shell-chat__status:empty {
  display: none;
}

.shell-chat__empty {
  text-align: center;
}

/* ---- Cards (shadcn API mental) ---- */
.hydra-card {
  position: relative;
  border-radius: 0.5rem;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--card-fg);
  overflow: hidden;
}

.hydra-card__accent {
  height: 3px;
  background: #00d1ff;
}

.hydra-card__header {
  padding: 14px 16px 0;
}

.hydra-card__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.hydra-card__desc {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--c-muted);
  line-height: 1.45;
}

.hydra-card__body {
  padding: 14px 16px 16px;
}

.hydra-card__footer {
  padding: 0 16px 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.hydra-separator {
  height: 1px;
  background: var(--card-border);
  border: 0;
  margin: 12px 0;
}

/* Mobile overlay */
.shell-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.55);
}

.shell-menu-btn {
  display: none;
}

.shell-menu-fab {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 45;
}

@media (max-width: 960px) {
  .shell-menu-btn {
    display: inline-flex;
  }

  .shell-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    width: min(280px, 86vw) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s ease;
  }

  .shell.is-collapsed .shell-sidebar {
    width: min(280px, 86vw) !important;
  }

  .shell.is-collapsed .shell-sidebar__brand-text,
  .shell.is-collapsed .shell-nav__text,
  .shell.is-collapsed .shell-nav__chevron,
  .shell.is-collapsed .shell-user__meta,
  .shell.is-collapsed .shell-icon-btn span {
    display: initial;
    opacity: 1;
    width: auto;
  }

  .shell.is-collapsed .shell-nav__item,
  .shell.is-collapsed .shell-nav__group-btn {
    justify-content: flex-start;
    padding: 9px 10px;
  }

  .shell.is-nav-open .shell-sidebar {
    transform: translateX(0);
  }

  .shell.is-nav-open .shell-backdrop {
    display: block;
  }

  .shell-content--pad {
    padding: 16px;
  }

  .shell--show-online .shell-workspace {
    grid-template-columns: 1fr;
  }

  .shell--show-online .shell-online-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 999px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--c-text, #f0ece4);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
  }

  .shell-online-btn__count {
    min-width: 18px;
    padding: 1px 5px;
    border-radius: 999px;
    border: 1px solid rgba(0, 209, 255, 0.45);
    color: #00d1ff;
    font-size: 0.7rem;
    text-align: center;
  }

  .shell--show-online .shell-online-panel {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(320px, 88vw);
    max-height: none;
    z-index: 70;
    padding: 16px 14px;
    border-left: 1px solid var(--card-border);
    border-top: 0;
    background: linear-gradient(168deg, rgba(18, 24, 34, 0.98), rgba(12, 16, 24, 0.98));
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
    transform: translateX(105%);
    transition: transform 0.2s ease;
  }

  .shell--online-open .shell-online-panel {
    transform: translateX(0);
  }

  .shell--online-open .shell-online-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 65;
    appearance: none;
    border: 0;
    margin: 0;
    padding: 0;
    background: rgba(0, 0, 0, 0.55);
    cursor: pointer;
  }

  .shell-online-panel__close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius, 0.5rem);
    background: rgba(255, 255, 255, 0.04);
    color: var(--c-muted, rgba(240, 236, 228, 0.62));
    font: inherit;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
  }

  .shell-online-panel__close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--c-text, #f0ece4);
  }

  .shell-chat__layout {
    grid-template-columns: 1fr;
  }

  .shell-chat__conversations {
    max-height: 150px;
    border-right: 0;
    border-bottom: 1px solid var(--card-border);
    padding: 0 0 10px;
  }

  .shell-chat-modal {
    right: 10px;
    bottom: 62px;
    width: min(380px, calc(100vw - 20px));
    height: min(520px, calc(100vh - 76px));
  }

  .shell--show-online .shell-chat-btn {
    right: 10px;
    bottom: 10px;
  }
}
