@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root,
#nl-root {
  --bg: #0a1020;
  --surface: #111a2d;
  --elevated: #182338;
  --fg: #f2f7ff;
  --muted: #93a6c2;
  --subtle: #6b7c93;
  --accent: #5ea0ff;
  --accent-fg: #071018;
  --bubble-in: #142035;
  --bubble-out: #3b6fe0;
  --danger: #e34d66;
  --ok: #2ecc8a;
  --border: color-mix(in oklab, var(--fg) 12%, transparent);
  --shadow-sm: 0 4px 14px color-mix(in oklab, #000 18%, transparent);
  --shadow-md: 0 16px 40px color-mix(in oklab, #000 28%, transparent);
  --shadow-lg: 0 28px 80px color-mix(in oklab, #000 42%, transparent);
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --nav-h: 64px;
  --hdr-h: 60px;
  --motion-quick: 150ms;
  --motion-fast: 250ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Twemoji Mozilla", sans-serif;
}

* { box-sizing: border-box; border-color: var(--border); }
html, body, #nl-root, #app { height: 100%; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}
button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; }
button, input, textarea { font-family: inherit; color: inherit; }
textarea { resize: none; }
a { color: inherit; }
img { max-width: 100%; }

#nl-root {
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
}

.nl-pattern {
  background-color: var(--bg);
  background-image:
    radial-gradient(circle at 50% 0%, color-mix(in oklab, var(--accent) 14%, transparent), transparent 42%),
    repeating-linear-gradient(-18deg, transparent 0 28px, color-mix(in oklab, var(--accent) 7%, transparent) 28px 29px);
}

.nl-scroll { scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--accent) 50%, transparent) transparent; }
.nl-scroll::-webkit-scrollbar { width: 4px; }
.nl-scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 8px; }

.reduce-motion *,
.reduce-motion *::before,
.reduce-motion *::after {
  animation-duration: 0.001s !important;
  transition-duration: 0.001s !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}

.ic { display: block; flex-shrink: 0; }

/* Splash / auth */
.nl-center {
  display: grid;
  place-items: center;
  height: 100%;
  padding: 24px;
}
.mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 800;
  font-size: 28px;
  letter-spacing: -0.04em;
}
.mark.sm { width: 40px; height: 40px; font-size: 18px; border-radius: 14px; }
.mark.lg { width: 80px; height: 80px; font-size: 34px; border-radius: 28px; }

.auth-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 28px 24px 24px;
  box-shadow: var(--shadow-md);
}
.auth-card h1 {
  margin: 16px 0 4px;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.auth-card h1 span { color: var(--accent); }
.auth-card .sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .search input, .composer textarea, .sheet input, .sheet textarea {
  height: 44px;
  border: 1px solid var(--border);
  background: var(--elevated);
  border-radius: 12px;
  padding: 0 14px;
  outline: none;
  font-size: 15px;
}
.field textarea, .sheet textarea { height: auto; min-height: 88px; padding: 12px 14px; }
.field input:focus, .field textarea:focus, .search input:focus, .sheet input:focus, .sheet textarea:focus {
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 18%, transparent);
}
.err { color: var(--danger); font-size: 13px; margin: 4px 0 10px; min-height: 1.2em; }
.hint { color: var(--subtle); font-size: 12px; margin-top: 12px; text-align: center; }
.linkish { background: none; border: none; color: var(--accent); font-weight: 700; padding: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  font-size: 14px;
  transition: transform var(--motion-quick) var(--ease-out), opacity var(--motion-quick) var(--ease-out);
}
.btn:hover { opacity: 0.92; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost {
  background: transparent;
  color: var(--fg);
}
.btn.sec {
  background: var(--elevated);
  color: var(--fg);
  border: 1px solid var(--border);
}
.btn.danger { background: var(--danger); color: #fff; }
.btn.icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--fg);
}
.btn.icon:hover { background: color-mix(in oklab, var(--fg) 6%, transparent); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.pill { border-radius: 999px; }

/* Shell */
.shell { display: flex; height: 100%; min-height: 0; overflow: hidden; }
.sidebar {
  width: 100%;
  max-width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
@media (min-width: 768px) {
  .sidebar { width: 380px; max-width: 380px; }
}
@media (max-width: 767px) {
  .shell.thread-open .sidebar { display: none; }
  .shell:not(.thread-open) .main { display: none; }
  .shell.tab-contacts .sidebar, .shell.tab-settings .sidebar { display: none; }
  .shell.tab-contacts .main, .shell.tab-settings .main { display: flex; }
  .shell.thread-open.tab-contacts .main, .shell.thread-open.tab-settings .main { display: none; }
}

.hdr {
  height: var(--hdr-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
  flex-shrink: 0;
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: -0.03em; flex: 1; }
.brand span { color: var(--accent); }

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin: 0 12px 8px;
  padding: 0 12px;
  background: var(--elevated);
  border-radius: 16px;
  color: var(--subtle);
}
.search input {
  height: 100%;
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  font-size: 14px;
}
.search input:focus { box-shadow: none; border: 0; }

.folders {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 0 12px 10px;
  flex-shrink: 0;
}
.chip {
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--elevated);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.chip.on { background: var(--accent); color: var(--accent-fg); }

.list { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 8px; }
.row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  transition: background var(--motion-quick) var(--ease-out);
}
.row:hover { background: color-mix(in oklab, var(--fg) 5%, transparent); }
.row.on { background: color-mix(in oklab, var(--accent) 14%, transparent); }

.av {
  position: relative;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
}
.av .dot {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  height: 10px;
  background: var(--ok);
  border: 2px solid var(--surface);
  border-radius: 50%;
}
.meta { min-width: 0; flex: 1; }
.meta .top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.meta .name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta .time { font-size: 11px; color: var(--subtle); flex-shrink: 0; }
.meta .bot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.meta .prev { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 11px;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.badge.mute { background: var(--subtle); color: #fff; }
.pin-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--subtle); flex-shrink: 0; }

.nav {
  display: flex;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: var(--subtle);
  font-size: 10px;
  font-weight: 600;
  padding: 8px 0;
}
.nav button.on { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
@media (min-width: 768px) {
  .nav { height: auto; padding: 8px; gap: 4px; }
  .nav button { border-radius: 12px; padding: 10px 0; }
}

.empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--subtle);
  font-size: 14px;
  line-height: 1.5;
}
.sec-label {
  padding: 14px 16px 6px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}

