:root {
  --bg: #071309;
  --paper: #F4F1E8;
  --card: #FFFFFF;
  --ink: #0F1D15;
  --ink-soft: #415047;
  --muted: #7D8B80;
  --lime: #C9F24E;
  --lime-d: #8FBF1F;
  --lime-bg: #EFF7DA;
  --forest: #133B2A;
  --orange: #FF6B3D;
  --blue: #3B7BFF;
  --blue-bg: #E9F0FF;
  --red: #E5484D;
  --line: rgba(15, 29, 21, 0.09);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --spring: cubic-bezier(.34, 1.45, .5, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

input, textarea, [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: var(--paper);
  touch-action: pan-x pan-y;
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
}

.pscreen {
  position: relative;
  width: 100%;
  max-width: 580px;
  margin: 0 auto;
  height: 100dvh;
  overflow: hidden;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

@media (min-width: 600px) {
  body {
    background: #E8E5DC;
  }
  .pscreen {
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* Screens */
.screen {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  z-index: 2;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
  z-index: 3;
}
.screen.slide-from-left {
  animation: slideFromLeft 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.screen.slide-from-right {
  animation: slideFromRight 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes slideFromLeft {
  0% { transform: translateX(-50px) scale(0.97); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
@keyframes slideFromRight {
  0% { transform: translateX(50px) scale(0.97); opacity: 0; }
  100% { transform: translateX(0) scale(1); opacity: 1; }
}
.scroll {
  height: 100%;
  overflow-y: auto;
  padding: calc(env(safe-area-inset-top, 16px) + 20px) 18px calc(env(safe-area-inset-bottom, 16px) + 96px);
  scrollbar-width: none;
}
.scroll::-webkit-scrollbar {
  display: none;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
@keyframes heartPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.35); }
  65% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

/* Common UI Elements */
.btn {
  border: 0;
  font-family: 'Unbounded', sans-serif;
  font-weight: 500;
  font-size: 13px;
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: 0.2s var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active {
  transform: scale(0.96);
}
.btn-lime {
  background: var(--lime);
  color: var(--ink);
}
.btn-lime:hover {
  box-shadow: 0 10px 22px rgba(201, 242, 78, 0.4);
}
.btn-forest {
  background: var(--forest);
  color: var(--lime);
}
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--line);
  color: var(--ink);
}
.w100 {
  width: 100%;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: 0.2s;
  flex: none;
}
.icon-btn:hover {
  box-shadow: 0 6px 14px rgba(15, 29, 21, 0.1);
}
.icon-btn:active {
  transform: scale(0.94);
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}

.screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.screen-head h2 {
  font-family: 'Unbounded', sans-serif;
  font-size: 22px;
  font-weight: 600;
}
.h-ava {
  margin-left: auto;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--forest);
  color: var(--lime);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  flex: none;
}
.h-ava:hover {
  box-shadow: 0 6px 14px rgba(15, 29, 21, 0.15);
}

.search-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0 15px;
  margin-bottom: 14px;
  transition: 0.25s;
}
.search-pill:focus-within {
  border-color: var(--lime-d);
  box-shadow: 0 0 0 4px rgba(201, 242, 78, 0.2);
}
.search-pill input {
  flex: 1;
  border: 0;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 13px 0;
  color: var(--ink);
}
.search-pill svg {
  width: 17px;
  height: 17px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
  flex: none;
}
.search-clear-btn {
  display: none;
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  border-radius: 50%;
  color: var(--muted);
  line-height: 0;
  transition: color 0.2s, transform 0.15s;
  flex: none;
}
.search-clear-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2.5;
}
.search-clear-btn:hover {
  color: var(--ink);
  transform: scale(1.15);
}
.search-clear-btn.visible {
  display: grid;
  place-items: center;
}
.sec-title {
  font-family: 'Unbounded', sans-serif;
  font-size: 14px;
  font-weight: 600;
  margin: 22px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Chats list */
.chat-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 9px;
  cursor: pointer;
  transition: box-shadow 0.25s, transform 0.2s, background 0.25s;
  align-items: center;
}
.chat-item:hover {
  box-shadow: 0 8px 20px rgba(15, 29, 21, 0.08);
}
.chat-item:active {
  background: var(--lime-bg);
}
.chat-item.pinned {
  border-color: rgba(143, 191, 31, 0.4);
  background: #FCFDF6;
}
.ci-ava {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  flex: none;
  position: relative;
}
.ci-ava.forest { background: var(--forest); color: var(--lime); }
.ci-ava.lime { background: var(--lime); color: var(--ink); }
.ci-ava.orange { background: #FFEEE5; color: var(--orange); }
.ci-ava.blue { background: var(--blue-bg); color: var(--blue); }
.ci-ava .on-dot {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #37C25D;
  border: 2.5px solid var(--card);
}
.ci-mid {
  flex: 1;
  min-width: 0;
}
.ci-r1 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}
.ci-r1 b {
  font-size: 14px;
  font-weight: 800;
}
.ci-r1 time {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  flex: none;
}
.ci-r2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ci-r2 p {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.unread {
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--lime-d);
  color: #fff;
  font-size: 10.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 6px;
  flex: none;
  animation: heartPop 0.3s var(--spring);
}

/* Chat Room */
.chat-wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(env(safe-area-inset-top, 16px) + 12px) 14px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  flex: none;
  z-index: 15;
}
.head-btn {
  display: flex;
  gap: 10px;
  align-items: center;
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  padding: 4px 6px;
  border-radius: 13px;
  transition: 0.2s;
}
.head-btn:hover {
  background: var(--lime-bg);
}
.head-btn:active {
  transform: scale(0.98);
}
.chat-head .ci-ava {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-size: 15px;
}
.chat-head-info {
  flex: 1;
  min-width: 0;
}
.chat-head b {
  font-size: 14.5px;
  font-weight: 800;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-head small {
  font-size: 11px;
  color: var(--lime-d);
  font-weight: 700;
}
.chat-head small.off {
  color: var(--muted);
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  min-height: 0;
}
.chat-body::-webkit-scrollbar {
  display: none;
}
.msg {
  max-width: 82%;
  padding: 8px 12px 6px 14px;
  border-radius: 18px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  opacity: 0;
  animation: msgIn 0.25s var(--ease) forwards;
  position: relative;
  cursor: pointer;
  word-break: break-word;
  transition: background 0.2s, transform 0.15s;
  display: flex;
  flex-direction: column;
}
.msg:active {
  transform: scale(0.98);
}
.msg.in {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.msg.out {
  background: var(--ink);
  color: #F2F6EC;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.45;
  font-size: 13.5px;
}
.msg-meta-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 3px;
}
.msg-author {
  font-size: 11px;
  font-weight: 800;
  color: var(--lime-d);
  margin-bottom: 2px;
  display: block;
}
.msg-meta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  opacity: 0.8;
  line-height: 1;
  user-select: none;
}
.msg.voice .msg-meta, .msg.photo .msg-meta {
  margin-top: 4px;
  margin-left: auto;
  float: right;
}
.msg-status {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -1.5px;
  display: inline-block;
  color: rgba(246, 243, 234, 0.55);
}
.msg.in .msg-status {
  color: var(--muted);
}
.msg-status.read {
  color: var(--lime);
}
.msg.in .msg-status.read {
  color: var(--lime-d);
}
.msg-status.pending {
  color: var(--lime);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
}
.msg-status.pending svg {
  width: 10px;
  height: 10px;
  animation: spinPending 0.85s linear infinite;
}
@keyframes spinPending {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.msg time {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
}

.msg-quote {
  background: rgba(0,0,0,0.06);
  border-left: 3px solid var(--lime);
  padding: 4px 8px;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 11.5px;
  opacity: 0.85;
}
.msg.out .msg-quote {
  background: rgba(255,255,255,0.12);
  border-left-color: var(--lime);
}

/* Reactions on Messages */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.rx-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: 0.2s;
}
.msg.out .rx-chip {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}
.rx-chip:hover {
  transform: scale(1.08);
}
.rx-chip.my-rx {
  border-color: var(--lime);
}

/* Proper Photo in Chat without clipping or distortion */
.msg.photo {
  padding: 5px;
  position: relative;
  border-radius: 18px;
  background: #0D160E;
  max-width: min(300px, 80vw);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: visible;
}
.msg.photo img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  border-radius: 14px;
  display: block;
  cursor: pointer;
  transition: transform 0.25s var(--ease);
}
.msg.photo img:hover {
  transform: scale(1.02);
}
.msg-caption {
  padding: 8px 6px 4px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: #EFF4E8;
  white-space: pre-wrap;
  word-break: break-word;
}
.msg.in .msg-caption {
  color: var(--ink);
}
.mo-del-btn {
  margin-left: auto;
  border: 0;
  background: none;
  font-size: 15px;
  cursor: pointer;
  opacity: 0.65;
  transition: 0.2s;
  padding: 4px;
}
.mo-del-btn:hover {
  opacity: 1;
  transform: scale(1.2);
}
.msg.photo time {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 10px;
  margin-left: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.msg.photo.has-caption time {
  position: static;
  background: none;
  backdrop-filter: none;
  padding: 0;
  display: inline-block;
  float: right;
  margin-top: 4px;
}

/* Voice Message Waveform Player */
.msg.voice {
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: min(320px, 80vw);
  padding: 8px 12px 6px;
}
.voice-player-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
}
.v-play {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--lime);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: 0.2s;
}
.msg.in .v-play {
  background: var(--lime-bg);
}
.v-play svg {
  width: 14px;
  height: 14px;
  fill: var(--ink);
}
.v-bars {
  display: flex;
  gap: 2.5px;
  align-items: center;
  height: 26px;
  flex: 1;
  cursor: pointer;
  padding: 2px 0;
}
.v-bars span {
  width: 3px;
  min-height: 4px;
  border-radius: 2px;
  background: currentColor;
  opacity: 0.35;
  transition: background 0.15s, opacity 0.15s;
}
.v-bars span.active {
  opacity: 1;
  background: var(--lime-d);
}
.msg.out .v-bars span.active {
  background: var(--lime);
}
.msg.playing .v-bars span.active {
  transform: scaleY(1.1);
}
.v-dur {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--muted);
  min-width: 32px;
  text-align: right;
}
.msg.out .v-dur {
  color: rgba(246, 243, 234, 0.65);
}

