:root {
  --ink: #101828;
  --muted: #667085;
  --line: #d8e0ea;
  --panel: rgba(255, 255, 255, 0.86);
  --panel-strong: #ffffff;
  --cyan: #00a7c7;
  --green: #15b97a;
  --blue: #2563eb;
  --coral: #ff6b5f;
  --yellow: #f4b740;
  --shadow: 0 24px 70px rgba(16, 24, 40, 0.14);
  --shell-gap: 18px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% 10%, rgba(0, 167, 199, 0.24), transparent 30rem),
    radial-gradient(circle at 86% 18%, rgba(37, 99, 235, 0.18), transparent 28rem),
    radial-gradient(circle at 80% 88%, rgba(255, 107, 95, 0.15), transparent 26rem),
    linear-gradient(135deg, #f8fbff 0%, #eef6f7 45%, #f9fbf4 100%);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
input,
label,
select,
textarea {
  touch-action: manipulation;
}

.app-shell {
  width: min(1440px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(14px, 2vw, 24px);
}

.hidden {
  display: none !important;
}

.auth-screen {
  height: calc(100vh - 48px);
  min-height: 640px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(370px, 480px);
  gap: 0;
  align-items: stretch;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(241, 250, 249, 0.84)),
    linear-gradient(90deg, rgba(16, 24, 40, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 24, 40, 0.04) 1px, transparent 1px);
  background-size: auto, 42px 42px, 42px 42px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brand-panel,
.login-card,
.sidebar,
.conversation {
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brand-panel {
  min-height: 640px;
  padding: clamp(24px, 3.2vw, 46px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background:
    radial-gradient(circle at 50% 19%, rgba(0, 168, 132, 0.16), transparent 18rem),
    radial-gradient(circle at 14% 78%, rgba(37, 99, 235, 0.1), transparent 17rem),
    linear-gradient(rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.36)),
    linear-gradient(90deg, rgba(16, 24, 40, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 24, 40, 0.045) 1px, transparent 1px);
  background-size: auto, auto, auto, 48px 48px, 48px 48px;
}

.brand-panel::after {
  content: "";
  position: absolute;
  inset: auto 7% 7% auto;
  width: 260px;
  height: 260px;
  border: 1px solid rgba(0, 167, 199, 0.28);
  transform: rotate(18deg);
  opacity: 0.72;
}

.signal-card {
  width: min(330px, 40vw);
  aspect-ratio: 1;
  margin-bottom: clamp(14px, 2.2vw, 22px);
  position: relative;
  display: grid;
  place-items: center;
}

.ai-grid {
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  background:
    linear-gradient(90deg, rgba(0, 167, 199, 0.1) 1px, transparent 1px),
    linear-gradient(0deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle, black 38%, transparent 72%);
  opacity: 0.9;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(37, 99, 235, 0.22);
  border-radius: 50%;
}

.orbit-one {
  width: 94%;
  height: 94%;
}

.orbit-two {
  width: 68%;
  height: 68%;
  border-color: rgba(21, 185, 122, 0.26);
}

.orbit-three {
  width: 46%;
  height: 46%;
  border-color: rgba(255, 107, 95, 0.22);
  transform: rotate(32deg) scaleX(1.52);
}

.pulse-node {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 9px rgba(255, 107, 95, 0.15);
}

.node-a {
  top: 16%;
  right: 22%;
}

.node-b {
  bottom: 22%;
  left: 10%;
  background: var(--green);
  box-shadow: 0 0 0 9px rgba(21, 185, 122, 0.15);
}

.node-c {
  right: 8%;
  bottom: 33%;
  background: var(--yellow);
  box-shadow: 0 0 0 9px rgba(244, 183, 64, 0.18);
}

.node-d {
  top: 42%;
  left: 7%;
  background: var(--blue);
  box-shadow: 0 0 0 9px rgba(37, 99, 235, 0.14);
}

.ai-core {
  width: 50%;
  min-width: 178px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 28%, rgba(255, 255, 255, 0.3), transparent 17%),
    radial-gradient(circle at 50% 50%, rgba(0, 230, 190, 0.38), transparent 33%),
    conic-gradient(from 140deg, #08111f, #004c68, #00a884, #2f5bff, #101828, #08111f);
  box-shadow:
    0 30px 70px rgba(16, 24, 40, 0.28),
    0 0 42px rgba(0, 168, 132, 0.32),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.ai-core::before,
.ai-core::after {
  content: "";
  position: absolute;
  inset: 17%;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  pointer-events: none;
}

.ai-core::before {
  transform: rotate(90deg) scaleX(0.38);
}

.ai-core::after {
  transform: rotate(18deg) scaleY(0.38);
}

.core-ring {
  position: absolute;
  inset: 10%;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 50%;
  box-shadow:
    inset 0 0 28px rgba(0, 167, 199, 0.22),
    0 0 34px rgba(0, 168, 132, 0.25);
}

.core-chip {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 25%, rgba(255, 255, 255, 0.55), transparent 24%),
    linear-gradient(135deg, #00e0bd, #00a7c7 44%, #465dff);
  color: white;
  font-size: 1.65rem;
  font-weight: 900;
  box-shadow:
    0 18px 40px rgba(0, 167, 199, 0.36),
    inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.data-line {
  position: absolute;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.88), transparent);
  opacity: 0.52;
}

.line-a {
  width: 70%;
  top: 24%;
}

.line-b {
  width: 58%;
  bottom: 25%;
}

.line-c {
  width: 42%;
  transform: rotate(90deg);
}

.floating-panel {
  position: absolute;
  min-width: 126px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 16px 32px rgba(16, 24, 40, 0.12);
  backdrop-filter: blur(18px);
}

.floating-panel span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.floating-panel strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 1.1rem;
}

.panel-a {
  top: 17%;
  left: 1%;
}

.panel-b {
  right: 0;
  top: 42%;
}

.panel-c {
  left: 13%;
  bottom: 5%;
}

.eyebrow {
  margin: 0 auto 12px;
  color: var(--cyan);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(3rem, 6.2vw, 5.6rem);
  line-height: 0.9;
  letter-spacing: 0;
  max-width: 760px;
  text-align: center;
}

.lead {
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
  color: #344054;
  font-size: clamp(1rem, 1.5vw, 1.16rem);
  line-height: 1.55;
  text-align: center;
}

.trust-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.trust-row span {
  border: 1px solid rgba(16, 24, 40, 0.12);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.62);
  color: #344054;
  font-size: 0.9rem;
  font-weight: 700;
}

.digital-metrics {
  width: min(620px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
  margin-left: auto;
  margin-right: auto;
}

.digital-metrics div {
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.58);
}

.digital-metrics strong,
.digital-metrics span {
  display: block;
}

.digital-metrics strong {
  color: var(--ink);
  font-size: 1.25rem;
}

.digital-metrics span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.login-card {
  align-self: stretch;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: clamp(88px, 12vh, 132px) clamp(30px, 3.4vw, 46px) clamp(30px, 3.4vw, 46px);
  border: 0;
  border-left: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 0;
  position: relative;
  overflow: hidden;
  box-shadow: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 250, 250, 0.88)),
    linear-gradient(90deg, rgba(16, 24, 40, 0.035) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 24, 40, 0.035) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 2px solid rgba(0, 168, 132, 0.42);
  background:
    radial-gradient(circle at 88% 16%, rgba(0, 168, 132, 0.16), transparent 13rem),
    radial-gradient(circle at 8% 92%, rgba(0, 167, 199, 0.12), transparent 14rem);
  background-size: auto;
  pointer-events: none;
}