/* Thread */
.thread { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--bg); position: relative; overflow: hidden; }
.thread-hdr {
  height: var(--hdr-h);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.peer-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  padding: 4px 8px;
  border-radius: 12px;
}
.peer-btn:hover { background: color-mix(in oklab, var(--fg) 5%, transparent); }
.peer-btn .who { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.peer-btn .st { font-size: 12px; color: var(--muted); }
.peer-btn .st.on { color: var(--accent); }

.msgs {
  position: relative;
  z-index: 1;
  background: transparent !important;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}
.day {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}
.day span {
  background: color-mix(in oklab, var(--surface) 80%, transparent);
  color: var(--muted);
  font-size: 11px;
  padding: 4px 12px;
  border-radius: 999px;
}
.sys { text-align: center; color: var(--subtle); font-size: 12px; margin: 8px 0; }
.bubble-row { display: flex; margin-bottom: 4px; width: 100%; }
.bubble-row.mine { justify-content: flex-end; }
.bubble-row > div { width: fit-content; max-width: 82%; min-width: 0; }
.bubble-row .gname { font-size: 11px; font-weight: 700; color: var(--accent); padding: 0 8px 2px; }
.bubble {
  display: block;
  width: fit-content;
  min-width: 56px;
  max-width: 100%;
  border-radius: 16px;
  padding: 9px 12px 7px;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.bubble-row.mine .bubble { background: var(--bubble-out); color: #fff; border-bottom-right-radius: 4px; }
.bubble-row.theirs .bubble {
  background: var(--bubble-in);
  color: var(--fg);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.quote {
  border-left: 2px solid color-mix(in oklab, currentColor 50%, transparent);
  padding-left: 8px;
  margin-bottom: 6px;
  font-size: 11px;
  opacity: 0.8;
}
.bubble p { margin: 0; font-size: 15px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; }
.bubble .foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.7;
}
.media-preview-btn {
  display: block;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  cursor: zoom-in;
}
.bubble img.pic {
  display: block;
  max-height: 220px;
  max-width: 240px;
  border-radius: 10px;
  margin-bottom: 6px;
  object-fit: cover;
}
.bubble audio { width: 220px; max-width: 100%; margin: 4px 0; }
.msg-link { color: inherit; text-decoration: underline; cursor: pointer; font-weight: 600; }
.ctx {
  position: fixed;
  z-index: 40;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  box-shadow: var(--shadow-md);
}
.ctx button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--fg);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
}
.ctx button:hover { background: var(--elevated); }
.ctx button.danger { color: var(--danger); }

.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border-top: 2px solid var(--accent);
}
.reply-bar .bar { width: 3px; height: 32px; background: var(--accent); border-radius: 2px; }
.reply-bar .ttl { font-size: 12px; font-weight: 700; color: var(--accent); }
.reply-bar .txt { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.composer .box {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--elevated);
  border-radius: 22px;
  padding: 4px 4px 4px 14px;
}
.composer textarea {
  flex: 1;
  min-height: 36px;
  max-height: 120px;
  border: 0;
  background: transparent;
  padding: 8px 0;
  font-size: 15px;
  outline: none;
  box-shadow: none;
}
.composer .send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  padding: 0;
}

/* Emoji picker — Telegram-like */
.emo {
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 280px;
}
.emo-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 10px 4px;
  height: 36px;
  padding: 0 10px;
  background: var(--elevated);
  border-radius: 10px;
  color: var(--subtle);
}
.emo-search input {
  flex: 1;
  border: 0;
  background: transparent;
  height: 100%;
  outline: none;
  font-size: 13px;
}
.emo-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px;
  overflow-x: auto;
  flex-shrink: 0;
}
.emo-tabs button {
  width: 36px;
  height: 32px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 18px;
  font-family: var(--emoji);
  opacity: 0.55;
}
.emo-tabs button.on { opacity: 1; background: var(--elevated); }
.emo-grid {
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  padding: 4px 8px 10px;
}
.emo-grid button {
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  font-family: var(--emoji);
}
.emo-grid button:hover { background: var(--elevated); }
.emo-empty { grid-column: 1 / -1; text-align: center; color: var(--subtle); font-size: 13px; padding: 20px; }

/* Settings / contacts */
.panel { display: flex; flex-direction: column; height: 100%; background: var(--bg); }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 32px; }
.me-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 24px;
  color: inherit;
  text-align: left;
  margin-bottom: 12px;
}
.me-card .nm { font-size: 20px; font-weight: 800; }
.me-card .un { font-size: 14px; color: var(--muted); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
}
.card .cap {
  padding: 12px 16px 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--subtle);
}
.srow {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.srow:hover { background: color-mix(in oklab, var(--accent) 7%, transparent); }
.ico {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in oklab, var(--accent) 12%, transparent);
  color: var(--accent);
  flex-shrink: 0;
}
.srow .ttl { display: block; font-size: 14px; font-weight: 700; }
.srow .sub { display: block; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Overlay / sheet */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 12px;
  background: color-mix(in oklab, #050814 55%, transparent);
  backdrop-filter: blur(8px);
}
.sheet {
  width: min(440px, 100%);
  max-height: min(88vh, 720px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px;
  box-shadow: var(--shadow-lg);
}
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.sheet .desc { color: var(--muted); font-size: 13px; margin-bottom: 16px; line-height: 1.45; }
.switch {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: var(--elevated);
  position: relative;
  flex-shrink: 0;
}
.switch.on { background: var(--accent); }
.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--motion-fast) var(--ease-out);
}
.switch.on i { transform: translateX(18px); }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}
.theme-card.on { outline: 2px solid var(--accent); }
.theme-card .sw { height: 56px; border-radius: 12px; position: relative; margin-bottom: 8px; overflow: hidden; }
.theme-card .sw b { position: absolute; right: 8px; bottom: 8px; width: 28px; height: 28px; border-radius: 50%; }
.theme-card .tn { font-size: 13px; font-weight: 800; }
.theme-card .td { font-size: 11px; color: var(--muted); }