/* Attached Photo Preview Banner */
.attach-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 8px 14px;
  flex: none;
}
.attach-preview img {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex: none;
}
.ap-info {
  flex: 1;
  min-width: 0;
}
.ap-info b {
  font-size: 12.5px;
  display: block;
}
.ap-info p {
  font-size: 11px;
  color: var(--muted);
}
.ap-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(15,29,21,0.06);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}

/* Rich Telegram-like Emoji Drawer */
.emoji-drawer {
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  flex: none;
}
.ed-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 8px;
}
.ed-tabs::-webkit-scrollbar {
  display: none;
}
.ed-tab {
  flex: none;
  border: 0;
  background: var(--paper);
  padding: 6px 12px;
  border-radius: 100px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  color: var(--muted);
}
.ed-tab.active {
  background: var(--lime);
  color: var(--ink);
}
.ed-content {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: none;
}
.ed-content::-webkit-scrollbar {
  display: none;
}
.ed-emoji {
  border: 0;
  background: none;
  font-size: 24px;
  cursor: pointer;
  padding: 6px 0;
  border-radius: 10px;
  transition: transform 0.15s, background 0.15s;
  display: grid;
  place-items: center;
}
.ed-emoji:hover {
  background: var(--paper);
  transform: scale(1.25);
}
.ed-emoji:active {
  transform: scale(0.9);
}
@keyframes slideInRight {
  0% { transform: translateX(35px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}
@keyframes slideInLeft {
  0% { transform: translateX(-35px); opacity: 0; }
  100% { transform: translateX(0); opacity: 1; }
}

/* Reply Preview Banner */
.reply-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 8px 14px;
  flex: none;
}
.rp-border {
  width: 3px;
  height: 28px;
  background: var(--lime-d);
  border-radius: 2px;
  flex: none;
}
.rp-info {
  flex: 1;
  min-width: 0;
}
.rp-info b {
  font-size: 12px;
  color: var(--lime-d);
  display: block;
}
.rp-info p {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rp-close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: rgba(15,29,21,0.06);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  flex: none;
}

.qreplies {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--paper);
  flex: none;
  border-top: 1px solid var(--line);
  transition: max-height 0.25s, opacity 0.25s;
}
.qreplies::-webkit-scrollbar {
  display: none;
}
.qreplies.hidden {
  display: none !important;
}
.qr {
  flex: none;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 100px;
  padding: 7px 13px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: 0.2s;
  color: var(--ink-soft);
}
.qr:hover {
  border-color: var(--lime-d);
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 10px 14px calc(env(safe-area-inset-bottom, 12px) + 12px);
  background: var(--paper);
  border-top: 1px solid var(--line);
  align-items: flex-end;
  flex: none;
  position: relative;
  z-index: 10;
}
.chat-input textarea {
  flex: 1;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 20px;
  padding: 11px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  outline: none;
  transition: border-color 0.2s;
  min-width: 0;
  color: var(--ink);
  resize: none;
  line-height: 1.4;
  max-height: 140px;
  min-height: 44px;
  height: 44px;
  overflow-y: auto;
  scrollbar-width: none;
}
.chat-input textarea::-webkit-scrollbar {
  display: none;
}
.chat-input textarea:focus {
  border-color: var(--lime-d);
}
.in-ico {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
  transition: 0.2s;
}
.in-ico:hover {
  background: var(--paper);
}
.in-ico:active {
  transform: scale(0.92);
}
.in-ico svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}
.in-ico.recording {
  background: var(--red);
  border-color: var(--red);
}
.in-ico.recording svg {
  stroke: #fff;
  animation: pulse 1s infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--lime);
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  flex: none;
  animation: heartPop 0.25s var(--spring);
}
.chat-send:hover {
  filter: brightness(1.05);
}
.chat-send:active {
  transform: scale(0.9);
}
.chat-send svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink);
  stroke-width: 2.2;
  fill: none;
}

