:root {
  --bg: #f3f6f8;
  --panel: #ffffff;
  --ink: #152027;
  --muted: #6b7c86;
  --line: #e4ebef;
  --accent: #0d9f93;
  --accent-dark: #0b857b;
  --accent-soft: #e6f7f5;
  --accent-bubble: #12b5a7;
  --danger: #c4493a;
  --shadow: 0 10px 30px rgba(21, 32, 39, 0.06);
  --radius: 18px;
  --sidebar-w: 340px;
  --info-w: 300px;
  --font: "Plus Jakarta Sans", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background:
    radial-gradient(ellipse at top left, #d9f3ef 0%, transparent 45%),
    radial-gradient(ellipse at bottom right, #e8eef5 0%, transparent 40%),
    var(--bg);
}

.hidden { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; border: 0; background: none; color: inherit; }
.muted { color: var(--muted); font-size: 0.85rem; }
.error { color: var(--danger); min-height: 1.2em; margin: 0.5rem 0 0; }

/* —— Auth —— */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.auth-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 2rem;
  box-shadow: var(--shadow);
}
.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  margin-bottom: 1rem;
}
.auth-card h1 { margin: 0 0 0.35rem; font-size: 1.6rem; }
.hint { margin: 0 0 1.25rem; color: var(--muted); }
.tabs { display: flex; gap: 0.4rem; margin-bottom: 1rem; background: var(--bg); padding: 0.3rem; border-radius: 999px; }
.tab {
  flex: 1;
  padding: 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
}
.tab.active { background: var(--accent); color: #fff; }
.auth-card label { display: grid; gap: 0.35rem; margin: 0.75rem 0; font-size: 0.9rem; font-weight: 500; }
.auth-card input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafb;
}
.btn-primary {
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost {
  padding: 0.65rem 1rem;
  border-radius: 12px;
  color: var(--muted);
  background: var(--bg);
}

/* —— Shell —— */
.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  max-width: 1400px;
  margin: 0 auto;
  overflow: hidden;
}
.app-shell.info-open {
  grid-template-columns: var(--sidebar-w) 1fr var(--info-w);
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.5rem;
}
.brand { font-weight: 700; font-size: 1.2rem; letter-spacing: -0.02em; }
.sidebar-actions { display: flex; gap: 0.25rem; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.icon-btn:hover:not(:disabled) { background: var(--bg); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.me-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0.4rem 1rem 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 14px;
  background: var(--accent-soft);
}
.me-chip-text { flex: 1; min-width: 0; display: grid; }
.me-chip-text strong { font-size: 0.92rem; }
.lock-pill { font-size: 0.85rem; }

.search-wrap {
  position: relative;
  margin: 0 1rem 0.75rem;
}
.search-wrap input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--bg);
}
.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1rem;
}