.browser {
  width: min(1000px, 100%);
  height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
}
.browser .bar { display: flex; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); }
.browser .bar input { flex: 1; height: 40px; border-radius: 10px; border: 1px solid var(--border); background: var(--elevated); padding: 0 12px; outline: none; }
.browser iframe { flex: 1; border: 0; background: #fff; }

/* Call */
.call {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: color-mix(in oklab, var(--bg) 92%, #000);
}
.call video#local {
  position: absolute;
  right: 16px;
  bottom: 110px;
  width: 140px;
  height: 180px;
  object-fit: cover;
  border-radius: 16px;
  background: #000;
  border: 1px solid var(--border);
}
.call video#remote {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.call .info { position: relative; z-index: 1; text-align: center; }
.call .acts { position: relative; z-index: 1; display: flex; gap: 12px; }
.call .acts .btn { width: 56px; height: 56px; border-radius: 50%; padding: 0; }

.toast-wrap {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--elevated);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.placeholder {
  display: none;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
@media (min-width: 768px) {
  .placeholder { display: flex; }
}
.placeholder h2 { margin: 20px 0 8px; font-size: 20px; }
.placeholder p { margin: 0; color: var(--muted); font-size: 14px; max-width: 320px; line-height: 1.5; }

.online-dot { color: var(--ok); }

.seg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.flex-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.5; }
.center { text-align: center; }
.mt { margin-top: 12px; }
.gap { display: flex; gap: 8px; }
.grow { flex: 1; }
.min { min-width: 0; }
.hidden { display: none !important; }
.rec { background: var(--danger) !important; color: #fff !important; }

.music-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  margin-top: 4px;
}
.sticker-btn {
  max-width: 190px;
}
.sticker {
  display: block;
  width: auto;
  max-width: 190px;
  max-height: 190px;
  object-fit: contain;
  border-radius: 12px;
}
.media-viewer {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(10px);
  padding: 24px;
}
.media-viewer-stage {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
}
.media-viewer-image {
  max-width: 96vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 10px;
  user-select: none;
}
.media-viewer-sticker {
  max-width: min(88vw, 720px);
  max-height: 88vh;
  object-fit: contain;
}
.media-viewer-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.12);
  color: #fff;
  z-index: 2;
  cursor: pointer;
}
.media-viewer-close:hover { background: rgba(255,255,255,.2); }
body.media-viewer-open { overflow: hidden; }

/* ============================================================
   Voice Message Player — красивый дизайн для голосовых сообщений
   ============================================================ */

.voice-player {
    display: flex;
    align-items: center;
    gap: 10px;
    background: color-mix(in oklab, var(--elevated) 60%, transparent);
    border-radius: 40px;
    padding: 6px 12px 6px 8px;
    min-width: 180px;
    max-width: 280px;
    backdrop-filter: blur(4px);
    border: 1px solid color-mix(in oklab, var(--border) 50%, transparent);
    transition: border-color var(--motion-quick) var(--ease-out);
}

.voice-player:hover {
    border-color: color-mix(in oklab, var(--accent) 40%, transparent);
}

/* --- Кнопка play/pause --- */
.voice-btn {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: var(--accent-fg);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: transform var(--motion-quick) var(--ease-out),
        box-shadow var(--motion-quick) var(--ease-out);
    box-shadow: 0 4px 12px color-mix(in oklab, var(--accent) 30%, transparent);
    position: relative;
}

.voice-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px color-mix(in oklab, var(--accent) 40%, transparent);
}

.voice-btn:active {
    transform: scale(0.94);
}

.voice-btn svg {
    width: 18px;
    height: 18px;
    display: block;
    fill: currentColor;
}

/* Пульсирующее кольцо при воспроизведении */
.voice-btn.playing::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--accent);
    animation: voice-pulse 1.4s ease-out infinite;
    opacity: 0;
}

@keyframes voice-pulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.35);
        opacity: 0;
    }
}

/* Кнопка в сообщениях "собеседника" — другой цвет */
.bubble-row.theirs .voice-btn {
    background: var(--accent);
    color: var(--accent-fg);
}

.bubble-row.mine .voice-btn {
    background: #fff;
    color: #1a1a2e;
}

.bubble-row.mine .voice-btn.playing::before {
    border-color: #fff;
}