.login-card::after {
  content: "";
  position: absolute;
  right: 34px;
  bottom: 34px;
  width: 116px;
  height: 116px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(16, 24, 40, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(16, 24, 40, 0.08) 1px, transparent 1px),
    rgba(255, 255, 255, 0.42);
  background-size: 14px 14px;
  opacity: 0.28;
  pointer-events: none;
}

.login-card > * {
  position: relative;
  z-index: 1;
}

.copyright-brand,
.sidebar-copyright {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.copyright-brand {
  width: fit-content;
  margin-top: 16px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.copyright-brand img {
  width: 88px;
  height: 46px;
  object-fit: contain;
}

.login-card h2 {
  margin-bottom: 18px;
  font-size: clamp(1.9rem, 2.8vw, 2.45rem);
  line-height: 1.14;
}

label {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
  color: #344054;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(0, 167, 199, 0.14);
}

.primary-btn,
.secondary-btn,
.send-btn,
.icon-btn,
.tab,
.quick-action {
  border: 0;
}

.primary-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 8px;
  background: #101828;
  color: white;
  font-weight: 800;
}

.primary-btn:hover {
  background: #00a884;
}

.secondary-btn {
  border-radius: 8px;
  padding: 10px 13px;
  background: #e7f8f5;
  color: #08795f;
  font-weight: 800;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 22px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 5px;
  background: rgba(237, 243, 247, 0.78);
}

.auth-tab {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #344054;
  font-size: 0.88rem;
  font-weight: 900;
}

.auth-tab.active {
  background: #101828;
  color: white;
  box-shadow: 0 10px 22px rgba(16, 24, 40, 0.14);
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.otp-panel {
  margin-top: 4px;
}

.otp-demo-code {
  margin-top: -6px;
  border: 1px dashed rgba(0, 167, 199, 0.42);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(231, 248, 245, 0.72);
  color: #08795f;
  font-weight: 900;
}

.auth-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.fine-print {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
}

.chat-app {
  height: calc(100vh - 48px);
  min-height: 680px;
  display: grid;
  grid-template-columns: clamp(320px, 29vw, 390px) minmax(0, 1fr);
  gap: var(--shell-gap);
}

.zalo-shell {
  --zalo-blue: #0a78ff;
  --zalo-blue-dark: #075bcc;
  --zalo-surface: rgba(255, 255, 255, 0.92);
}

.sidebar,
.conversation {
  border-radius: 8px;
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(246, 251, 255, 0.9)),
    linear-gradient(90deg, rgba(10, 120, 255, 0.04) 1px, transparent 1px);
  background-size: auto, 36px 36px;
}

.profile-strip,
.conversation-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(255, 255, 255, 0.72);
}