.filter-chips {
  display: flex;
  gap: 0.4rem;
  padding: 0 1rem 0.75rem;
}
.chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.chip.active { background: var(--accent); color: #fff; }

.new-menu {
  margin: 0 1rem 0.5rem;
  padding: 0.4rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.25rem;
}
.new-menu button {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  font-weight: 500;
}
.new-menu button:hover { background: var(--accent-soft); }

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0 0.5rem 1rem;
  overflow: auto;
  flex: 1;
}
.chat-list li button {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.65rem;
  border-radius: 14px;
  text-align: left;
}
.chat-list li button:hover { background: #f5faf9; }
.chat-list li button.active {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.chat-item-main { min-width: 0; }
.chat-item-main strong {
  display: block;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-main .preview {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-item-meta {
  font-size: 0.75rem;
  color: var(--muted);
  align-self: start;
  padding-top: 0.15rem;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.avatar-sm { width: 34px; height: 34px; font-size: 0.75rem; }
.avatar-lg { width: 72px; height: 72px; font-size: 1.3rem; margin: 0 auto 0.75rem; }

/* —— Chat pane —— */
.chat-pane {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  min-width: 0;
  min-height: 0;
  background: linear-gradient(180deg, #f7fafb 0%, #eef3f5 100%);
}
.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.chat-header-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.chat-header h2 {
  margin: 0;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-header-right { display: flex; gap: 0.25rem; align-items: center; }
.msg-search-wrap input {
  width: min(180px, 36vw);
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 0.85rem;
}
.reply-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.45rem;
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
}
.reply-bar-text { flex: 1; min-width: 0; display: grid; gap: 0.1rem; font-size: 0.85rem; }
.reply-bar-text span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.reply-quote {
  margin-bottom: 0.4rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  border-left: 3px solid rgba(13, 159, 147, 0.7);
  background: rgba(13, 159, 147, 0.1);
  font-size: 0.8rem;
}
.row.mine .reply-quote {
  background: rgba(255,255,255,0.18);
  border-left-color: rgba(255,255,255,0.7);
}
.msg-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
  opacity: 0.75;
}
.msg-actions button {
  font-size: 0.72rem;
  padding: 0.15rem 0.4rem;
  border-radius: 8px;
  background: rgba(0,0,0,0.05);
}
.row.mine .msg-actions button { background: rgba(255,255,255,0.18); color: #fff; }
.row.msg-hit { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 12px; }
.bubble.deleted {
  font-style: italic;
  opacity: 0.7;
}
.typing-dot::after {
  content: '';
  animation: typing 1.2s infinite;
}
@keyframes typing {
  0%, 100% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.messages {
  overflow: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.empty-chat {
  margin: auto;
  color: var(--muted);
  text-align: center;
}
.day-sep {
  align-self: center;
  margin: 0.5rem 0;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.8);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.row {
  display: flex;
  flex-direction: column;
  max-width: min(72%, 560px);
  align-self: flex-start;
}
.row.mine { align-self: flex-end; align-items: flex-end; }
.sender-name {
  font-size: 0.75rem;
  font-weight: 600;
  margin: 0 0.4rem 0.2rem;
  color: var(--accent-dark);
}
.bubble {
  padding: 0.7rem 0.9rem 0.45rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  box-shadow: 0 1px 2px rgba(21,32,39,0.04);
}
.row.mine .bubble {
  background: var(--accent-bubble);
  color: #fff;
  border-color: transparent;
  border-radius: 18px 18px 6px 18px;
}
.bubble-body { font-size: 0.95rem; line-height: 1.4; word-break: break-word; }
.bubble-foot {
  display: flex;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  opacity: 0.75;
}
.row.mine .bubble-foot { color: rgba(255,255,255,0.9); }

.media-wrap { display: grid; gap: 0.35rem; margin-bottom: 0.35rem; min-width: 120px; }
.media-preview {
  display: block;
  max-width: min(100%, 360px);
  max-height: 360px;
  width: auto;
  height: auto;
  border-radius: 12px;
  background: #0f1a15;
  cursor: zoom-in;
  object-fit: contain;
}
.row.mine .media-preview { background: rgba(0,0,0,0.15); }
video.media-preview { cursor: default; width: min(100%, 360px); }
.reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
}
.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--ink);
}
.row.mine .reaction-chip {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.35);
  color: #fff;
}
.reaction-chip.mine { outline: 2px solid var(--accent); }
.btn-add-react {
  opacity: 0.55;
  font-size: 0.85rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  border: 1px dashed var(--line);
}
.row.mine .btn-add-react { border-color: rgba(255,255,255,0.45); color: #fff; }
.react-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.35rem;
  margin: 0.75rem 0;
}
.react-grid button {
  font-size: 1.5rem;
  padding: 0.4rem;
  border-radius: 10px;
  background: var(--bg);
}
.react-grid button:hover { background: var(--accent-soft); }
.admin-stats {
  margin: 0.75rem 0;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--bg);
  font-size: 0.9rem;
  line-height: 1.5;
}
.admin-actions { margin: 0.75rem 0; }
.admin-actions .btn-primary { width: 100%; }
.invite-url-label input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}
.media-caption, .file-link { font-size: 0.85rem; }
.row.mine .file-link { color: #fff; text-decoration: underline; }
.file-link { color: var(--accent-dark); }
.media-loading { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.88rem; }

.jumbo-emoji {
  font-size: 3.4rem;
  line-height: 1;
  padding: 0.2rem 0.1rem;
}
.sticker-msg {
  font-size: 4.2rem;
  line-height: 1;
  padding: 0.15rem;
  display: inline-block;
}

/* —— Composer —— */
.composer-wrap {
  position: relative;
  padding: 0.75rem 1rem 1rem;
  background: transparent;
}
.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.45rem;
  align-items: center;
  padding: 0.45rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.composer-field {
  position: relative;
  display: flex;
  align-items: center;
}
.composer-field input {
  width: 100%;
  border: 0;
  background: var(--bg);
  border-radius: 999px;
  padding: 0.75rem 2.6rem 0.75rem 1rem;
  outline: none;
}
.emoji-trigger { position: absolute; right: 0.2rem; }
.send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
}
.send-btn:hover { background: var(--accent-dark); }
.composer.uploading { opacity: 0.55; pointer-events: none; }

.upload-bar {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 0.4rem 0.75rem;
  align-items: center;
  margin: 0 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
}
.upload-bar .spinner { grid-row: 1 / 3; }
.upload-text { display: flex; justify-content: space-between; gap: 0.75rem; font-size: 0.9rem; }
.upload-track { grid-column: 2; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.upload-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.15s linear; }

.spinner {
  width: 1.15rem;
  height: 1.15rem;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* —— Emoji panel —— */
.emoji-panel {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: calc(100% - 0.25rem);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 5;
}
.emoji-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  border-bottom: 1px solid var(--line);
  background: #fafcfc;
}
.emoji-tab {
  flex: 1;
  padding: 0.45rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}
.emoji-tab.active { background: var(--accent-soft); color: var(--accent-dark); }
.emoji-grid, .sticker-grid {
  overflow: auto;
  padding: 0.55rem;
  display: grid;
  gap: 0.25rem;
}
.emoji-grid { grid-template-columns: repeat(8, 1fr); }
.sticker-grid { grid-template-columns: repeat(4, 1fr); }
.emoji-cat {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  padding: 0.35rem 0.25rem 0.15rem;
}
.emoji-btn, .sticker-btn {
  aspect-ratio: 1;
  border-radius: 12px;
  font-size: 1.45rem;
  display: grid;
  place-items: center;
}
.emoji-btn:hover, .sticker-btn:hover { background: var(--accent-soft); }
.sticker-btn {
  font-size: 2.1rem;
  padding: 0.35rem;
  background: var(--bg);
}
.sticker-btn small {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  font-weight: 600;
}

/* animations for "living" stickers */
.anim-bounce { animation: bounce 0.9s ease-in-out infinite; }
.anim-spin { animation: spin-emoji 2.2s linear infinite; display: inline-block; }
.anim-wiggle { animation: wiggle 0.7s ease-in-out infinite; display: inline-block; }
.anim-pop { animation: pop 1.1s ease-in-out infinite; display: inline-block; }
.anim-float { animation: floaty 1.4s ease-in-out infinite; display: inline-block; }
.anim-shake { animation: shake 0.55s ease-in-out infinite; display: inline-block; }
.anim-pulse { animation: pulse 1s ease-in-out infinite; display: inline-block; }

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
@keyframes spin-emoji { to { transform: rotate(360deg); } }
@keyframes wiggle {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(8deg); }
}
@keyframes pop {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}
@keyframes floaty {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: 0.85; }
}