/* --- Прогресс-бар --- */
.voice-progress-wrap {
    flex: 1;
    min-width: 60px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-track {
    position: relative;
    height: 4px;
    background: color-mix(in oklab, var(--fg) 18%, transparent);
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: height var(--motion-quick) var(--ease-out);
}

.voice-track:hover {
    height: 6px;
}

.voice-fill {
    height: 100%;
    width: 0%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--accent), color-mix(in oklab, var(--accent) 70%, #fff));
    transition: width 0.1s linear;
    position: relative;
}

/* Маленький кружок на ползунке */
.voice-fill::after {
    content: '';
    position: absolute;
    right: -5px;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px color-mix(in oklab, var(--accent) 50%, transparent);
    opacity: 0;
    transition: opacity var(--motion-quick) var(--ease-out);
}

.voice-track:hover .voice-fill::after {
    opacity: 1;
}

/* --- Время --- */
.voice-time {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 600;
    color: var(--subtle);
    letter-spacing: 0.02em;
    font-variant-numeric: tabular-nums;
}

.voice-time .current {
    color: var(--muted);
}

.voice-time .duration {
    color: var(--subtle);
}

/* --- Волновая форма (декоративные бары) --- */
.voice-wave {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 24px;
    flex-shrink: 0;
    padding: 0 2px;
}

.voice-wave .bar {
    width: 3px;
    border-radius: 2px;
    background: color-mix(in oklab, var(--accent) 40%, transparent);
    transition: height 0.2s ease, background 0.2s ease;
    height: 8px;
}

.voice-wave .bar.active {
    background: var(--accent);
}

/* Анимация волны при воспроизведении */
.voice-player.playing .voice-wave .bar {
    animation: voice-wave 0.8s ease-in-out infinite alternate;
}

.voice-player.playing .voice-wave .bar:nth-child(1) {
    animation-delay: 0.0s;
    height: 10px;
}
.voice-player.playing .voice-wave .bar:nth-child(2) {
    animation-delay: 0.1s;
    height: 18px;
}
.voice-player.playing .voice-wave .bar:nth-child(3) {
    animation-delay: 0.2s;
    height: 14px;
}
.voice-player.playing .voice-wave .bar:nth-child(4) {
    animation-delay: 0.3s;
    height: 22px;
}
.voice-player.playing .voice-wave .bar:nth-child(5) {
    animation-delay: 0.15s;
    height: 12px;
}
.voice-player.playing .voice-wave .bar:nth-child(6) {
    animation-delay: 0.25s;
    height: 20px;
}
.voice-player.playing .voice-wave .bar:nth-child(7) {
    animation-delay: 0.05s;
    height: 16px;
}
.voice-player.playing .voice-wave .bar:nth-child(8) {
    animation-delay: 0.35s;
    height: 10px;
}
.voice-player.playing .voice-wave .bar:nth-child(9) {
    animation-delay: 0.12s;
    height: 18px;
}
.voice-player.playing .voice-wave .bar:nth-child(10) {
    animation-delay: 0.28s;
    height: 14px;
}

@keyframes voice-wave {
    0% {
        height: 6px;
        background: color-mix(in oklab, var(--accent) 30%, transparent);
    }
    100% {
        height: 22px;
        background: var(--accent);
    }
}

/* --- Сообщение с голосовым — компактнее --- */
.bubble .voice-player {
    margin: 2px 0;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .voice-player {
        min-width: 140px;
        max-width: 220px;
        padding: 4px 10px 4px 6px;
        gap: 8px;
    }
    .voice-btn {
        width: 32px;
        height: 32px;
    }
    .voice-btn svg {
        width: 14px;
        height: 14px;
    }
    .voice-wave .bar {
        width: 2px;
    }
    .voice-wave {
        height: 20px;
        gap: 1.5px;
    }
}


/* ============================================================
   Собеседник — профиль и медиа-вкладки
   ============================================================ */
.profile-view {
  margin: -4px -4px 0;
}
.profile-hero {
  position: relative;
  text-align: center;
  padding: 8px 12px 18px;
  overflow: hidden;
  background: var(--surface);
}
.profile-avatar {
  position: relative;
  z-index: 1;
  width: 100px;
  height: 100px;
  margin: 2px auto 12px;
}
.profile-avatar .av {
  width: 100px !important;
  height: 100px !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--fg) 8%, transparent);
}
.profile-avatar.is-online::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ok);
  border: 4px solid var(--surface);
}
.profile-name {
  position: relative;
  z-index: 1;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.profile-username {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}
.profile-status {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.profile-status.on { color: var(--accent); }
.profile-bio {
  position: relative;
  z-index: 1;
  max-width: 340px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.profile-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0 -20px 10px;
  padding: 0 8px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.profile-tabs button {
  position: relative;
  min-width: 0;
  min-height: 52px;
  border: 0;
  border-radius: 0;
  padding: 6px 3px 7px;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font: inherit;
  cursor: pointer;
  transition: color var(--motion-quick) var(--ease-out), background var(--motion-quick) var(--ease-out);
}
.profile-tabs button span:last-child {
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.profile-tabs button.on { color: var(--accent); background: color-mix(in oklab, var(--accent) 5%, transparent); }
.profile-tabs button.on::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--accent);
}
.profile-tabs button:hover:not(.on) { background: color-mix(in oklab, var(--fg) 4%, transparent); color: var(--fg); }
.profile-tabs button:active { transform: none; }
.profile-content {
  min-height: 170px;
  max-height: 330px;
  overflow: auto;
  padding: 2px 0 0;
}
.profile-empty {
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: var(--subtle);
  text-align: center;
  font-size: 13px;
}
.profile-empty-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--muted);
  background: var(--elevated);
}
.profile-list-card {
  width: 100%;
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1px;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  text-decoration: none;
  transition: background var(--motion-quick) var(--ease-out);
}
.profile-list-card:hover { background: color-mix(in oklab, var(--fg) 5%, transparent); transform: none; }
.profile-card-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--accent);
  background: color-mix(in oklab, var(--accent) 10%, transparent);
}
.profile-card-icon.voice { color: var(--accent); }
.profile-card-icon.link { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.profile-card-icon.message { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.profile-card-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.profile-card-meta b { min-width: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-card-meta small { font-size: 11px; color: var(--subtle); }
.profile-list-card > .ic { color: var(--subtle); flex-shrink: 0; }
.profile-media-card {
  width: calc(33.333% - 4px);
  aspect-ratio: 1;
  display: inline-flex;
  vertical-align: top;
  flex-direction: column;
  gap: 0;
  margin: 0 6px 6px 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--elevated);
  cursor: pointer;
  color: inherit;
  text-align: left;
}
.profile-media-card:nth-child(3n) { margin-right: 0; }
.profile-media-card img { width: 100%; height: calc(100% - 32px); object-fit: cover; display: block; }
.profile-media-card .profile-card-meta { padding: 6px 8px; background: var(--surface); }
.profile-play {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
}
.voice-summary { min-height: 64px; }

@media (max-width: 480px) {
  .sheet { padding: 14px; border-radius: 22px; }
  .profile-tabs button { min-height: 48px; }
  .profile-tabs button span:last-child { font-size: 9px; }
  .profile-media-card { width: calc(33.333% - 4px); }
}


/* NexLink startup splash */
.nl-splash {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(circle at 50% 35%, rgba(94,160,255,.16), transparent 32%), radial-gradient(circle at 20% 80%, rgba(59,111,224,.10), transparent 28%), #070B16;
  transition: opacity .42s ease, transform .42s ease, filter .42s ease;
}
.nl-splash.is-hiding { opacity:0; transform:scale(1.025); filter:blur(7px); pointer-events:none; }
.nl-splash-glow { position:absolute; width:44vmax; height:44vmax; border-radius:50%; background:radial-gradient(circle,rgba(94,160,255,.14),transparent 68%); filter:blur(12px); animation:nl-glow 2.8s ease-in-out infinite; }
.nl-splash-card { position:relative; z-index:1; display:flex; flex-direction:column; align-items:center; padding:34px; text-align:center; }
.nl-splash-mark { width:84px; height:84px; display:grid; place-items:center; border-radius:27px; color:#fff; font-size:35px; font-weight:900; background:linear-gradient(145deg,#5EA0FF,#2F6FED); box-shadow:0 18px 60px rgba(47,111,237,.36), inset 0 1px 0 rgba(255,255,255,.28); animation:nl-logo-pop .72s cubic-bezier(.2,.8,.2,1), nl-logo-float 2.6s ease-in-out .72s infinite; }
.nl-splash-title { margin-top:18px; color:#F4F7FB; font-size:29px; font-weight:900; letter-spacing:-.035em; animation:nl-fade-up .55s .1s both; }
.nl-splash-title span { color:#5EA0FF; }
.nl-splash-sub { margin-top:7px; color:#8B9AB1; font-size:12px; animation:nl-fade-up .55s .18s both; }
.nl-splash-loader { width:128px; height:3px; margin-top:24px; overflow:hidden; border-radius:99px; background:rgba(255,255,255,.08); animation:nl-fade-up .55s .25s both; }
.nl-splash-loader span { display:block; width:42%; height:100%; border-radius:inherit; background:linear-gradient(90deg,#5EA0FF,#9AC4FF); animation:nl-loader 1.1s ease-in-out infinite; }
.nl-splash-orbit { position:absolute; left:50%; top:75px; width:150px; height:150px; margin:-33px 0 0 -75px; border:1px solid rgba(94,160,255,.15); border-radius:50%; pointer-events:none; }
.nl-splash-orbit-a { animation:nl-orbit 5s linear infinite; }
.nl-splash-orbit-b { width:190px; height:190px; margin:-53px 0 0 -95px; border-color:rgba(94,160,255,.07); animation:nl-orbit-rev 7s linear infinite; }
@keyframes nl-logo-pop { from{opacity:0;transform:scale(.72) translateY(12px)} to{opacity:1;transform:scale(1) translateY(0)} }
@keyframes nl-logo-float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
@keyframes nl-fade-up { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes nl-loader { 0%{transform:translateX(-140%)} 50%{transform:translateX(90%)} 100%{transform:translateX(300%)} }
@keyframes nl-glow { 0%,100%{transform:scale(.92);opacity:.65} 50%{transform:scale(1.05);opacity:1} }
@keyframes nl-orbit { to{transform:rotate(360deg)} }
@keyframes nl-orbit-rev { to{transform:rotate(-360deg)} }
@media (prefers-reduced-motion: reduce) { .nl-splash * { animation:none !important; } }

/* ============================================================
   Developer Console — NexLink styled after a modern Dev Console
   ============================================================ */
.dev-sheet {
  width: min(1280px, calc(100vw - 32px));
  max-width: 1280px;
  height: min(88vh, 820px);
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: hidden;
  border-radius: 26px;
  background: #151720;
}
.dev-layout { display:grid; grid-template-columns: 246px 1fr; height:100%; min-height:0; }
.dev-sidebar { background:linear-gradient(180deg,#171922,#13151d); border-right:1px solid color-mix(in oklab,var(--border) 90%,transparent); padding:18px 14px 14px; display:flex; flex-direction:column; min-width:0; }
.dev-brand { display:flex; align-items:center; gap:11px; padding:4px 8px 18px; }
.dev-logo { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; font-weight:900; background:linear-gradient(145deg,var(--accent),#7f6cff); color:#071018; box-shadow:0 8px 22px color-mix(in oklab,var(--accent) 22%,transparent); }
.dev-brand strong { display:block; font-size:15px; color:#f4f7ff; }
.dev-brand span { display:block; font-size:11px; color:#8f9ab1; margin-top:2px; }
.dev-home,.dev-nav-item { display:flex; align-items:center; gap:10px; width:100%; border:0; background:transparent; color:#aeb7c9; border-radius:10px; padding:10px 11px; text-align:left; cursor:pointer; }
.dev-home { margin-bottom:8px; color:#cbd3e2; font-weight:800; }
.dev-home.on,.dev-nav-item.on { background:color-mix(in oklab,var(--accent) 15%,transparent); color:#fff; }
.dev-home:hover,.dev-nav-item:hover { background:color-mix(in oklab,#fff 6%,transparent); }
.dev-group-label { font-size:10px; font-weight:900; letter-spacing:.12em; color:#68758d; padding:14px 9px 7px; }
.dev-nav-item span { min-width:0; }
.dev-nav-item b { display:block; font-size:12px; font-weight:750; line-height:1.1; }
.dev-nav-item small { display:block; font-size:10px; color:#69758c; margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.dev-nav-item.on small { color:#96a6c6; }
.dev-side-foot { margin-top:auto; padding:12px 10px 3px; color:#69758c; font-size:10px; display:flex; align-items:center; gap:7px; }
.dev-dot { width:7px; height:7px; border-radius:50%; background:#30d68a; box-shadow:0 0 0 4px color-mix(in oklab,#30d68a 12%,transparent); }
.dev-main { min-width:0; min-height:0; display:flex; flex-direction:column; background:radial-gradient(900px 420px at 75% 0%, color-mix(in oklab,var(--accent) 8%,transparent), transparent 60%), #191b24; }
.dev-topbar { height:60px; display:flex; align-items:center; justify-content:space-between; padding:0 18px; border-bottom:1px solid #2a2e3a; flex-shrink:0; }
.dev-crumb { display:flex; align-items:center; gap:10px; color:#a9b2c3; font-size:12px; }
.dev-crumb span:first-child { color:#7b6cf0; font-weight:800; }
.dev-crumb b { color:#4c5567; }
.dev-content { flex:1; overflow:auto; padding:28px 28px 34px; }
.dev-hero { display:flex; justify-content:space-between; gap:20px; align-items:flex-start; padding:6px 0 24px; }
.dev-eyebrow,.dev-kicker { color:#8175f8; font-size:10px; font-weight:900; letter-spacing:.14em; }
.dev-hero h1,.dev-page-head h2 { margin:6px 0 7px; font-size:31px; line-height:1.08; color:#f5f7fd; }
.dev-hero p,.dev-page-head p { margin:0; max-width:720px; color:#8d97aa; font-size:13px; line-height:1.6; }
.dev-hero-mark { width:74px; height:74px; border-radius:22px; display:grid; place-items:center; font-size:30px; font-weight:900; background:linear-gradient(145deg,#7b6cf4,#4d8cf8); color:#fff; box-shadow:0 18px 38px rgba(76,87,255,.18); }
.dev-quick-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.dev-quick-grid button { min-height:90px; border:1px solid #2a2f3d; border-radius:15px; background:#20232d; color:#e8ebf4; padding:15px; text-align:left; cursor:pointer; transition:.18s ease; }
.dev-quick-grid button:hover { transform:translateY(-1px); border-color:#41485a; background:#242834; }
.dev-quick-grid strong { display:block; font-size:14px; }
.dev-quick-grid span { display:block; margin-top:7px; color:#7f8aa0; font-size:11px; line-height:1.35; }
.dev-card,.dev-code-card,.dev-step,.verify-card,.dev-note,.dev-empty { border:1px solid #2a2f3d; border-radius:16px; background:#20232d; }
.dev-card { padding:17px 18px; margin-bottom:11px; }
.dev-card h3 { margin:0 0 7px; font-size:15px; color:#eef1f8; }
.dev-card p,.dev-step p,.verify-card p,.dev-note { margin:0; color:#8c96a8; font-size:12px; line-height:1.6; }
.dev-card code,.dev-code-card code,.dev-code-row code,.dev-step pre { font-family:ui-monospace,SFMono-Regular,Menlo,monospace; color:#c7bbff; background:#161821; border-radius:8px; }
.dev-code-row { margin-top:13px; display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.dev-code-row code { padding:8px 10px; font-size:11px; }
.dev-code-row span { font-size:10px; color:#35d18a; }
.dev-page-head { padding-bottom:22px; }
.dev-form { max-width:650px; }
.dev-field { margin-bottom:14px; }
.dev-field label { display:block; margin-bottom:7px; color:#aab3c3; font-size:11px; font-weight:800; }
.dev-field input,.dev-field textarea { width:100%; box-sizing:border-box; border:1px solid #303647; background:#171a22; color:#f0f3f9; border-radius:12px; padding:11px 12px; outline:0; }
.dev-field textarea { min-height:110px; resize:vertical; }
.dev-field input:focus,.dev-field textarea:focus { border-color:#6f63ef; box-shadow:0 0 0 3px rgba(111,99,239,.12); }
.dev-primary { background:linear-gradient(135deg,#7367ee,#4e91f8) !important; color:white !important; border:0 !important; box-shadow:0 10px 24px rgba(79,111,240,.2); }
.dev-note { max-width:650px; margin-top:15px; padding:12px 14px; }
.dev-empty { padding:52px 20px; text-align:center; color:#8d97aa; }
.dev-empty svg { color:#7267ed; margin-bottom:8px; }
.dev-empty h3 { color:#eef1f8; margin:4px 0 6px; }
.dev-empty p { margin:0 auto 15px; max-width:380px; font-size:12px; line-height:1.55; }
.dev-code-card { padding:16px; margin-bottom:12px; }
.dev-code-card > div { display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; color:#eef1f8; }
.dev-code-card > div span { font-size:9px; font-weight:900; color:#4ed69a; background:rgba(78,214,154,.08); padding:4px 7px; border-radius:6px; }
.dev-code-card code { display:inline-block; padding:8px 10px; font-size:11px; }
.dev-code-card pre { overflow:auto; margin:12px 0 0; background:#171922; color:#b8c1d1; padding:12px; border-radius:10px; font:11px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
.dev-token { white-space:pre-wrap; word-break:break-all; color:#9ed2ff; font:11px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace; }
.dev-step { padding:15px 17px; margin-bottom:10px; }
.dev-step b { color:#eef1f8; font-size:13px; }
.dev-step pre { margin-top:9px; padding:10px; overflow:auto; font:10px/1.45 ui-monospace,SFMono-Regular,Menlo,monospace; }
.verify-card { padding:15px; display:flex; gap:13px; align-items:center; margin-bottom:11px; }
.verify-card h3 { margin:0 0 4px; color:#eef1f8; font-size:14px; }
.verify-badge { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; font-weight:900; color:#fff; background:linear-gradient(145deg,#6e6af6,#5ea0ff); box-shadow:0 8px 20px rgba(94,160,255,.18); }
.verify-badge.creator { background:linear-gradient(145deg,#f0a43b,#f06b89); }
@media (max-width: 900px) {
  .dev-sheet { width:calc(100vw - 18px); height:calc(100vh - 18px); max-height:none; }
  .dev-layout { grid-template-columns:190px 1fr; }
  .dev-quick-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
  .dev-layout { grid-template-columns:1fr; }
  .dev-sidebar { display:none; }
  .dev-content { padding:20px 16px 24px; }
  .dev-quick-grid { grid-template-columns:1fr 1fr; gap:8px; }
  .dev-hero-mark { width:56px; height:56px; border-radius:17px; font-size:24px; }
}

/* TOTP / two-step verification */
.totp-secret-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--elevated);
}
.totp-secret-card .cap {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.totp-secret-card code {
  display: block;
  font-size: 18px;
  line-height: 1.4;
  letter-spacing: .12em;
  word-break: break-all;
  color: var(--fg);
}
#totp-enroll-code,
#totp-start-form input[type=password],
#totp-disable-form input[type=password] {
  font-variant-numeric: tabular-nums;
  letter-spacing: .08em;
}


/* TOTP QR */
.totp-qr-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 14px;
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--elevated);
}
.totp-qr-title {
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  color: var(--fg);
}
.totp-qr {
  width: min(260px, 78vw);
  aspect-ratio: 1;
  padding: 10px;
  display: grid;
  place-items: center;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,.22);
  overflow: hidden;
}
.totp-qr svg {
  display: block;
  width: 100%;
  height: 100%;
}
.totp-qr-fallback {
  text-align: center;
  max-width: 300px;
}

/* Developer Console polish */
.dev-sheet { width:min(1380px, calc(100vw - 24px)); height:min(92vh, 900px); max-width:1380px; max-height:92vh; border-radius:24px; }
.dev-sidebar { width:270px; padding:20px 15px 14px; background:#12151d; }
.dev-brand { padding:2px 9px 20px; }
.dev-logo { width:40px; height:40px; border-radius:13px; }
.dev-home,.dev-nav-item { min-height:44px; }
.dev-nav-item.on { box-shadow:inset 3px 0 0 #7d6cf5; }
.dev-sidebar-divider { height:1px; background:#252a35; margin:14px 8px 10px; }
.dev-exit { display:flex; align-items:center; gap:9px; width:100%; padding:10px 11px; border:0; border-radius:10px; background:transparent; color:#9aa5b8; font-size:12px; font-weight:700; cursor:pointer; text-align:left; }
.dev-exit:hover { background:rgba(255,255,255,.05); color:#fff; }
.dev-side-foot { padding-top:9px; }
.dev-top-actions { display:flex; align-items:center; gap:10px; }
.dev-session-chip { display:inline-flex; align-items:center; min-height:28px; padding:0 10px; border:1px solid #2b3140; border-radius:999px; color:#8f9ab0; background:#1a1d26; font-size:10px; font-weight:800; }
.dev-session-chip::first-letter { color:#4ed69a; }
.dev-content { padding:30px 32px 40px; max-width:980px; }
.dev-hero { padding-bottom:26px; }
.dev-hero h1,.dev-page-head h2 { letter-spacing:-.02em; }
.dev-quick-grid button { min-height:102px; }
.dev-list { padding:6px; }
.dev-list-row { display:flex; align-items:center; gap:12px; padding:12px; border-radius:12px; }
.dev-list-row + .dev-list-row { border-top:1px solid #2a2f3d; }
.dev-bot-avatar { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:linear-gradient(145deg,#5f74ff,#8f6cf5); color:#fff; font-weight:900; }
.dev-list-main { flex:1; min-width:0; }
.dev-list-main b { display:block; color:#eef1f8; font-size:13px; }
.dev-list-main span { display:block; color:#7f8aa0; font-size:11px; margin-top:3px; }
.dev-status { color:#4ed69a; font-size:10px; font-weight:800; }
.dev-secret-card { margin-top:16px; padding:16px; border-radius:16px; border:1px solid rgba(78,214,154,.22); background:linear-gradient(180deg,#19261f,#18211d); }
.dev-secret-card > div:first-child { display:flex; align-items:center; gap:10px; justify-content:space-between; margin-bottom:10px; }
.dev-secret-title { color:#eef7f1; font-size:13px; font-weight:800; }
.dev-session-badge { color:#4ed69a; font-size:9px; font-weight:800; padding:4px 7px; background:rgba(78,214,154,.08); border-radius:999px; }
.dev-secret-card code { display:block; padding:12px; border-radius:10px; background:#0f1412; border:1px solid #26392e; color:#b9f3d0; word-break:break-all; font:12px/1.55 ui-monospace,SFMono-Regular,Menlo,monospace; }
.dev-secret-actions { display:flex; gap:8px; margin-top:10px; }
.dev-secret-card p { margin:10px 0 0; color:#829487; font-size:11px; line-height:1.5; }
.dev-token-empty { display:flex; align-items:center; gap:14px; }
.dev-token-empty h3 { margin:0 0 5px; color:#eef1f8; font-size:14px; }
.dev-token-empty p { margin:0; }
.dev-token-icon { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:#191d27; color:#8c7fff; }
@media (max-width:900px) { .dev-sheet { width:calc(100vw - 16px); height:calc(100vh - 16px); max-height:none; } .dev-sidebar { width:210px; } .dev-content { padding:24px 22px 32px; } }
@media (max-width:640px) { .dev-sidebar { display:none; } .dev-content { padding:20px 16px 26px; } .dev-session-chip { display:none; } .dev-token-empty { flex-wrap:wrap; } .dev-secret-card > div:first-child { align-items:flex-start; flex-direction:column; gap:6px; } }
.profile-edit-avatar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:center;margin:4px 0 16px}.profile-edit-avatar #profile-avatar-preview{flex-basis:100%;display:flex;justify-content:center}.profile-edit-avatar .av{box-shadow:0 10px 30px color-mix(in oklab,var(--accent) 22%,transparent)}
.profile-avatar img,.profile-edit-avatar img{width:100%;height:100%;object-fit:cover;border-radius:inherit}

.sticker-panel{padding:10px 12px;border-top:1px solid var(--border);background:color-mix(in oklab,var(--surface) 92%,transparent);backdrop-filter:blur(10px)}
.sticker-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}.sticker-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px;max-height:180px;overflow:auto}.sticker-pick{border:0;background:transparent;padding:4px;border-radius:10px;cursor:pointer}.sticker-pick:hover{background:color-mix(in oklab,var(--fg) 8%,transparent)}.sticker-pick img{display:block;width:100%;aspect-ratio:1;object-fit:contain}.sticker-empty{grid-column:1/-1;padding:20px;text-align:center;color:var(--muted);font-size:12px}.sticker-btn{border:0;background:transparent;padding:0}.sticker{display:block;width:140px;height:140px;object-fit:contain}


/* Единый неподвижный узор на весь фон чата — не прокручивается вместе с сообщениями */
.chat-pattern-layer {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--hdr-h);
  bottom: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("./chat-pattern.svg");
  background-repeat: repeat;
  background-size: 180px 180px;
  background-position: center top;
  opacity: .72;
  mix-blend-mode: screen;
}
.thread-hdr, .composer, #reply-slot, #emo-slot, #sticker-slot { position: relative; z-index: 2; }

/* Pattern adapts to every theme via the current theme palette. */
#nl-root .chat-pattern-layer {
  opacity: .32;
  mix-blend-mode: normal;
  background-size: 180px 180px;
  background-position: center center;
  filter: var(--pattern-filter, none);
}
#nl-root[data-theme="midnight"] .chat-pattern-layer,
#nl-root[data-theme="graphite"] .chat-pattern-layer { opacity: .24; filter: saturate(.75) brightness(.9); }
#nl-root[data-theme="ocean"] .chat-pattern-layer,
#nl-root[data-theme="day"] .chat-pattern-layer,
#nl-root[data-theme="emerald"] .chat-pattern-layer { opacity: .18; filter: brightness(.35) saturate(.8); }
#nl-root[data-theme="sunset"] .chat-pattern-layer { opacity: .2; filter: sepia(.2) saturate(1.1) brightness(.45); }
#nl-root[data-theme="lavender"] .chat-pattern-layer { opacity: .18; filter: hue-rotate(205deg) brightness(.55) saturate(.7); }

/* NexLink requested UX fixes */
.contact-search-tabs { margin: 0 0 8px; }
.contact-search-tabs button { flex: 1; }
.role-badge { display:inline-flex; margin-top:8px; padding:5px 9px; border-radius:999px; font-size:10px; font-weight:800; background:color-mix(in oklab,var(--accent) 14%, transparent); color:var(--fg); }
.group-member-row { gap:10px; }
.role-card { padding:14px; }
.role-help { display:grid; gap:8px; color:var(--muted); font-size:11px; line-height:1.45; }
.role-editor { display:flex; gap:8px; align-items:center; }
.role-editor select { flex:1; min-width:0; }
.dev-sheet { display:flex; flex-direction:column; min-height:0; }
.dev-layout { flex:1; min-height:0; overflow:hidden; }
.dev-sidebar { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
.dev-main { min-height:0; overflow:hidden; }
.dev-content { min-height:0; overflow-y:auto; overflow-x:hidden; overscroll-behavior:contain; scrollbar-gutter:stable; }
.dev-topbar { flex-shrink:0; }
.dev-list { overflow:auto; max-height:100%; }
.dev-list-row { min-width:0; }
.dev-list-main { overflow:hidden; }
.dev-list-main span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.verified-badge{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-left:5px;border-radius:50%;background:var(--accent);color:var(--accent-fg);font-size:10px;font-weight:900;vertical-align:middle;box-shadow:0 0 0 2px color-mix(in oklab,var(--surface) 86%,transparent)}
.profile-name .verified-badge{width:18px;height:18px;font-size:11px;margin-left:6px}
.who .verified-badge{width:14px;height:14px;font-size:9px;margin-left:4px}

/* Contact / community search polish */
.contact-search-tabs {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
  padding:5px;
  border:1px solid var(--border);
  border-radius:16px;
  background:color-mix(in oklab,var(--surface) 86%, var(--accent) 4%);
}
.contact-search-tabs button {
  min-height:42px;
  border:1px solid transparent;
  border-radius:12px;
  background:transparent;
  color:var(--muted);
  font-weight:800;
  transition:all var(--motion-quick) var(--ease-out);
}
.contact-search-tabs button:hover { color:var(--fg); background:color-mix(in oklab,var(--fg) 5%,transparent); }
.contact-search-tabs button.on {
  color:var(--fg);
  border-color:color-mix(in oklab,var(--accent) 28%,var(--border));
  background:color-mix(in oklab,var(--accent) 12%,var(--surface));
  box-shadow:0 4px 14px color-mix(in oklab,var(--accent) 10%,transparent);
}
.contact-search-tabs + .search {
  margin-top:10px;
}
.search-result-row {
  border:1px solid color-mix(in oklab,var(--border) 80%,transparent);
  background:color-mix(in oklab,var(--surface) 92%,var(--accent) 2%);
  border-radius:16px;
  margin-bottom:8px;
  padding:8px;
}
.search-result-row:hover {
  border-color:color-mix(in oklab,var(--accent) 30%,var(--border));
  transform:translateY(-1px);
}
.ctx {
  z-index: 1200;
  pointer-events: auto;
  max-width: min(320px, calc(100vw - 16px));
}

/* Keep chat info tabs stable while the panel updates. */
#profile-tabs button { -webkit-tap-highlight-color: transparent; }
#profile-tab-content { overscroll-behavior: contain; }