/* Quick Reaction Bar in Message Action Sheet */
.reactions-bar {
  display: flex;
  justify-content: space-around;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.rx-btn {
  border: 0;
  background: none;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 12px;
  transition: transform 0.2s var(--spring);
}
.rx-btn:hover {
  transform: scale(1.3);
}
.rx-btn:active {
  transform: scale(0.9);
}

/* Calls list */
.call-item {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 9px;
  transition: box-shadow 0.25s, transform 0.2s;
}
.call-ico {
  width: 44px;
  height: 44px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  flex: none;
}
.call-ico svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
  fill: none;
}
.call-ico.audio { background: var(--lime-bg); }
.call-ico.audio svg { stroke: var(--forest); }
.call-ico.video { background: var(--blue-bg); }
.call-ico.video svg { stroke: var(--blue); }
.call-ico.missed { background: #FFEEE5; }
.call-ico.missed svg { stroke: var(--orange); }
.cl-mid {
  flex: 1;
  min-width: 0;
}
.cl-mid b {
  font-size: 14px;
  font-weight: 800;
  display: block;
}
.cl-mid small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
}
.fab {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  border: 1.5px solid var(--line);
  background: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  flex: none;
}
.fab svg {
  width: 16px;
  height: 16px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}
.fab:hover {
  background: var(--lime);
  border-color: var(--lime);
}
.fab:active {
  transform: scale(0.92);
}