.zalo-shell .profile-strip {
  background: linear-gradient(135deg, rgba(10, 120, 255, 0.95), rgba(0, 168, 132, 0.9));
  color: white;
}

.zalo-shell .profile-strip span {
  color: rgba(255, 255, 255, 0.78);
}

.zalo-shell .profile-strip .icon-btn {
  background: rgba(255, 255, 255, 0.18);
  color: white;
}

.profile-button,
.profile-strip div:nth-child(2),
.conversation-header > div:not(.avatar):not(.header-actions) {
  min-width: 0;
  flex: 1;
}

.profile-button {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  overflow: hidden;
}

.profile-strip strong,
.conversation-header h2 {
  display: block;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-strip span,
.conversation-header span,
.nearby-tools span {
  color: var(--muted);
  font-size: 0.86rem;
}

.e2ee-status {
  width: fit-content;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(21, 185, 122, 0.1);
  color: #08795f !important;
  font-size: 0.74rem !important;
  font-weight: 900;
}

.e2ee-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #15b97a;
  box-shadow: 0 0 0 4px rgba(21, 185, 122, 0.14);
}

.avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #00a7c7, #15b97a);
  background-size: cover;
  background-position: center;
  color: white;
  font-weight: 900;
  box-shadow: 0 12px 22px rgba(0, 167, 199, 0.22);
}

.avatar-me {
  background: linear-gradient(135deg, #2563eb, #ff6b5f);
  background-size: cover;
  background-position: center;
}

.icon-btn,
.send-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f0f5f8;
  color: #344054;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.icon-btn:hover,
.send-btn:hover,
.tab:hover,
.auth-tab:hover,
.friend-tab:hover {
  transform: translateY(-1px);
}

.icon-btn:disabled,
.send-btn:disabled,
.call-btn:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none;
}

