:root {
  color-scheme: light;
  --ink: #18211d;
  --muted: #65746d;
  --line: #d8ded7;
  --panel: #fffdf7;
  --panel-strong: #f2eadb;
  --field: #ffffff;
  --accent: #1e6f5c;
  --accent-dark: #154c41;
  --gold: #d9b75f;
  --danger: #9d2f2f;
  --shadow: 0 18px 48px rgba(24, 33, 29, 0.14);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    linear-gradient(120deg, rgba(30, 111, 92, 0.08), transparent 42%),
    linear-gradient(180deg, #f8f4eb, #e8eee9);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.app-shell {
  min-height: 100vh;
}

.boot-screen,
.auth-screen,
.lock-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-screen {
  gap: 16px;
  align-content: center;
  color: var(--muted);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #15251f;
  position: relative;
  box-shadow: var(--shadow);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: 14px 11px 18px;
  border-radius: 8px;
  background: var(--gold);
}

.brand-mark::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 10px;
  left: 24px;
  bottom: 11px;
  background: var(--gold);
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.auth-card,
.lock-card {
  width: min(100%, 440px);
  background: rgba(255, 253, 247, 0.94);
  border: 1px solid rgba(216, 222, 215, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.auth-head {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.auth-head h1,
.lock-card h1 {
  font-size: 23px;
  line-height: 1.15;
  margin: 0;
  letter-spacing: 0;
}

.auth-head p,
.lock-card p,
.muted {
  color: var(--muted);
  margin: 5px 0 0;
  line-height: 1.45;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--panel-strong);
  margin-bottom: 18px;
}

.tab {
  min-height: 38px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 3px 12px rgba(24, 33, 29, 0.08);
}

.form {
  display: grid;
  gap: 12px;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  border-radius: var(--radius);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
}

.textarea {
  resize: none;
  min-height: 52px;
}

.input:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 111, 92, 0.16);
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  background: var(--panel-strong);
  color: var(--ink);
}

.ghost {
  background: transparent;
  color: var(--muted);
}

.danger {
  background: rgba(157, 47, 47, 0.11);
  color: var(--danger);
}

.notice {
  border: 1px solid rgba(217, 183, 95, 0.6);
  background: rgba(217, 183, 95, 0.16);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: #5f4a12;
  line-height: 1.4;
}

.error {
  border: 1px solid rgba(157, 47, 47, 0.28);
  background: rgba(157, 47, 47, 0.08);
  color: var(--danger);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.workspace {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 338px minmax(0, 1fr);
  background: #ece7dd;
  position: relative;
  overflow: hidden;
}

.workspace-scrim {
  position: fixed;
  inset: 0;
  z-index: 18;
  display: none;
  background: rgba(21, 37, 31, 0.24);
  backdrop-filter: blur(2px);
}

.workspace.sidebar-open .workspace-scrim,
.workspace.details-open .workspace-scrim {
  display: block;
}

.sidebar,
.details {
  background: rgba(255, 253, 247, 0.94);
  border-color: var(--line);
  border-style: solid;
}

.sidebar {
  border-width: 0 1px 0 0;
  padding: 0;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 0;
}

.details {
  position: fixed;
  inset: 0 0 0 auto;
  z-index: 30;
  width: min(360px, 92vw);
  border-width: 0 0 0 1px;
  padding: 0;
  overflow: auto;
  box-shadow: -18px 0 44px rgba(24, 33, 29, 0.16);
  transform: translateX(104%);
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.workspace.details-open .details {
  transform: translateX(0);
}

.topline,
.chat-header,
.admin-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.app-topline {
  min-height: 72px;
  padding: 14px 16px;
  background: #15251f;
  color: #f7f4ec;
}

.app-label {
  display: block;
  color: rgba(247, 244, 236, 0.62);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile {
  min-width: 0;
}

.profile strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-pill {
  min-height: 40px;
  border-radius: 8px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-weight: 900;
  white-space: nowrap;
}

.admin-pill:hover {
  background: rgba(30, 111, 92, 0.2);
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font-weight: 900;
}

.chat-header .icon-button {
  background: rgba(21, 37, 31, 0.07);
  color: var(--ink);
}

.icon-button:hover {
  background: rgba(30, 111, 92, 0.18);
}

.icon {
  position: relative;
  width: 20px;
  height: 20px;
  display: block;
  transition: transform 140ms ease;
}

.icon-lock::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 8px;
  width: 12px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-lock::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 8px;
  height: 9px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}

.icon-bell::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 3px;
  width: 10px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 8px 8px 4px 4px;
}

.icon-bell::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 16px;
  width: 6px;
  height: 2px;
  background: currentColor;
  border-radius: 4px;
}

.icon-refresh::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 999px;
}