/* Family Screen */
.circle-card {
  background: var(--forest);
  border-radius: 24px;
  padding: 18px;
  color: #EFF4E8;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.25s;
}
.circle-card:hover {
  box-shadow: 0 12px 28px rgba(19, 59, 42, 0.35);
}
.circle-card::before {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 242, 78, 0.2), transparent 70%);
  right: -60px;
  top: -60px;
}
.cc-avas {
  display: flex;
  flex: none;
}
.cc-avas .mini {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  border: 3px solid var(--forest);
  margin-left: -11px;
  font-size: 14px;
}
.cc-avas .mini:first-child {
  margin-left: 0;
}
.circle-card b {
  font-size: 14px;
  display: block;
}
.circle-card small {
  font-size: 11px;
  color: #9AB3A0;
  font-weight: 600;
}
.cc-go {
  margin-left: auto;
  font-size: 18px;
  color: #9AB3A0;
}

.bday-banner {
  background: var(--lime);
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 6px;
  cursor: pointer;
  transition: box-shadow 0.25s;
}
.bday-banner:hover {
  box-shadow: 0 10px 24px rgba(201, 242, 78, 0.3);
}
.bb-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(15, 29, 21, 0.1);
  display: grid;
  place-items: center;
  flex: none;
}
.bb-icon svg {
  width: 20px;
  height: 20px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}
.bb-info {
  flex: 1;
  min-width: 0;
}
.bb-info b {
  font-size: 13.5px;
  font-weight: 800;
  display: block;
}
.bb-info small {
  font-size: 11px;
  color: rgba(15, 29, 21, 0.7);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.bb-go {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
}
.bb-go svg {
  width: 16px;
  height: 16px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
}

.act-row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin-bottom: 9px;
  cursor: pointer;
  transition: box-shadow 0.25s;
}
.act-row:hover {
  box-shadow: 0 8px 20px rgba(15, 29, 21, 0.08);
}
.act-row:active {
  background: var(--lime-bg);
}
.act-txt {
  flex: 1;
  min-width: 0;
}
.act-txt b {
  font-size: 13px;
  font-weight: 700;
  display: block;
  line-height: 1.35;
}
.act-txt small {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

/* Natural Moment Card (Uncropped, auto aspect ratio) */
.moment-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 18px;
  box-shadow: 0 4px 16px rgba(15,29,21,0.04);
  transition: transform 0.2s, box-shadow 0.2s;
}
.moment-card:hover {
  box-shadow: 0 10px 28px rgba(15,29,21,0.08);
}
.mo-head {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 12px 16px;
}
.mo-head .ci-ava {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  font-size: 15px;
}
.mo-head b {
  font-size: 13.5px;
  font-weight: 800;
  display: block;
}
.mo-head small {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.mo-img-wrap {
  position: relative;
  width: 100%;
  max-height: 520px;
  background: #081109;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}
.mo-img {
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
  display: block;
  transition: transform 0.35s var(--ease);
}
.mo-img-wrap:hover .mo-img {
  transform: scale(1.02);
}
.mo-badge-7d {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(7, 19, 9, 0.65);
  backdrop-filter: blur(8px);
  color: var(--lime);
  font-size: 10px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 100px;
}
.mo-cap {
  padding: 12px 16px 4px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
}
.mo-act {
  display: flex;
  gap: 18px;
  padding: 10px 16px 14px;
  align-items: center;
}
.like-btn {
  display: flex;
  gap: 6px;
  align-items: center;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--muted);
  transition: color 0.2s;
}
.like-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  transition: transform 0.25s var(--spring), fill 0.2s, stroke 0.2s;
}
.like-btn.liked {
  color: var(--orange);
}
.like-btn.liked svg {
  fill: var(--orange);
  stroke: var(--orange);
  animation: heartPop 0.4s var(--spring);
}
.like-users-btn {
  border: 0;
  background: none;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}
.like-users-btn:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* Contacts Card */
.fam-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  margin-bottom: 11px;
  transition: box-shadow 0.25s, transform 0.2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fam-item:hover {
  box-shadow: 0 10px 24px rgba(15, 29, 21, 0.08);
}
.fam-top-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}
.fam-item .ci-ava {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  font-size: 18px;
  flex: none;
}
.fam-info-col {
  flex: 1;
  min-width: 0;
}
.fam-name {
  font-size: 15.5px;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
}
.fam-role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--forest);
  background: var(--lime-bg);
  padding: 2px 8px;
  border-radius: 6px;
  margin-top: 3px;
}
.fam-status-txt {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-top: 4px;
  line-height: 1.35;
}
.fam-seen-txt {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  margin-top: 2px;
}
.fam-seen-txt.on {
  color: var(--lime-d);
}
.fam-actions-row {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.fam-act-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: 0.2s;
}
.fam-act-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.fam-act-btn:hover {
  background: var(--lime-bg);
  border-color: var(--lime-d);
}
.fam-act-btn.lime {
  background: var(--lime);
  border-color: var(--lime);
  color: var(--ink);
}
.fam-act-btn.del {
  flex: none;
  width: 36px;
  padding: 0;
  color: var(--muted);
}
.fam-act-btn.del:hover {
  background: rgba(229, 72, 77, 0.1);
  border-color: var(--red);
  color: var(--red);
}