.icon-btn svg,
.send-btn svg,
.search-box svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
}

.search-box input {
  border: 0;
  padding-left: 0;
  box-shadow: none;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 0 16px 14px;
}

.quick-action {
  min-width: 0;
  min-height: 68px;
  display: grid;
  place-items: center;
  gap: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #344054;
  font-size: 0.75rem;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, 0.07);
}

.quick-action svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: var(--zalo-blue);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.quick-action span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 14px;
}

.tab {
  min-height: 42px;
  border-radius: 8px;
  background: #edf3f7;
  color: #344054;
  font-weight: 800;
}

.tab.active {
  background: var(--zalo-blue);
  color: white;
  box-shadow: 0 10px 22px rgba(10, 120, 255, 0.18);
}

.panel-list {
  min-height: 0;
  overflow: auto;
  padding: 0 12px 12px;
  scrollbar-width: thin;
}

.sidebar-copyright {
  flex-direction: column;
  gap: 7px;
  justify-content: center;
  margin: auto 18px 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
  text-align: center;
}

.sidebar-copyright img {
  width: 118px;
  height: 68px;
  object-fit: contain;
}

.sidebar-copyright span {
  white-space: nowrap;
}

.chat-row,
.person-row {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: transparent;
  text-align: left;
  color: inherit;
}

.chat-row.active {
  box-shadow: inset 3px 0 0 var(--cyan);
}

.chat-row:hover,
.chat-row.active,
.person-row:hover {
  background: rgba(255, 255, 255, 0.82);
}

.zalo-shell .chat-row.active {
  box-shadow: inset 4px 0 0 var(--zalo-blue);
}

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

.row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.row-top strong,
.row-main p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-top span,
.distance {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.row-main p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 7px;
  margin: 18px 4px;
  border: 1px dashed rgba(10, 120, 255, 0.24);
  border-radius: 8px;
  padding: 18px 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: center;
}

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

.empty-state span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.conversation .empty-state {
  max-width: 360px;
  margin: auto;
}

.nearby-tools {
  display: grid;
  grid-template-columns: minmax(0, 150px) 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 10px;
  margin: 4px 4px 12px;
  background: rgba(255, 255, 255, 0.8);
}

.journal-composer {
  display: grid;
  gap: 10px;
  margin: 4px 4px 14px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.82);
}

.journal-composer textarea {
  min-height: 92px;
}

.journal-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.journal-tools select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
  font-weight: 700;
}

.media-picker {
  min-height: 42px;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: #e7f8f5;
  color: #08795f;
  font-weight: 900;
}

.media-picker input {
  display: none;
}

.journal-preview,
.journal-media,
.message-media {
  overflow: hidden;
  border-radius: 8px;
}

.journal-preview img,
.journal-media img,
.message-media img,
.message-media video {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
}

.journal-post {
  display: grid;
  gap: 10px;
  margin: 0 4px 10px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.86);
}

.journal-post header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.journal-post header div {
  flex: 1;
  min-width: 0;
}

.journal-post strong,
.journal-post span {
  display: block;
}

.journal-post span,
.journal-empty {
  color: var(--muted);
  font-size: 0.84rem;
}

.journal-post p {
  margin: 0;
  line-height: 1.5;
}

.delete-journal-btn {
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff0f0;
  color: #c0262d;
  font-weight: 900;
}

.journal-empty {
  margin: 8px 4px;
  text-align: center;
}

.conversation {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.conversation-header {
  min-height: 86px;
  display: grid;
  grid-template-columns: auto minmax(0, auto) minmax(0, 1fr) auto;
}

.header-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.message-stage {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: clamp(18px, 2.4vw, 28px);
  background:
    linear-gradient(rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0.58)),
    repeating-linear-gradient(90deg, rgba(16, 24, 40, 0.04) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(16, 24, 40, 0.04) 0 1px, transparent 1px 48px);
}

.message {
  max-width: min(620px, 78%);
  margin-bottom: 14px;
  display: grid;
  gap: 5px;
}