/* —— Info panel —— */
.info-panel {
  background: var(--panel);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
}
.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}
.info-header h3 { margin: 0; font-size: 1rem; }
.info-profile { text-align: center; padding: 1.25rem 1rem 0.75rem; }
.info-profile strong { display: block; margin-bottom: 0.2rem; }
.info-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.5rem 1rem 1rem;
}
.info-action {
  display: grid;
  gap: 0.25rem;
  place-items: center;
  padding: 0.7rem 0.4rem;
  border-radius: 14px;
  background: var(--bg);
  font-size: 0.78rem;
  color: var(--muted);
}
.info-block { padding: 0.5rem 1rem 1rem; }
.info-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.member-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.9rem;
}
.info-note {
  margin: auto 1rem 1rem;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.82rem;
}

/* —— Dialog —— */
dialog {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.1rem;
  width: min(420px, 92vw);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(21, 32, 39, 0.35); }
dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0;
  margin: 1rem 0 0;
}
.picker-list { display: grid; gap: 0.35rem; max-height: 240px; overflow: auto; margin-top: 0.75rem; }
.picker-list label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding: 0.45rem;
  border-radius: 10px;
}
.picker-list label:hover { background: var(--bg); }

/* —— Settings / Admin console —— */
.console-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
  background: var(--bg);
}
.console-nav {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 100vh;
}
.console-back {
  align-self: flex-start;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
}
.console-back:hover { background: var(--bg); color: var(--ink); }
.console-nav h2 { margin: 0; font-size: 1.35rem; }
.console-sub { margin: 0 0 1rem; }
.console-menu { display: grid; gap: 0.25rem; }
.console-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  color: var(--ink);
  font-weight: 500;
  text-align: left;
  width: 100%;
}
.console-item:hover { background: var(--bg); }
.console-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}
.console-item svg { flex-shrink: 0; opacity: 0.85; }
.nav-badge {
  margin-left: auto;
  background: var(--line);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}