/* Profile */
.pf-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.pf-ava {
  width: 70px;
  height: 70px;
  border-radius: 24px;
  background: var(--forest);
  color: var(--lime);
  display: grid;
  place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 24px;
  font-weight: 600;
  position: relative;
}
.pf-ava::after {
  content: '✦';
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  display: grid;
  place-items: center;
  border: 2.5px solid var(--paper);
}
.pf-head h2 {
  font-family: 'Unbounded', sans-serif;
  font-size: 20px;
  font-weight: 600;
}
.pf-head p {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 3px;
}
.pf-menu {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 16px;
}
.pf-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--line);
}
.pf-item:last-child {
  border-bottom: 0;
}
.pf-item:hover {
  background: var(--paper);
}
.pf-item svg {
  width: 18px;
  height: 18px;
  stroke: var(--ink-soft);
  stroke-width: 2;
  fill: none;
  flex: none;
}
.pf-val {
  margin-left: auto;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
}
.pf-ver {
  text-align: center;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* Bottom Tab Bar with Central Heart Button */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: #FFFFFF;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr 78px 1fr 1fr;
  padding: 8px 10px calc(env(safe-area-inset-bottom, 12px) + 8px);
  align-items: end;
  transition: transform 0.25s var(--ease);
}
.pscreen.in-room .tabbar {
  display: none !important;
}
.tab {
  border: 0;
  background: none;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: #9AA79B;
  padding: 6px 0;
  transition: color 0.25s;
  position: relative;
}
.iwrap {
  position: relative;
  line-height: 0;
}
.tab svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.tab span {
  font-size: 10px;
  font-weight: 800;
}
.tab.on {
  color: var(--ink);
}
.tab.on span::after {
  content: '';
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--lime-d);
  margin: 3px auto 0;
}
.tbadge {
  position: absolute;
  top: -6px;
  right: -9px;
  min-width: 17px;
  height: 17px;
  border-radius: 9px;
  background: var(--orange);
  color: #fff;
  font-size: 9.5px;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #fff;
}
.tab-fam {
  align-self: center;
  justify-self: center;
  width: 58px;
  height: 58px;
  border-radius: 20px;
  background: var(--lime);
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(201, 242, 78, 0.45), 0 0 0 5px #FFFFFF;
  transition: transform 0.25s var(--spring);
}
.tab-fam svg {
  width: 26px;
  height: 26px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: var(--ink);
}
.tab-fam:hover {
  transform: scale(1.06);
}
.tab-fam:active {
  transform: scale(0.92);
}

/* Skeleton Loading Shimmer for Progressive Chat Loading */
@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.msg.skeleton {
  background: var(--card);
  border: 1px solid var(--line);
  min-width: 130px;
  max-width: 220px;
  pointer-events: none;
  animation: cardIn 0.3s ease;
}
.msg.skeleton.out {
  background: rgba(201, 242, 78, 0.15);
  border-color: rgba(201, 242, 78, 0.3);
}
.sk-line {
  height: 10px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(0,0,0,0.05) 25%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0.05) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.4s infinite;
  margin-bottom: 6px;
}
.msg.skeleton.out .sk-line {
  background: linear-gradient(90deg, rgba(19, 59, 42, 0.08) 25%, rgba(19, 59, 42, 0.16) 50%, rgba(19, 59, 42, 0.08) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.4s infinite;
}
.sk-line.short {
  width: 55%;
  margin-bottom: 0;
}
.msg.photo-ghost {
  min-height: 150px;
  background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.09) 50%, rgba(0,0,0,0.04) 75%);
  background-size: 200px 100%;
  animation: shimmer 1.4s infinite;
  display: grid;
  place-items: center;
  border-radius: 14px;
}