.icon-refresh::after {
  content: "";
  position: absolute;
  right: 3px;
  top: 4px;
  width: 0;
  height: 0;
  border-left: 6px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.icon-menu::before,
.icon-menu::after {
  content: "";
  position: absolute;
  left: 3px;
  width: 14px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.icon-menu::before {
  top: 6px;
  box-shadow: 0 4px 0 currentColor;
}

.icon-menu::after {
  top: 14px;
}

.icon-plus::before,
.icon-plus::after {
  content: "";
  position: absolute;
  background: currentColor;
  border-radius: 999px;
}

.icon-plus::before {
  width: 14px;
  height: 2px;
  left: 3px;
  top: 9px;
}

.icon-plus::after {
  width: 2px;
  height: 14px;
  left: 9px;
  top: 3px;
}

.icon-send::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 4px;
  width: 14px;
  height: 12px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%, 18% 58%, 58% 50%, 18% 42%);
}

.icon-dots::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 6px 0 0 currentColor, 12px 0 0 currentColor;
}

.icon-info::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 999px;
}

.icon-info::after {
  content: "i";
  position: absolute;
  inset: 2px 0 0;
  text-align: center;
  font-size: 14px;
  font-weight: 900;
  line-height: 18px;
}

.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 9px;
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.icon-close::before {
  transform: rotate(45deg);
}

.icon-close::after {
  transform: rotate(-45deg);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #3caa6b;
}

.search {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.search .input {
  padding-left: 34px;
  min-height: 42px;
  background: #f1f4ef;
  border-color: transparent;
}

.search::before {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  left: 12px;
  top: 15px;
  border: 2px solid var(--muted);
  border-radius: 999px;
}

.search::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  left: 24px;
  top: 40px;
  background: var(--muted);
  transform: rotate(45deg);
  border-radius: 999px;
}

.conversation-list,
.user-list,
.audit-list {
  display: grid;
  gap: 0;
  align-content: start;
  overflow: auto;
}

.conversation-item,
.user-row,
.audit-row {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  border-radius: var(--radius);
  padding: 11px;
}

.conversation-item {
  display: flex;
  gap: 12px;
  text-align: left;
  color: inherit;
  border-width: 0 0 1px;
  border-radius: 0;
  background: transparent;
  padding: 13px 14px;
  width: 100%;
  align-items: center;
}

.conversation-item.active {
  border-color: var(--line);
  background: rgba(30, 111, 92, 0.12);
}

.conversation-item:hover {
  background: rgba(30, 111, 92, 0.07);
}