.bubble {
  width: fit-content;
  max-width: 100%;
  border-radius: 18px;
  padding: 12px 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 20px rgba(16, 24, 40, 0.08);
}

.message.them .bubble {
  background: white;
  border-top-left-radius: 6px;
}

.message.me {
  margin-left: auto;
  justify-items: end;
}

.message.me .bubble {
  background: #101828;
  color: white;
  border-top-right-radius: 6px;
}

.message time {
  color: var(--muted);
  font-size: 0.76rem;
}

.message-media {
  max-width: min(360px, 100%);
  box-shadow: 0 10px 20px rgba(16, 24, 40, 0.08);
}

.message.me .message-media {
  justify-self: end;
}

.media-caption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.78rem;
}

.composer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(255, 255, 255, 0.76);
}

.composer input {
  min-width: 0;
  min-height: 46px;
  background: white;
}

.send-btn {
  background: var(--cyan);
  color: white;
}

.call-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.54);
  backdrop-filter: blur(18px);
}

.call-card {
  width: min(430px, 100%);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 8px;
  background: #101828;
  color: white;
  box-shadow: 0 28px 80px rgba(16, 24, 40, 0.36);
}

.call-video-stage {
  min-height: 280px;
  position: relative;
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(16, 24, 40, 0.62), rgba(16, 24, 40, 0.62)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 44px);
}

.local-video {
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
}

.remote-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.call-avatar {
  width: 84px;
  height: 84px;
  border-radius: 28px;
  font-size: 2rem;
}

.call-info {
  padding: 24px;
  text-align: center;
}

.call-info h2 {
  margin-bottom: 8px;
  font-size: 2rem;
}

.call-info span {
  display: inline-flex;
  margin-bottom: 12px;
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.call-info p:last-child {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.5;
}

.call-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 18px 20px;
}

.call-overlay.voice-call .call-controls {
  grid-template-columns: repeat(2, minmax(0, 124px));
  justify-content: center;
}

.call-btn {
  min-height: 72px;
  display: grid;
  place-items: center;
  gap: 7px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: white;
  font-weight: 800;
}

.call-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.call-btn.is-off {
  background: rgba(244, 183, 64, 0.2);
  color: #ffd27a;
}

.end-call {
  background: #e5484d;
}

.friend-overlay,
.profile-overlay,
.info-overlay {
  position: fixed;
  inset: 0;
  z-index: 22;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 24, 40, 0.5);
  backdrop-filter: blur(18px);
}

.friend-card,
.profile-card,
.info-card {
  width: min(470px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 28px 80px rgba(16, 24, 40, 0.24);
}

.profile-card {
  width: min(520px, 100%);
}

.info-card {
  width: min(430px, 100%);
}

.friend-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid rgba(16, 24, 40, 0.08);
}

.friend-header div {
  flex: 1;
  min-width: 0;
}

.friend-header h2 {
  margin: 0;
  font-size: 1.6rem;
}

.friend-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 14px 18px 0;
}

.friend-tab {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: #edf3f7;
  color: #344054;
  font-weight: 800;
}

.friend-tab.active {
  background: #101828;
  color: white;
}

.friend-panel {
  padding: 18px;
}

.qr-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 18px;
  background: #f8fbfc;
  text-align: center;
}

.qr-card canvas {
  width: 236px;
  height: 236px;
  max-width: 100%;
  border-radius: 8px;
  background: white;
}

.qr-card span,
.friend-status {
  color: var(--muted);
}

.scan-box {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border-radius: 8px;
  background: #101828;
}