/* Sheets & Modals */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 18, 13, 0.45);
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 48;
}
.pscreen.any-sheet .sheet-backdrop {
  display: block;
  opacity: 1;
  pointer-events: auto;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--paper);
  border-radius: 28px 28px 0 0;
  z-index: 50;
  max-height: 90%;
  display: none;
  flex-direction: column;
  box-shadow: 0 -12px 35px rgba(0,0,0,0.14);
}
.sheet.open {
  display: flex;
  animation: sheetSlideUp 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes sheetSlideUp {
  0% { transform: translateY(100%); }
  100% { transform: translateY(0); }
}
.sheet-grab {
  width: 44px;
  height: 5px;
  border-radius: 5px;
  background: rgba(15, 29, 21, 0.15);
  margin: 12px auto 0;
  flex: none;
}
.sheet-head {
  padding: 14px 22px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: none;
}
.sheet-head h3 {
  font-family: 'Unbounded', sans-serif;
  font-size: 16px;
  font-weight: 600;
}
.sheet-close {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 0;
  background: rgba(15, 29, 21, 0.07);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.2s;
}
.sheet-close:hover {
  background: rgba(15, 29, 21, 0.14);
}
.sheet-close svg {
  width: 15px;
  height: 15px;
  stroke: var(--ink);
  stroke-width: 2.4;
  fill: none;
}
.sheet-body {
  padding: 12px 22px calc(env(safe-area-inset-bottom, 16px) + 30px);
  overflow-y: auto;
  scrollbar-width: none;
}
.sheet-body::-webkit-scrollbar {
  display: none;
}
.cs-input {
  width: 100%;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  padding: 14px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  outline: none;
  transition: 0.25s;
  margin-bottom: 12px;
  color: var(--ink);
}
.cs-input:focus {
  border-color: var(--lime-d);
  box-shadow: 0 0 0 4px rgba(201, 242, 78, 0.2);
}
.chat-input input:focus {
  border-color: var(--lime-d);
  box-shadow: 0 0 0 4px rgba(201, 242, 78, 0.2);
}

/* Telegram-like Voice Recording Panel */
.voice-record-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(env(safe-area-inset-bottom, 12px) + 8px);
  height: 52px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1.5px solid var(--lime-d);
  border-radius: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 25;
  box-shadow: 0 10px 30px rgba(18, 59, 42, 0.18);
  animation: cardIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.vr-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vr-red-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 10px rgba(229, 72, 77, 0.6);
  animation: pulseDot 0.85s infinite alternate ease-in-out;
}
@keyframes pulseDot {
  from { opacity: 0.35; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1.25); }
}
.vr-timer {
  font-family: 'Unbounded', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.02em;
}
.vr-slide-cancel {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  transition: transform 0.1s ease-out;
  user-select: none;
}
.vr-slide-cancel svg {
  width: 16px;
  height: 16px;
  stroke: var(--muted);
  stroke-width: 2.5;
  fill: none;
  animation: slideLeftHint 1.2s infinite ease-in-out;
}
@keyframes slideLeftHint {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-5px); }
}
.vr-lock-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  user-select: none;
}
.vr-lock-hint svg {
  width: 14px;
  height: 14px;
  stroke: var(--muted);
  stroke-width: 2;
  fill: none;
}
.vr-locked-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.vr-cancel-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(229, 72, 77, 0.14);
  color: var(--red);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
}
.vr-cancel-btn:hover {
  background: rgba(229, 72, 77, 0.24);
  transform: scale(1.05);
}
.vr-cancel-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.vr-send-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  box-shadow: 0 4px 14px rgba(201, 242, 78, 0.5);
}
.vr-send-btn:hover {
  transform: scale(1.1);
}
.vr-send-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2.2;
  fill: none;
}
#voiceRecordBtn.recording {
  background: var(--red) !important;
  color: #fff !important;
  transform: scale(1.18);
  box-shadow: 0 0 0 5px rgba(229, 72, 77, 0.3);
}
#voiceRecordBtn.recording svg {
  stroke: #fff !important;
}

/* Quick Action Grid inside Quick Family Sheet (B&W Icons) */
.quick-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}
.qa-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  cursor: pointer;
  transition: 0.2s var(--ease);
}
.qa-card:hover {
  box-shadow: 0 8px 20px rgba(15, 29, 21, 0.08);
  border-color: var(--lime-d);
}
.qa-card:active {
  transform: scale(0.96);
  background: var(--lime-bg);
}
.qa-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--lime-bg);
  color: var(--forest);
  display: grid;
  place-items: center;
}
.qa-icon svg {
  width: 24px;
  height: 24px;
  stroke: var(--forest);
  stroke-width: 2;
  fill: none;
}
.qa-card b {
  font-family: 'Unbounded', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
}
.qa-card small {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 600;
}

/* Status Preset Chips in Status Sheet */
.status-presets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.st-preset-btn {
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: 14px;
  padding: 11px 12px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: 0.2s;
  text-align: left;
}
.st-preset-btn:hover {
  background: var(--lime-bg);
  border-color: var(--lime-d);
}
.st-preset-btn:active {
  transform: scale(0.97);
}

/* Message Context Menu Actions */
.msg-action-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
}
.msg-action-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
  color: var(--ink);
  text-align: left;
}
.msg-action-item:hover {
  background: var(--paper);
  border-color: var(--lime-d);
}
.msg-action-item:active {
  transform: scale(0.98);
}
.msg-action-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--ink);
  stroke-width: 2;
  fill: none;
  flex: none;
}
.msg-action-item.danger {
  color: var(--red);
}
.msg-action-item.danger svg {
  stroke: var(--red);
}

/* Partner / Group Profile Sheet */
.pps-hero {
  text-align: center;
  padding: 10px 0 18px;
}
.pps-ava {
  width: 72px;
  height: 72px;
  border-radius: 26px;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 26px;
  font-weight: 800;
  margin: 0 auto 10px;
}
.pps-hero h2 {
  font-family: 'Unbounded', sans-serif;
  font-size: 18px;
  font-weight: 600;
}
.pps-hero p {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}
.pps-tabs {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 3px;
  margin-bottom: 14px;
}
.pps-tab {
  flex: 1;
  border: 0;
  background: none;
  font-family: 'Unbounded', sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 11px;
  cursor: pointer;
  transition: 0.2s;
  color: var(--muted);
}
.pps-tab.active {
  background: var(--lime);
  color: var(--ink);
}
.pps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.pps-thumb {
  aspect-ratio: 1/1;
  border-radius: 12px;
  object-fit: cover;
  width: 100%;
  cursor: pointer;
  transition: transform 0.2s;
}
.pps-thumb:hover {
  transform: scale(1.05);
}
.pps-stats-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pps-stat-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: 13px;
  font-weight: 700;
}
.pps-stat-item span {
  color: var(--muted);
}
.pps-stat-item b {
  color: var(--ink);
}