.avatar {
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: linear-gradient(145deg, #1e6f5c, #d9b75f);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.avatar.small {
  width: 42px;
  height: 42px;
}

.conversation-main {
  min-width: 0;
  flex: 1;
}

.conversation-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.conversation-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.conversation-preview small {
  flex: 1;
}

.conversation-preview em {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  display: inline-grid;
  place-items: center;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.conversation-main strong,
.user-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-main small,
.user-row small,
.audit-row small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background:
    linear-gradient(90deg, rgba(21, 37, 31, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(21, 37, 31, 0.035) 1px, transparent 1px),
    #efe8dc;
  background-size: 36px 36px;
}

.chat-header {
  min-height: 72px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.88);
  backdrop-filter: blur(18px);
}

.chat-identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.chat-identity span:last-child {
  min-width: 0;
}

.chat-identity strong,
.chat-identity small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-identity small {
  color: var(--muted);
  margin-top: 2px;
}

.mobile-menu {
  display: none;
}

.message-stream {
  overflow: auto;
  padding: 22px min(5vw, 58px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.empty-state {
  margin: auto;
  width: min(420px, 100%);
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.rich-empty {
  display: grid;
  gap: 8px;
  padding: 18px;
  background: rgba(255, 253, 247, 0.78);
  border: 1px solid rgba(216, 222, 215, 0.9);
  border-radius: 8px;
}

.rich-empty strong {
  color: var(--ink);
}

.message {
  max-width: min(640px, 76%);
  display: grid;
  gap: 3px;
}

.message.mine {
  align-self: flex-end;
}

.message.revoked {
  opacity: 0.82;
}

.bubble {
  border: 0;
  background: #fffdf7;
  border-radius: var(--radius);
  padding: 9px 11px 7px;
  box-shadow: 0 2px 6px rgba(24, 33, 29, 0.08);
  overflow: hidden;
  line-height: 1.45;
  overflow-wrap: anywhere;
  position: relative;
  animation: bubble-in 180ms ease both;
}

.mine .bubble {
  background: #d8f2d4;
}

.revoked-text {
  color: var(--muted);
  font-style: italic;
}

.message-meta {
  font-size: 12px;
  color: var(--muted);
  padding: 0 3px;
}

.bubble-time {
  float: right;
  margin: 4px 0 0 10px;
  color: rgba(101, 116, 109, 0.86);
  font-size: 11px;
  line-height: 1.2;
}

.day-separator {
  align-self: center;
  margin: 8px 0;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.78);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(24, 33, 29, 0.08);
}

.message-menu-toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(21, 37, 31, 0.06);
  color: var(--muted);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease;
}

.bubble:hover .message-menu-toggle,
.bubble:focus-within .message-menu-toggle {
  opacity: 1;
  transform: translateY(0);
}

.message-menu-toggle:hover {
  background: rgba(21, 37, 31, 0.12);
}

.message-actions {
  position: absolute;
  top: 34px;
  right: 6px;
  z-index: 3;
  min-width: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.98);
  box-shadow: 0 12px 28px rgba(24, 33, 29, 0.16);
  padding: 5px;
}

.message-actions button {
  width: 100%;
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 0 10px;
  text-align: left;
}

.message-actions button:hover {
  background: rgba(21, 37, 31, 0.08);
}

.media-preview {
  display: block;
  max-width: 100%;
  width: min(360px, 68vw);
  max-height: 420px;
  border-radius: 7px;
  object-fit: cover;
  background: #101916;
  margin-top: 6px;
}

video.media-preview,
audio.media-preview {
  object-fit: contain;
}

audio.media-preview {
  width: 280px;
  height: 42px;
}

.composer {
  border-top: 0;
  background: rgba(239, 232, 220, 0.88);
  padding: 12px 14px 14px;
  display: grid;
  gap: 8px;
}

.attach-wrap {
  position: relative;
}

.composer-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255, 253, 247, 0.9);
  color: var(--accent-dark);
  box-shadow: 0 1px 4px rgba(24, 33, 29, 0.08);
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.composer-icon.active {
  background: var(--accent);
  color: #fff;
}

.composer-icon.active .icon-plus {
  transform: rotate(45deg);
}

.attach-menu {
  position: absolute;
  left: 0;
  bottom: 52px;
  z-index: 4;
  width: 178px;
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.98);
  box-shadow: 0 18px 42px rgba(24, 33, 29, 0.18);
  padding: 6px;
  animation: menu-in 150ms ease both;
}

.attach-menu[hidden] {
  display: none;
}

.attach-item {
  position: relative;
  min-height: 40px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  text-align: left;
}

.attach-item:hover {
  background: rgba(30, 111, 92, 0.1);
}

.attach-item input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.attach-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(30, 111, 92, 0.12);
  color: var(--accent-dark);
  flex: 0 0 auto;
}

.icon-photo::before,
.icon-video::before,
.icon-mic::before {
  content: "";
  display: block;
}

