:root {
  --app-bg: #0e1621;
  --app-bg-2: #17212b;
  --app-card: #182533;
  --app-text: #f5f5f5;
  --app-hint: #7f91a4;
  --app-line: rgba(0, 0, 0, 0.35);
  --app-accent: #6ab3f3;
  --hdr-bg: #17212b;
  --bubble-in: #182533;
  --bubble-out: #2b5278;
  --meta-in: #6d7f8f;
  --meta-out: #7da8d3;
  --kb: rgba(39, 56, 74, 0.92);
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --stage-bg: radial-gradient(60% 70% at 20% 40%, rgba(91, 91, 246, 0.25), transparent 60%),
    radial-gradient(50% 60% at 75% 70%, rgba(106, 179, 243, 0.16), transparent 60%), #070b12;
}

body {
  background: var(--stage-bg);
}

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

/* ——— Stage: two phones + info ——— */
.stage {
  grid-template-columns: auto auto minmax(0, 360px);
  gap: 40px;
}

.info h1 {
  font-size: 40px;
}

.info__try a {
  color: #8fc4f5;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 1360px) {
  .stage {
    grid-template-columns: auto auto;
  }

  .info {
    display: none;
  }
}

@media (max-width: 880px) {
  .phone--team {
    display: none;
  }
}

/* ——— Chat header ——— */
.chat-head {
  position: relative;
  z-index: 10;
  flex: none;
  display: grid;
  grid-template-columns: 76px 1fr 76px;
  align-items: center;
  height: 54px;
  padding: 0 10px;
  background: var(--hdr-bg);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.chat-head__back {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--app-accent);
  font-size: 16px;
}

.chat-head__back svg {
  width: 22px;
  height: 22px;
}

.unread {
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 11px;
  background: var(--app-accent);
  color: #0e1621;
  font-size: 13px;
  font-weight: 700;
  line-height: 22px;
  text-align: center;
}

.chat-head__title {
  min-width: 0;
  text-align: center;
  line-height: 1.2;
}