/* Interactive Lightbox with Zoom & Pan */
.lightbox {
  position: absolute;
  inset: 0;
  z-index: 95;
  background: rgba(5, 14, 7, 0.96);
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
  user-select: none;
  touch-action: none;
}
.lightbox.show {
  opacity: 1;
  pointer-events: auto;
}
.lb-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 16px) + 14px) 18px 12px;
  background: linear-gradient(180deg, rgba(0,0,0,0.7), transparent);
  color: #fff;
}
.lb-hint {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
}
.lb-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.2s;
}
.lb-close:hover {
  background: rgba(255,255,255,0.3);
}
.lb-canvas {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  cursor: grab;
}
.lb-canvas.panning {
  cursor: grabbing;
}
.lb-canvas img {
  max-width: 92vw;
  max-height: 80vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  transform-origin: center center;
  transition: transform 0.15s ease-out;
}
.lb-controls {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 16px) + 20px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 35, 24, 0.85);
  backdrop-filter: blur(16px);
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid rgba(255,255,255,0.15);
}
.lb-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: 0.2s;
}
.lb-btn:hover {
  background: rgba(255,255,255,0.25);
}
.lb-scale {
  color: var(--lime);
  font-size: 11px;
  font-weight: 800;
  min-width: 44px;
  text-align: center;
}

/* Incoming Call */
.call-in {
  position: absolute;
  inset: 0;
  z-index: 90;
  background: radial-gradient(circle at 50% 30%, #174834 0%, #071309 100%);
  display: none;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.call-in.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
.ci-inner {
  margin: auto;
  text-align: center;
  color: #EFF4E8;
  padding: 40px 24px calc(env(safe-area-inset-bottom, 20px) + 30px);
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.ci-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(201, 242, 78, 0.16);
  border: 1px solid rgba(201, 242, 78, 0.35);
  backdrop-filter: blur(10px);
  color: var(--lime);
  padding: 8px 18px;
  border-radius: 100px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 36px;
  box-shadow: 0 0 25px rgba(201, 242, 78, 0.2);
}
.ci-big-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  margin: 0 auto 24px;
  display: grid;
  place-items: center;
}
.ci-big {
  width: 120px;
  height: 120px;
  border-radius: 44px;
  display: grid;
  place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 46px;
  background: var(--lime);
  color: var(--ink);
  position: relative;
  z-index: 2;
  box-shadow: 0 12px 35px rgba(0,0,0,0.5);
}
.ci-ring-pulse {
  position: absolute;
  inset: -14px;
  border-radius: 56px;
  border: 2px solid var(--lime);
  opacity: 0.5;
  animation: ciPulse 2.2s infinite ease-out;
  z-index: 1;
}
@keyframes ciPulse {
  0% { transform: scale(0.88); opacity: 0.8; }
  50% { opacity: 0.4; }
  100% { transform: scale(1.45); opacity: 0; }
}
.ci-inner h2 {
  font-family: 'Unbounded', sans-serif;
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.ci-inner p {
  font-size: 14px;
  color: #A4BEAC;
  font-weight: 600;
}
.ci-actions {
  display: flex;
  gap: 46px;
  justify-content: center;
  margin-top: 52px;
}
.ci-btn-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.ci-btn {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.25s var(--spring), box-shadow 0.25s;
}
.ci-btn.accept {
  background: var(--lime);
  box-shadow: 0 10px 28px rgba(201, 242, 78, 0.45);
}
.ci-btn.accept svg {
  width: 28px;
  height: 28px;
  stroke: var(--ink);
  stroke-width: 2.2;
  fill: none;
}
.ci-btn.decline {
  background: var(--red);
  box-shadow: 0 10px 28px rgba(229, 72, 77, 0.45);
}
.ci-btn.decline svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
  stroke-width: 2.2;
  fill: none;
}
.ci-btn:hover {
  transform: scale(1.08);
}
.ci-btn:active {
  transform: scale(0.93);
}
.ci-btn-label {
  font-size: 12.5px;
  font-weight: 800;
  color: #EFF4E8;
  letter-spacing: 0.02em;
}

/* Active Call Overlay */
.call-ov {
  position: absolute;
  inset: 0;
  z-index: 86;
  background: #0B1F16;
  display: none;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s;
}
.call-ov.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
.call-audio {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(env(safe-area-inset-top, 20px) + 40px) 26px calc(env(safe-area-inset-bottom, 20px) + 30px);
  color: #EFF4E8;
}
.co-chip {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  background: rgba(201, 242, 78, 0.12);
  color: var(--lime);
  padding: 6px 12px;
  border-radius: 100px;
  border: 1px solid rgba(201, 242, 78, 0.3);
}
.co-ava-wrap {
  position: relative;
  margin: 40px 0 20px;
}
.co-ava {
  width: 118px;
  height: 118px;
  border-radius: 40px;
  background: var(--lime);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-family: 'Unbounded', sans-serif;
  font-size: 42px;
}
#coName {
  font-family: 'Unbounded', sans-serif;
  font-size: 20px;
  font-weight: 600;
}
#coStatus {
  color: #9AB3A0;
  font-size: 13px;
  font-weight: 600;
  margin-top: 7px;
}
.co-eq {
  display: none;
  gap: 4px;
  align-items: center;
  height: 22px;
  margin-top: 14px;
}
.co-eq.live {
  display: flex;
}
.co-eq span {
  width: 4px;
  border-radius: 3px;
  background: var(--lime);
  height: 8px;
  animation: eqb 0.9s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * 0.09s);
}
@keyframes eqb {
  from { transform: scaleY(0.5); }
  to { transform: scaleY(2.4); }
}
.co-ctrl {
  margin-top: auto;
  display: flex;
  gap: 14px;
}
.co-btn {
  width: 58px;
  height: 58px;
  border-radius: 19px;
  border: 0;
  background: rgba(255, 255, 255, 0.1);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: 0.2s;
  color: #EFF4E8;
}
.co-btn svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}
.co-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}
.co-btn:active {
  transform: scale(0.92);
}
.co-btn.on {
  background: var(--lime);
  color: var(--ink);
}
.co-btn.end {
  background: var(--red);
  color: #fff;
  width: 66px;
  border-radius: 50%;
}