.icon-photo::before {
  width: 14px;
  height: 11px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-video::before {
  width: 15px;
  height: 11px;
  background: currentColor;
  clip-path: polygon(0 0, 68% 0, 68% 32%, 100% 14%, 100% 86%, 68% 68%, 68% 100%, 0 100%);
}

.icon-mic::before {
  width: 9px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

.composer-main {
  display: grid;
  grid-template-columns: 44px minmax(92px, 118px) 1fr 48px;
  gap: 8px;
  align-items: end;
}

.ttl-control {
  min-width: 0;
}

.ttl-control select {
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(255, 253, 247, 0.9);
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 1px 4px rgba(24, 33, 29, 0.08);
}

.composer-main .textarea {
  min-height: 44px;
  max-height: 120px;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 1px 4px rgba(24, 33, 29, 0.08);
  resize: none;
  overflow-y: auto;
}

.send-button {
  width: 48px;
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 900;
  display: grid;
  place-items: center;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

.send-button:active {
  transform: scale(0.96);
}

.send-button:disabled {
  opacity: 0.82;
}

.send-spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.composer.sending .icon-send {
  display: none;
}

.composer.sending .send-spinner {
  display: block;
}

.pending-media {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(30, 111, 92, 0.22);
  background: rgba(255, 253, 247, 0.82);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.pending-media.active {
  display: flex;
}

.pending-media span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.security-list {
  display: grid;
  gap: 12px;
}

.security-list span {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 700;
}

.security-list span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(30, 111, 92, 0.1);
  flex: 0 0 auto;
}

.details-head {
  min-height: 66px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.9);
  position: sticky;
  top: 0;
  z-index: 1;
  backdrop-filter: blur(18px);
}

.details-head .icon-button {
  background: rgba(21, 37, 31, 0.06);
  color: var(--ink);
}

.profile-card {
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  padding: 28px 20px 24px;
  margin-bottom: 0;
  text-align: center;
}

.profile-avatar {
  width: 70px;
  height: 70px;
  margin: 0 auto 12px;
  border-radius: 18px;
  font-size: 21px;
}

.profile-card h2 {
  margin: 0;
  font-size: 20px;
}

.profile-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.detail-section {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.detail-section h2 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
  color: var(--muted);
}

.detail-row {
  display: grid;
  gap: 4px;
}

.detail-row span {
  color: var(--muted);
  font-size: 13px;
}

.detail-row strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}

.admin-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
}

.admin-panel {
  padding: 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.82);
}

.admin-content {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-content: start;
}

.panel {
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.74);
  border-radius: var(--radius);
  padding: 16px;
}

.panel h2 {
  font-size: 16px;
  margin: 0 0 12px;
}

.user-row {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  align-items: stretch;
}

.user-row > div:first-child {
  min-width: 0;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: stretch;
  max-width: 100%;
}

.inline-password {
  display: flex;
  gap: 8px;
  min-width: min(100%, 360px);
  flex: 1 1 360px;
}

.compact-input {
  min-height: 40px;
}

.user-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1 1 240px;
}

.admin-tools {
  display: grid;
  gap: 12px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-stat-grid span {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 253, 247, 0.72);
}

.admin-stat-grid strong {
  font-size: 20px;
}

.admin-stat-grid small {
  color: var(--muted);
  font-weight: 800;
}

.admin-tool-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.secret-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #15251f;
  color: #f7f4ec;
  border-radius: var(--radius);
  padding: 12px;
  overflow-wrap: anywhere;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: min(92vw, 420px);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  border-radius: 999px;
  background: rgba(21, 37, 31, 0.94);
  color: #fff;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 18px 42px rgba(24, 33, 29, 0.22);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .admin-content {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  body {
    overflow-x: hidden;
  }

  .workspace {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(86vw, 320px);
    transform: translateX(-104%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .workspace.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .chat {
    height: 100dvh;
    width: 100vw;
    overflow: hidden;
  }

  .chat-header,
  .message-stream,
  .composer {
    width: 100%;
    min-width: 0;
  }

  .chat-header {
    padding: 8px 12px;
    gap: 8px;
  }

  .chat-header .top-actions {
    flex-shrink: 0;
    gap: 6px;
  }

  .chat-header .js-lock {
    display: none;
  }

  .chat-identity {
    flex: 1;
    min-width: 0;
    gap: 9px;
  }

  .avatar.small {
    width: 40px;
    height: 40px;
  }

  .mobile-menu {
    display: inline-flex;
  }

  .message-stream {
    padding: 14px;
  }

  .message {
    max-width: min(88%, 330px);
  }

  .message.mine {
    margin-left: auto;
  }

  .message-menu-toggle {
    opacity: 1;
    transform: none;
  }

  .composer-main {
    grid-template-columns: 44px minmax(76px, 92px) 1fr 48px;
  }

  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .user-row {
    align-items: stretch;
    flex-direction: column;
  }

  .user-actions {
    justify-content: stretch;
  }

  .inline-password,
  .user-action-buttons {
    flex-direction: column;
    min-width: 100%;
  }

  .user-actions button,
  .inline-password .input {
    flex: 1 1 130px;
  }
}