.chat-head__title b {
  display: block;
  overflow: hidden;
  font-size: 16px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-head__title span {
  color: var(--app-hint);
  font-size: 13px;
}

.chat-head__title span.is-typing {
  color: var(--app-accent);
}

.chat-head__ava {
  justify-self: end;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 14px;
}

.chat-head__ava--bot {
  background: linear-gradient(135deg, #7b7bff, #4a3fd8);
}

.chat-head__ava--bot svg,
.intro__ava svg,
.ava--bot svg {
  width: 70%;
  height: 70%;
}

.chat-head__ava--group {
  background: linear-gradient(135deg, #ff8a3d, #ff3b5c);
}

/* ——— Chat area with Telegram-like pattern ——— */
.chat {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  background-color: var(--app-bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.045' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 30l10-10 10 10-10 10z'/%3E%3Ccircle cx='110' cy='28' r='9'/%3E%3Cpath d='M70 70c6-8 18-8 24 0'/%3E%3Cpath d='M128 96l14 4-10 10z'/%3E%3Cpath d='M30 112h20M40 102v20'/%3E%3Cpath d='M88 132l8-12 8 12z'/%3E%3Ccircle cx='60' cy='146' r='4'/%3E%3Cpath d='M140 150c-6-4-6-12 0-16'/%3E%3C/g%3E%3C/svg%3E"),
    radial-gradient(90% 70% at 100% 0%, rgba(106, 179, 243, 0.08), transparent 60%),
    radial-gradient(90% 70% at 0% 100%, rgba(91, 91, 246, 0.1), transparent 60%);
}

.chat::-webkit-scrollbar {
  display: none;
}

.msgs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
  padding: 10px 8px 12px;
  justify-content: flex-end;
}

/* Empty bot chat card */
.intro {
  align-self: center;
  width: 82%;
  margin: auto 0;
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(24, 37, 51, 0.92);
  text-align: center;
  font-size: 14px;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.intro__ava {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7b7bff, #4a3fd8);
}

.intro p {
  margin-top: 6px;
  color: #c9d3dd;
  line-height: 1.45;
}

.intro.is-gone {
  opacity: 0;
  transform: scale(0.96);
}

.date {
  align-self: center;
  margin: 8px 0 6px;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  color: #e4ecf2;
  font-size: 13px;
  font-weight: 600;
}

.sys {
  align-self: center;
  max-width: 85%;
  margin: 6px 0;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.32);
  color: #e4ecf2;
  font-size: 13px;
  text-align: center;
}

/* ——— Messages ——— */
.msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: msgIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

.msg--in {
  align-self: flex-start;
}

.msg--out {
  align-self: flex-end;
  align-items: flex-end;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

.msg--with-ava {
  flex-direction: row;
  align-items: flex-end;
  gap: 6px;
  max-width: 92%;
}

.msg--with-ava > .msg__col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ava {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}

.ava--bot {
  background: linear-gradient(135deg, #7b7bff, #4a3fd8);
}

.bubble {
  position: relative;
  padding: 7px 11px 6px;
  border-radius: 16px;
  font-size: 15px;
  line-height: 1.38;
  overflow-wrap: anywhere;
}

.msg--in .bubble {
  background: var(--bubble-in);
  border-bottom-left-radius: 5px;
}

.msg--out .bubble {
  background: var(--bubble-out);
  border-bottom-right-radius: 5px;
}

.bubble b {
  font-weight: 700;
}

.bubble a,
.link {
  color: #8fc4f5;
  text-decoration: none;
}

.bubble__from {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
  font-weight: 700;
  font-size: 14px;
}

.bubble__from em {
  padding: 0 5px;
  border-radius: 4px;
  background: rgba(106, 179, 243, 0.2);
  color: var(--app-accent);
  font-style: normal;
  font-weight: 600;
  font-size: 10px;
  line-height: 15px;
}

.meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 6px -3px -3px 10px;
  font-size: 12px;
  line-height: 1;
}

.msg--in .meta {
  color: var(--meta-in);
}

.msg--out .meta {
  color: var(--meta-out);
}

.meta svg {
  width: 16px;
  height: 11px;
  color: #6ab3f3;
}

.code {
  display: block;
  margin: 6px 0 2px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
}

.copyable {
  display: block;
  margin: 6px 0 2px;
  padding: 7px 10px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  color: #8fc4f5;
  font-family: var(--mono);
  font-size: 12.5px;
  cursor: pointer;
}

.quote {
  display: block;
  margin: 4px 0;
  padding: 4px 8px;
  border-left: 3px solid var(--app-accent);
  border-radius: 4px;
  background: rgba(106, 179, 243, 0.1);
  font-size: 14px;
}

/* Typing bubble */
.typing .bubble {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--meta-in);
  animation: dot 1s ease-in-out infinite;
}

.typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.typing i:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes dot {
  0%,
  60%,
  100% {
    transform: none;
    opacity: 0.5;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Inline keyboard */
.kb {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.kb__row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
}

.kb button {
  min-height: 38px;
  padding: 6px 8px;
  border-radius: 10px;
  background: var(--kb);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.2;
  backdrop-filter: blur(6px);
  transition: background 0.15s ease, transform 0.12s ease;
}

.kb button:hover {
  background: rgba(52, 74, 97, 0.95);
}

.kb button:active {
  transform: scale(0.97);
}

.kb button.is-on {
  background: rgba(64, 120, 180, 0.95);
}

.kb button:disabled {
  opacity: 0.55;
  cursor: default;
}

.kb button:focus-visible,
.replykb button:focus-visible,
.commands button:focus-visible {
  outline: 2px solid var(--app-accent);
  outline-offset: 1px;
}

/* Contact card bubble */
.contact {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  padding: 2px 0;
}

.contact .ava {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #ff8a3d, #ff3b5c);
}

.contact b {
  display: block;
}

.contact span {
  color: #a9c6e6;
  font-size: 13px;
}

/* Album */
.album {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-rows: 92px 92px;
  gap: 3px;
  width: 260px;
  margin: -3px -7px 4px;
  border-radius: 12px;
  overflow: hidden;
}

.banner {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 8px;
  overflow: hidden;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  line-height: 1.1;
}

.banner small {
  margin-top: 3px;
  opacity: 0.75;
  font-weight: 600;
  font-size: 9px;
}

.banner--a {
  grid-row: span 2;
  background:
    radial-gradient(60% 50% at 70% 30%, rgba(255, 201, 74, 0.6), transparent 70%),
    linear-gradient(160deg, #7b2cff, #ff2fb9);
}

.banner--a::before {
  content: "200%";
  position: absolute;
  top: 18px;
  left: 8px;
  font-size: 30px;
  font-weight: 900;
  color: #ffd166;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.25);
}

.banner--b {
  background: linear-gradient(135deg, #0c6b45, #ffc93c);
}

.banner--b::before {
  content: "777";
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 22px;
  font-weight: 900;
  color: #fff;
}

.banner--c {
  background: linear-gradient(135deg, #0b1b3a, #1d4ed8);
}

.banner--c::before {
  content: "150 FS";
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #c6ff00;
  color: #0b1b3a;
  font-size: 12px;
  font-weight: 900;
}

/* Document */
.doc {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 230px;
}

.doc__icon {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--app-accent);
  color: #0e1621;
}

.doc__icon svg {
  width: 22px;
  height: 22px;
}

.doc b {
  display: block;
  font-size: 14px;
  line-height: 1.25;
}

.doc span {
  color: var(--meta-in);
  font-size: 13px;
}

/* Approved / rejected state on the manager card */
.stamp {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 9px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
}

.stamp--ok {
  background: rgba(52, 199, 89, 0.18);
  color: #5fdb85;
}

.stamp--no {
  background: rgba(255, 90, 95, 0.18);
  color: #ff8a8d;
}

.new-flash {
  animation: msgIn 0.28s ease both, flash 1.6s ease 0.3s 2;
}

@keyframes flash {
  50% {
    filter: brightness(1.35);
  }
}

/* ——— Reply keyboard ——— */
.replykb {
  flex: none;
  display: grid;
  gap: 6px;
  padding: 8px;
  background: #17212b;
  border-top: 1px solid rgba(0, 0, 0, 0.4);
  animation: kbUp 0.25s ease;
}

.replykb[hidden] {
  display: none;
}

@keyframes kbUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
}

.replykb__row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.replykb button {
  min-height: 44px;
  border-radius: 10px;
  background: #2b3949;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.replykb button:active {
  background: #3a4b5f;
}

/* ——— Commands menu ——— */
.commands {
  position: absolute;
  z-index: 20;
  left: 8px;
  right: 8px;
  bottom: 62px;
  display: grid;
  padding: 6px;
  border-radius: 14px;
  background: #1e2c3a;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  animation: kbUp 0.2s ease;
}

.commands[hidden] {
  display: none;
}

.commands button {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
}

.commands button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.commands b {
  color: var(--app-accent);
  font-weight: 600;
}

.commands span {
  color: var(--app-hint);
  font-size: 14px;
}

/* ——— Composer ——— */
.composer {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 12px;
  background: var(--hdr-bg);
}

.composer__menu {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 12px 0 8px;
  border-radius: 17px;
  background: #5b8fd6;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
}

.composer__menu svg {
  width: 18px;
  height: 18px;
}

.composer input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 18px;
  background: #242f3d;
  font-size: 15px;
  outline: none;
}

.composer input::placeholder {
  color: var(--app-hint);
}

.composer__icon,
.composer__send {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  color: var(--app-hint);
}

.composer__icon svg,
.composer__send svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.composer__send.is-ready {
  color: var(--app-accent);
}

.composer__ghost {
  flex: 1;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: #242f3d;
  color: var(--app-hint);
  font-size: 15px;
  line-height: 36px;
}

.composer--team .composer__icon svg {
  fill: currentColor;
}

.composer[hidden] {
  display: none;
}

.start {
  flex: none;
  height: 54px;
  margin: 0;
  background: var(--hdr-bg);
  color: var(--app-accent);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.04em;
  border-top: 1px solid rgba(0, 0, 0, 0.4);
}

.start[hidden] {
  display: none;
}

@media (max-width: 880px) {
  .composer,
  .start {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* Toast sits above the composer */
.toast {
  bottom: 70px;
}