.scan-box video {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.scan-frame {
  position: absolute;
  inset: 48px;
  border: 2px solid rgba(0, 167, 199, 0.94);
  border-radius: 8px;
  box-shadow: 0 0 0 999px rgba(16, 24, 40, 0.34);
  pointer-events: none;
}

.scan-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.friend-status {
  margin: 0;
  padding: 0 18px 18px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.profile-editor {
  padding: 18px;
}

.avatar-editor {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.profile-preview {
  width: 78px;
  height: 78px;
  flex: 0 0 78px;
  border-radius: 24px;
  font-size: 1.8rem;
}

.avatar-upload {
  flex: 1;
  margin: 0;
}

.avatar-upload input {
  padding: 11px;
}

.privacy-panel {
  display: grid;
  gap: 10px;
  margin: 4px 0 18px;
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 14px;
  background: #f8fbfc;
}

.privacy-panel strong {
  display: block;
  margin-bottom: 4px;
}

.privacy-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.privacy-panel p::after {
  content: " Số điện thoại vẫn dùng để kết nối tài khoản, nhưng có thể ẩn trong màn hình thông tin.";
}

.privacy-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-weight: 800;
}

.privacy-toggle input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  padding: 0;
  accent-color: var(--cyan);
}

.info-profile {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 22px 18px 16px;
  text-align: center;
}

.info-profile h3 {
  margin: 4px 0 0;
  font-size: 1.7rem;
}

.info-profile span {
  color: var(--muted);
  font-weight: 700;
}

.info-list {
  display: grid;
  gap: 10px;
  padding: 0 18px 18px;
}

.info-item {
  border: 1px solid rgba(16, 24, 40, 0.08);
  border-radius: 8px;
  padding: 12px 14px;
  background: #f8fbfc;
}

.info-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.info-item strong,
.info-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .app-shell {
    padding: 14px;
  }

  .auth-screen {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 430px);
    gap: 18px;
  }

  .brand-panel {
    min-height: auto;
    padding: 34px;
  }

  .signal-card {
    width: min(340px, 54vw);
  }

  .login-card {
    min-height: 0;
  }

  .trust-row,
  .digital-metrics {
    max-width: 560px;
  }

  .chat-app {
    height: calc(100vh - 28px);
    min-height: 620px;
    grid-template-columns: clamp(300px, 33vw, 350px) minmax(0, 1fr);
    gap: 14px;
  }

  .profile-strip,
  .conversation-header {
    padding: 14px;
  }

  .header-actions {
    gap: 6px;
  }

  .message {
    max-width: min(560px, 82%);
  }
}

