:root {
  --bg: #f7f7f4;
  --fg: #0b0b0b;
  --muted: #626262;
  --line: #d8d8d2;
  --card: #ffffff;
  --soft: #eeeeea;
  --radius: 28px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #ffffff 0, var(--bg) 42%, #ecece7 100%);
  color: var(--fg);
}

body.chat-mode { background: #f3f3ef; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 32px 0; }
.card { background: rgba(255,255,255,.88); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 24px 70px rgba(0,0,0,.07); }
.hero { padding: 42px; margin-bottom: 24px; }
.brandmark { display: inline-flex; align-items: center; min-height: 38px; padding: 0 18px; border: 1px solid var(--fg); border-radius: 999px; font-weight: 800; letter-spacing: .12em; }
h1 { max-width: 780px; margin: 28px 0 12px; font-size: clamp(38px, 6vw, 74px); line-height: .92; letter-spacing: -.07em; }
h2 { margin: 0 0 12px; font-size: 22px; letter-spacing: -.04em; }
.subtitle { max-width: 720px; margin: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.hint { margin: 0 0 22px; color: var(--muted); font-size: 15px; line-height: 1.55; }
.badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.badges span, .statusPill, .step { padding: 10px 14px; border-radius: 999px; background: var(--soft); border: 1px solid var(--line); color: #242424; font-size: 14px; }
.flow { display: grid; justify-items: center; }
.frame { width: min(620px, 100%); animation: rise 180ms ease-out; }
.panel { padding: 34px; }
.step { display: inline-flex; margin-bottom: 22px; }
label { display: block; margin: 16px 0 8px; color: var(--muted); font-size: 14px; }
code { padding: 2px 6px; border-radius: 7px; background: var(--soft); color: var(--fg); }
input { width: 100%; height: 52px; padding: 0 16px; border: 1px solid var(--line); border-radius: 18px; background: #fbfbf8; color: var(--fg); font-size: 16px; outline: none; }
input[type="file"] { padding: 14px 16px; height: auto; }
input:focus { border-color: var(--fg); box-shadow: 0 0 0 4px rgba(0,0,0,.08); }
button { height: 54px; margin-top: 18px; border: 0; border-radius: 999px; background: var(--fg); color: #fff; font-size: 15px; font-weight: 800; cursor: pointer; }
button:hover { transform: translateY(-1px); }
button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
button.secondary { background: #fff; color: var(--fg); border: 1px solid var(--fg); }
button.mini { width: auto; height: 38px; padding: 0 14px; margin: 0 0 22px; background: var(--soft); color: var(--fg); border: 1px solid var(--line); font-weight: 500; }
.actions2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions2 button { width: 100%; }
form > button:not(.mini), .panel > button:not(.mini) { width: 100%; }
.qrBox { display: grid; justify-items: center; gap: 12px; margin-top: 18px; }
.qr { width: 240px; height: 240px; padding: 14px; border: 1px solid var(--line); border-radius: 24px; background: #fff; }
.otpauth { color: var(--fg); font-size: 14px; text-decoration: none; border-bottom: 1px solid var(--fg); }
.result { max-height: 180px; overflow: auto; margin: 18px 0 0; padding: 16px; border-radius: 20px; background: #111; color: #f4f4f0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.chat { width: min(1080px, 100%); min-height: 680px; display: grid; grid-template-columns: 220px 1fr; overflow: hidden; }
.chatSidebar { padding: 22px; border-right: 1px solid var(--line); background: rgba(244,244,240,.72); }
.chatLogo { display: inline-flex; align-items: center; justify-content: center; height: 42px; padding: 0 16px; margin-bottom: 20px; border: 1px solid var(--fg); border-radius: 999px; font-weight: 800; letter-spacing: .12em; }
.profileBadge { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; margin: 0 0 20px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.profileBadge small { display: block; color: var(--muted); margin-top: 3px; }
.avatarButton, .avatar { width: 42px; height: 42px; margin: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--fg); color: #fff; overflow: hidden; font-weight: 800; }
.avatarButton img { width: 100%; height: 100%; object-fit: cover; }
.chatNav { width: 100%; height: 44px; margin: 8px 0 0; background: transparent; color: var(--fg); border: 1px solid transparent; text-align: left; padding: 0 14px; }
.chatNav.is-selected { background: var(--fg); color: #fff; }
.chatMain { display: grid; grid-template-rows: auto auto 1fr auto auto; min-width: 0; }
.chatHeader { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 28px; border-bottom: 1px solid var(--line); }
.conversationList { padding: 18px 28px; border-bottom: 1px solid var(--line); }
.conversation { display: flex; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.conversation p { margin: 3px 0 0; color: var(--muted); }
.messages { padding: 24px; overflow: auto; min-height: 280px; display: flex; flex-direction: column; gap: 12px; }
.emptyState { margin: auto; color: var(--muted); }
.message { max-width: 74%; padding: 12px 14px; border-radius: 20px; border: 1px solid var(--line); background: #fff; word-break: break-word; }
.message.outgoing { align-self: flex-end; background: var(--fg); color: #fff; border-color: var(--fg); }
.message.incoming { align-self: flex-start; }
.message small { display: block; margin-top: 7px; opacity: .62; font-size: 11px; }
.chatError { margin: 0 24px 12px; padding: 12px 14px; border-radius: 16px; background: #fff4f4; border: 1px solid #e2b8b8; color: #740b0b; font-size: 13px; white-space: pre-wrap; }
.composer { display: grid; grid-template-columns: 1fr 150px; gap: 10px; padding: 18px 24px; border-top: 1px solid var(--line); }
.composer input { height: 50px; }
.composer button { margin: 0; height: 50px; }
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; background: rgba(247,247,244,.72); backdrop-filter: blur(6px); }
.modalCard { width: min(620px, 100%); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 820px) { .chat { grid-template-columns: 1fr; } .chatSidebar { border-right: 0; border-bottom: 1px solid var(--line); } .composer { grid-template-columns: 1fr; } .actions2 { grid-template-columns: 1fr; } }


.metrikaInformerLink {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 20;
  opacity: 0.72;
  border-radius: 10px;
  overflow: hidden;
  filter: grayscale(1);
}

.metrikaInformerLink:hover {
  opacity: 1;
}

.chatList {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.directStart {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.directStart input {
  width: 100%;
  min-height: 38px;
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 0 12px;
  background: var(--panel);
}

.directStart button {
  min-height: 38px;
  border-radius: 18px;
  padding: 0 14px;
}

.checkline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 12px 0;
  color: var(--muted);
  font-size: 14px;
}

.checkline input {
  width: auto;
  min-height: auto;
}

.phoneField {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fbfbf8;
  overflow: hidden;
}
.phoneField:focus-within { border-color: var(--fg); box-shadow: 0 0 0 4px rgba(0,0,0,.08); }
.phoneField span {
  padding-left: 16px;
  padding-right: 8px;
  color: var(--fg);
  font-weight: 800;
  user-select: none;
}
.phoneField input {
  height: 50px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
  padding-left: 4px;
}
.phoneField input::placeholder { color: #9a9a94; }