/* Video Call */
.call-video {
  position: absolute;
  inset: 0;
  display: none;
}
.call-ov.video .call-video {
  display: block;
}
.call-ov.video .call-audio {
  display: none;
}
#cvRemote {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}
.cv-pip {
  position: absolute;
  top: calc(env(safe-area-inset-top, 20px) + 60px);
  right: 16px;
  width: 106px;
  height: 146px;
  border-radius: 18px;
  background: #000;
  border: 2px solid rgba(255,255,255,0.4);
  display: grid;
  place-items: center;
  z-index: 3;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.55);
  cursor: pointer;
  touch-action: none;
}
.cv-pip video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cv-pip.cam-off video {
  display: none;
}
.cv-pip.cam-off::after {
  content: '📵';
  font-size: 24px;
}
.cv-poster {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: none;
  place-items: center;
  background: linear-gradient(180deg, #123B2A, #071309);
  text-align: center;
  color: #EFF4E8;
}
.call-video.cam-off #cvRemote, .call-video.poster-only #cvRemote {
  display: none;
}
.call-video.cam-off .cv-poster, .call-video.poster-only .cv-poster {
  display: grid;
  z-index: 1;
}
.cv-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: calc(env(safe-area-inset-top, 20px) + 16px) 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, rgba(7,19,9,0.8), transparent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}
.cv-timer {
  font-size: 11px;
  background: rgba(0,0,0,0.45);
  padding: 6px 11px;
  border-radius: 100px;
  font-weight: 800;
}
.call-ov.video .co-ctrl {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 24px);
  left: 0;
  right: 0;
  z-index: 6;
  justify-content: center;
  margin: 0;
  gap: 14px;
}

/* Authentication Screen */
.auth-screen {
  position: absolute;
  inset: 0;
  z-index: 65;
  background: var(--paper);
  display: none;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 20px) + 40px) 24px 30px;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}
.auth-screen.active {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}
.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}
.auth-logo-badge {
  width: 68px;
  height: 68px;
  border-radius: 24px;
  background: var(--forest);
  color: var(--lime);
  font-size: 30px;
  font-family: 'Unbounded', sans-serif;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  box-shadow: 0 10px 24px rgba(19,59,42,0.25);
}
.auth-logo h1 {
  font-family: 'Unbounded', sans-serif;
  font-size: 24px;
  font-weight: 600;
  color: var(--ink);
}
.auth-logo p {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 5px;
}
.auth-tabs {
  display: flex;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 22px;
}
.auth-tab {
  flex: 1;
  border: 0;
  background: none;
  font-family: 'Unbounded', sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 11px 0;
  border-radius: 12px;
  cursor: pointer;
  transition: 0.2s;
  color: var(--muted);
}
.auth-tab.active {
  background: var(--lime);
  color: var(--ink);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Toast */
.toast {
  position: absolute;
  bottom: calc(env(safe-area-inset-bottom, 20px) + 90px);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink);
  color: #F2F6EC;
  font-size: 12.5px;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 100px;
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: 0.3s var(--spring);
  white-space: nowrap;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 14px 30px rgba(0,0,0,0.25);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Color Presets & Role Pills in Edit Profile */
.color-presets-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 10px;
  scrollbar-width: none;
}
.color-presets-row::-webkit-scrollbar {
  display: none;
}
.cp-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  flex: none;
  transition: transform 0.2s var(--spring), border-color 0.2s;
}
.cp-circle:hover {
  transform: scale(1.15);
}
.cp-circle.active {
  border-color: var(--ink);
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.role-quick-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.rq-pill {
  padding: 6px 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s;
}
.rq-pill:hover {
  background: var(--lime-bg);
  border-color: var(--lime-d);
}
.rq-pill:active {
  transform: scale(0.95);
}

.co-btn.off {
  background: var(--red) !important;
  color: #fff !important;
}