@media (max-width: 860px) {
  .auth-screen {
    height: auto;
    min-height: calc(100vh - 28px);
    min-height: calc(100dvh - 28px);
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .brand-panel {
    min-height: 0;
  }

  .signal-card {
    width: min(360px, 70vw);
  }

  .chat-app {
    height: calc(100vh - 28px);
    height: calc(100dvh - 28px);
    min-height: 620px;
    grid-template-columns: 1fr;
    position: relative;
    overflow: hidden;
  }

  .sidebar,
  .conversation {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    transition: transform 220ms ease;
  }

  .sidebar {
    z-index: 1;
  }

  .conversation {
    z-index: 2;
    transform: translateX(100%);
  }

  .chat-app.conversation-open .sidebar {
    transform: translateX(-18%);
  }

  .chat-app.conversation-open .conversation {
    transform: translateX(0);
  }

  .back-btn {
    display: grid;
  }
}

@media (max-width: 560px) {
  body {
    overflow: hidden;
    background: #f7fbff;
  }

  .app-shell {
    padding: 0;
    min-height: 100dvh;
  }

  .auth-screen,
  .chat-app {
    min-height: 100vh;
    min-height: 100dvh;
  }

  .auth-screen {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-rows: minmax(320px, 44dvh) minmax(0, 1fr);
    gap: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    padding-bottom: var(--safe-bottom);
  }

  .chat-app {
    height: 100vh;
    height: 100dvh;
    display: block;
    position: relative;
    overflow: hidden;
    background: white;
  }

  .brand-panel,
  .login-card,
  .sidebar,
  .conversation {
    border-radius: 0;
  }

  .brand-panel {
    min-height: 0;
    height: 100%;
    padding: calc(7px + var(--safe-top)) 14px 7px;
    border-bottom: 0;
    box-shadow: none;
  }

  .brand-panel::after,
  .ai-grid,
  .orbit,
  .pulse-node,
  .floating-panel {
    display: none;
  }

  .signal-card {
    width: 72px;
    margin: 0 auto 4px;
  }

  .ai-core {
    width: 72px;
    min-width: 72px;
  }

  .core-chip {
    width: 36px;
    height: 36px;
    font-size: 0.86rem;
  }

  .core-ring {
    inset: 9%;
  }

  h1 {
    margin-bottom: 3px;
    text-align: center;
    font-size: clamp(1.85rem, 10vw, 2.3rem);
  }

  .lead {
    max-width: 340px;
    margin: 0 auto;
    text-align: center;
    font-size: 0.68rem;
    line-height: 1.22;
  }

  .digital-metrics {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-top: 5px;
  }

  .digital-metrics div {
    padding: 5px 6px;
  }

  .digital-metrics strong {
    font-size: 0.82rem;
  }

  .digital-metrics span {
    margin-top: 1px;
    font-size: 0.52rem;
  }

  .trust-row {
    justify-content: center;
    gap: 4px;
    margin-top: 5px;
  }

  .trust-row span {
    padding: 4px 6px;
    font-size: 0.56rem;
  }

  .copyright-brand {
    width: fit-content;
    max-width: 100%;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 5px auto 0;
    padding: 3px 7px;
    font-size: 0.56rem;
  }

  .copyright-brand img {
    width: 48px;
    height: 25px;
  }

  .login-card {
    min-height: 0;
    height: 100%;
    justify-content: start;
    border-left: 0;
    border-top: 1px solid rgba(16, 24, 40, 0.08);
    padding: 7px 16px calc(7px + var(--safe-bottom));
    box-shadow: none;
    overflow: hidden;
  }

  .login-card::after {
    display: none;
  }

  .login-card .eyebrow {
    margin-bottom: 3px;
    font-size: 0.56rem;
    text-align: left;
  }

  .login-card h2 {
    margin-bottom: 7px;
    font-size: 1.18rem;
    text-align: left;
  }

  .auth-tabs {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 8px;
    padding: 4px;
  }

  .auth-tab {
    min-height: 29px;
    font-size: 0.64rem;
  }

  label {
    gap: 4px;
    margin-bottom: 7px;
    font-size: 0.72rem;
  }

  input,
  textarea {
    min-height: 34px;
    padding: 8px 10px;
    font-size: 16px;
  }

  .auth-actions {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .primary-btn {
    min-height: 36px;
  }

  .secondary-btn {
    min-height: 36px;
    padding: 8px 11px;
  }

  .auth-status {
    margin-top: 6px;
    font-size: 0.66rem;
    line-height: 1.24;
  }

  .fine-print {
    margin-top: 5px;
    font-size: 0.63rem;
    line-height: 1.24;
  }

  .otp-demo-code {
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  body[data-auth-mode="register"] .login-card,
  body[data-auth-mode="forgot"] .login-card {
    padding-top: 5px;
    padding-bottom: calc(5px + var(--safe-bottom));
  }

  body[data-auth-mode="register"] .login-card .eyebrow,
  body[data-auth-mode="forgot"] .login-card .eyebrow {
    margin-bottom: 2px;
    font-size: 0.52rem;
  }

  body[data-auth-mode="register"] .login-card h2,
  body[data-auth-mode="forgot"] .login-card h2 {
    margin-bottom: 4px;
    font-size: 0.98rem;
  }

  body[data-auth-mode="register"] .auth-tabs,
  body[data-auth-mode="forgot"] .auth-tabs {
    margin-bottom: 4px;
    padding: 3px;
  }

  body[data-auth-mode="register"] .auth-tab,
  body[data-auth-mode="forgot"] .auth-tab {
    min-height: 24px;
    font-size: 0.58rem;
  }

  body[data-auth-mode="register"] label,
  body[data-auth-mode="forgot"] label {
    gap: 3px;
    margin-bottom: 3px;
    font-size: 0.64rem;
  }

  body[data-auth-mode="register"] input,
  body[data-auth-mode="forgot"] input {
    min-height: 28px;
    padding: 4px 9px;
    font-size: 16px;
  }

  body[data-auth-mode="register"] .primary-btn,
  body[data-auth-mode="forgot"] .primary-btn {
    min-height: 30px;
  }

  body[data-auth-mode="register"] .auth-status,
  body[data-auth-mode="forgot"] .auth-status {
    margin-top: 3px;
    font-size: 0.58rem;
    line-height: 1.14;
  }

  body[data-auth-mode="register"] .fine-print,
  body[data-auth-mode="forgot"] .fine-print {
    display: none;
  }

  .profile-strip,
  .conversation-header,
  .composer {
    padding: 14px;
  }

  .sidebar,
  .conversation {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    box-shadow: none;
  }

  .sidebar {
    display: flex;
    position: absolute;
    inset: 0;
    padding-top: var(--safe-top);
    transition: transform 220ms ease;
  }

  .conversation {
    display: flex;
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    transition: transform 220ms ease;
  }

  .chat-app.conversation-open .sidebar {
    transform: translateX(-28%);
  }

  .chat-app.conversation-open .conversation {
    transform: translateX(0);
  }

  .back-btn {
    display: grid;
  }

  .conversation-header {
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: 10px;
    padding-top: calc(12px + var(--safe-top));
  }

  .conversation-header .avatar {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 14px;
  }

  .conversation-header h2 {
    font-size: 1.05rem;
  }

  .conversation-header span {
    font-size: 0.76rem;
  }

  .e2ee-status {
    max-width: 100%;
    font-size: 0.68rem !important;
  }

  .header-actions {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .header-actions .icon-btn {
    width: 100%;
    flex-basis: auto;
  }

  .message-stage {
    padding: 18px 14px;
  }

  .message {
    max-width: 90%;
  }

  .composer {
    gap: 8px;
    padding-bottom: calc(12px + var(--safe-bottom));
  }

  .composer .icon-btn,
  .composer .send-btn {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .composer input {
    min-height: 42px;
    padding: 11px 12px;
  }

  .panel-list {
    padding-bottom: calc(86px + var(--safe-bottom));
  }

  .search-box {
    margin: 12px 14px;
  }

  .quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    padding: 0 14px 10px;
  }

  .quick-action {
    min-height: 56px;
    gap: 4px;
    font-size: 0.65rem;
  }

  .quick-action svg {
    width: 18px;
    height: 18px;
  }

  .tab-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: var(--safe-bottom);
    z-index: 3;
    padding: 10px 14px calc(10px + var(--safe-bottom));
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border-top: 1px solid rgba(16, 24, 40, 0.08);
  }

  .sidebar-copyright {
    display: none;
  }

  .tab {
    min-height: 38px;
    font-size: 0.82rem;
  }

  .chat-row,
  .person-row {
    padding: 10px;
  }

  .journal-tools {
    grid-template-columns: 1fr;
  }

  .journal-composer,
  .journal-post {
    margin-left: 2px;
    margin-right: 2px;
  }

  .call-overlay {
    padding: 0;
  }

  .friend-overlay,
  .profile-overlay,
  .info-overlay {
    padding: 0;
  }

  .call-card {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .call-video-stage {
    flex: 1;
    min-height: 0;
  }

  .local-video {
    min-height: 0;
  }

  .call-info {
    padding: 20px 18px 14px;
  }

  .call-controls {
    padding: 0 14px calc(16px + var(--safe-bottom));
  }

  .friend-card,
  .profile-card,
  .info-card {
    width: 100%;
    height: 100%;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .friend-header {
    padding-top: calc(14px + var(--safe-top));
  }

  .friend-tabs {
    grid-template-columns: 1fr;
  }

  .profile-editor,
  .friend-panel {
    padding: 16px;
  }

  .avatar-editor {
    align-items: flex-start;
  }

  .privacy-panel {
    gap: 12px;
  }

  .friend-status {
    padding-bottom: calc(18px + var(--safe-bottom));
  }
}

@media (min-width: 861px) {
  .back-btn {
    display: none;
  }
}
  justify-content: center;