.console-signed {
  margin-top: auto;
  padding: 0.75rem;
  border-radius: 12px;
  background: var(--bg);
  font-size: 0.82rem;
  color: var(--muted);
}
.console-main {
  padding: 1.5rem;
  overflow: auto;
  display: grid;
  gap: 1rem;
  align-content: start;
}
.console-panel { display: grid; gap: 1rem; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.card label {
  display: grid;
  gap: 0.35rem;
  margin: 0.85rem 0;
  font-size: 0.9rem;
  font-weight: 500;
}
.card input[type="text"],
.card input[type="password"],
.card textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafb;
  font: inherit;
}
.toggle-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  grid-template-columns: none !important;
}
.toggle-row input[type="checkbox"] {
  width: 2.6rem;
  height: 1.45rem;
  appearance: none;
  background: #cfd8dc;
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s;
  flex-shrink: 0;
}
.toggle-row input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle-row input[type="checkbox"]:checked { background: var(--accent); }
.toggle-row input[type="checkbox"]:checked::after { transform: translateX(1.15rem); }
.d-block { display: block; font-weight: 400; margin-top: 0.2rem; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
  display: grid;
  gap: 0.35rem;
  box-shadow: var(--shadow);
}
.stat-card strong { font-size: 1.45rem; }
.admin-health { display: grid; gap: 0.65rem; margin-top: 0.75rem; }
.health-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}
.pill-ok { background: #e6f7ef; color: #1b7a4a; }
.admin-user-list { list-style: none; margin: 0.75rem 0 0; padding: 0; display: grid; gap: 0.35rem; }
.admin-user-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.35rem;
  border-bottom: 1px solid var(--line);
}
.admin-user-meta { flex: 1; display: grid; gap: 0.1rem; min-width: 0; }
.role-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
}
.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }
.lock-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-soft);
}
#recovery-dialog label { display: grid; gap: 0.35rem; margin: 0.75rem 0; font-weight: 500; }
#recovery-dialog input {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafb;
}

@media (max-width: 900px) {
  .app-shell, .app-shell.info-open {
    grid-template-columns: 1fr;
    grid-template-rows: 42vh 58vh;
    height: 100vh;
    max-width: none;
  }
  .info-panel { display: none !important; }
  .emoji-grid { grid-template-columns: repeat(6, 1fr); }
  .console-screen { grid-template-columns: 1fr; }
  .console-nav { min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .stat-row { grid-template-columns: 1fr 1fr; }
}

