:root {
  --bg-chat: #0e1621;
  --bg-side: #17212b;
  --bg-hover: #202b36;
  --bg-active: #2b5278;
  --bg-input: #242f3d;
  --bubble-in: #182533;
  --bubble-out: #2b5278;
  --accent: #5288c1;
  --link: #6ab3f3;
  --text: #f5f5f5;
  --muted: #7d8e9e;
  --faint: #708499;
  --online: #0ac630;
  --danger: #e25c5c;
  --side-w: 380px;
  --info-w: 320px;
  --head-h: 56px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: var(--text);
  background: var(--bg-chat);
  font-size: 15px;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font-family: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: #3d6d99; }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
.hidden { display: none !important; }

.ico { display: inline-flex; pointer-events: none; }
.ico svg { display: block; }

.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
}
.icon-btn:hover { background: rgba(255,255,255,.06); color: #fff; }

.boot {
  height: 100dvh;
  display: grid;
  place-items: center;
  background: var(--bg-chat);
}
.mark {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  font-size: 36px;
  font-weight: 700;
  color: #fff;
}
.mark.sm { width: 72px; height: 72px; font-size: 30px; }

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(82,136,193,.18), transparent 60%),
    var(--bg-chat);
}
.login-card { width: min(380px, 100%); text-align: center; }
.login-card h1 { margin: 16px 0 4px; font-size: 28px; font-weight: 700; }
.login-card .lead { margin: 0 0 22px; color: var(--muted); }
.login-card input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 14px 12px;
  margin-bottom: 10px;
  font-size: 15px;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.btn-primary, .btn-ghost, .btn-danger {
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 600;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5f96d1; }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--link); }
.btn-danger { background: transparent; color: #ff8a80; }
.login-error { min-height: 22px; color: #ff8a80; font-size: 13px; margin: 8px 0 0; }
.fine { color: var(--faint); font-size: 13px; margin-top: 18px; }

.app {
  height: 100dvh;
  display: flex;
  overflow: hidden;
  background: var(--bg-chat);
}
.app-row { display: flex; flex: 1; min-width: 0; min-height: 0; width: 100%; }
.phone-brand { display: none; }
.phone-settings { display: none; }
.phone-tabs { display: none; }
.sidebar {
  width: var(--side-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-side);
  border-right: 1px solid #101921;
  min-width: 0;
}
.side-head {
  height: var(--head-h);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 4px;
}
.spacer { flex: 1; }
.search-wrap { position: relative; padding: 0 14px 10px; }
.search-ico {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--faint);
  display: flex;
}
.search-wrap input {
  width: 100%;
  background: var(--bg-input);
  border: 0;
  border-radius: 22px;
  padding: 9px 14px 9px 38px;
  font-size: 15px;
}
.search-wrap input:focus { outline: none; }
.chat-list, .messages { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.chat-list { overflow-y: auto; flex: 1; }
.chat-item {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 14px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}
.chat-item:hover { background: var(--bg-hover); }
.chat-item.active { background: var(--bg-active); }
.chat-item.chosen,
.chat-item.chosen:hover { background: #2b5278; }
.chat-item.chosen .chat-preview,
.chat-item.chosen .chat-time { color: rgba(255,255,255,.78); }
.chat-item.chosen .dot { display: none; }
.pick-mark {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #5288c1;
  color: #fff;
  display: grid;
  place-items: center;
  z-index: 1;
}
.sidebar.picking .side-head,
.sidebar.picking .search-wrap { display: none; }
.pick-bar {
  height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 4px;
}
.pick-bar.hidden { display: none; }
.pick-bar span { font-size: 16px; font-weight: 500; }
.pick-delete { color: #ff8a80; }
.pick-delete:disabled { opacity: .35; }
.chat-item.active .chat-preview,
.chat-item.active .chat-time,
.chat-item.active .who span { color: rgba(255,255,255,.78); }
.chat-mid { flex: 1; min-width: 0; }
.chat-top, .chat-bot { display: flex; align-items: center; gap: 8px; }
.chat-name { flex: 1; min-width: 0; font-weight: 500; font-size: 16px; }
.chat-item.unread .chat-name { font-weight: 700; }
.chat-time { flex: none; font-size: 12px; color: var(--faint); }
.chat-item.unread .chat-time { color: var(--link); }
.chat-preview { flex: 1; min-width: 0; color: var(--muted); font-size: 14px; }
.chat-preview.typing { color: var(--link); }
.chat-name, .chat-preview, .head-name, .sub, .ellip {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #40a7e3;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  display: grid;
  place-items: center;
  flex: none;
}
.section-label {
  padding: 10px 16px 4px;
  color: var(--link);
  font-size: 14px;
  font-weight: 600;
}
.search-empty { padding: 28px 16px; text-align: center; color: var(--muted); }

.avatar {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 600;
  font-size: 20px;
  position: relative;
  flex: none;
  user-select: none;
}
.avatar.sm { width: 42px; height: 42px; font-size: 16px; }
.avatar.xs { width: 34px; height: 34px; font-size: 14px; }
.avatar.lg { width: 84px; height: 84px; font-size: 30px; }
.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.msg-menu {
  position: fixed;
  z-index: 35;
  min-width: 168px;
  background: #243140;
  border-radius: 12px;
  padding: 6px 0;
  box-shadow: 0 10px 28px rgba(0,0,0,.45);
}
.msg-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: #fff;
  padding: 9px 14px;
  font-size: 15px;
}
.msg-menu button:hover { background: rgba(255,255,255,.06); }
.msg-menu button.danger { color: #ff8a80; }
.emoji-pop {
  position: absolute;
  left: 12px;
  bottom: 64px;
  width: min(320px, calc(100% - 24px));
  background: #243140;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  z-index: 4;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.emoji-pop button {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 22px;
}
.emoji-pop button:hover { background: rgba(255,255,255,.08); }
.main.drop::after {
  content: "파일을 여기에 놓으세요";
  position: absolute;
  inset: 12px;
  border: 2px dashed #5288c1;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(14,22,33,.82);
  color: #fff;
  z-index: 4;
  font-size: 16px;
}
.avatar .dot {
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  background: var(--online);
  border: 2px solid var(--bg-side);
  border-radius: 50%;
}
.chat-item.active .dot { border-color: var(--bg-active); }
.avatar.on-chat .dot { border-color: var(--bg-chat); }

.content { flex: 1; display: flex; min-width: 0; position: relative; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chat-head {
  height: var(--head-h);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  background: var(--bg-side);
  box-shadow: 0 1px 1px rgba(0,0,0,.25);
  z-index: 2;
}
.head-peer { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.head-text { min-width: 0; }
.head-name { font-weight: 600; }
.sub { font-size: 13px; color: var(--muted); }
.sub.online { color: var(--online); }
.sub.typing { color: var(--link); }
.head-search { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.chat-head:not(.searching) .head-search { display: none; }
.chat-head.searching .head-peer { display: none; }
.chat-head.selecting { padding: 0; gap: 0; }
.chat-head.selecting > :not(.msg-select-bar) { display: none !important; }
.msg-select-bar {
  display: none;
  flex: 1;
  min-width: 0;
  height: 100%;
  align-items: center;
  gap: 10px;
  padding: 0 12px 0 11px;
}
.chat-head.selecting .msg-select-bar { display: flex; }
.msg-select-bar button {
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  height: 34px;
  padding: 0;
}
.msg-select-bar .sel-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 17px;
  border-radius: 7px;
  background: #40a7e3;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}
.msg-select-bar .sel-pill:hover { background: #49b0ea; }
.msg-select-bar .sel-pill:disabled { opacity: .45; }
#msg-cancel {
  margin-left: auto;
  padding: 0 4px;
  color: #6ab3f3;
  font-size: 15px;
  font-weight: 600;
}
#msg-cancel:hover { color: #8ac6f7; }
.main.selecting .msg-row { padding-right: 46px; }
.main.selecting .actions { display: none; }
.messages.msg-dragging,
.messages.msg-dragging * { user-select: none !important; }
.sel-dot {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.55);
  background: transparent;
  color: transparent;
  display: grid;
  place-items: center;
  padding: 0;
}
.sel-dot svg { width: 12px; height: 10px; }
.sel-dot.on {
  background: #34b355;
  border-color: #34b355;
  color: #fff;
}
.msg-row.chosen .bubble.out { background: #1f3d5c; }
.msg-row.chosen .bubble.out.tail::after { background: #1f3d5c; }
.msg-row.chosen .bubble.in { background: #121c28; }
.msg-row.chosen .bubble.in.tail::after { background: #121c28; }
.head-search input {
  flex: 1;
  min-width: 0;
  background: var(--bg-input);
  border: 0;
  border-radius: 18px;
  padding: 8px 12px;
}
.head-search input:focus { outline: none; }
.search-count { color: var(--muted); font-size: 13px; min-width: 42px; text-align: center; }
.back-btn { display: none; }

.wallpaper {
  background-color: var(--bg-chat);
  background-image: url("/static/bg.svg");
  background-size: 240px 240px;
}
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0 10px;
  display: flex;
  flex-direction: column;
}
.messages::before {
  content: "";
  margin-top: auto;
}
.date-chip, .system-chip {
  align-self: center;
  background: rgba(23, 33, 43, .92);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 12px;
  margin: 8px 16px;
  max-width: min(460px, 90%);
  text-align: center;
  box-shadow: 0 1px 1px rgba(0,0,0,.2);
}
.msg-row { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 0 16px; margin-bottom: 2px; }
.msg-row.out { justify-content: flex-end; }
.msg-row.tail { margin-bottom: 8px; }
.avatar-slot { width: 34px; flex: none; }
.cluster { position: relative; max-width: min(430px, 78%); }
.bubble {
  max-width: 100%;
  padding: 8px 11px;
  position: relative;
  border-radius: 16px;
  user-select: text;
}
.bubble.in { background: var(--bubble-in); }
.bubble.out { background: var(--bubble-out); }
.bubble.in.tail { border-bottom-left-radius: 4px; }
.bubble.out.tail { border-bottom-right-radius: 4px; }
.bubble.in:not(.tail) { border-bottom-left-radius: 6px; }
.bubble.out:not(.tail) { border-bottom-right-radius: 6px; }
.bubble.in.continued { border-top-left-radius: 6px; }
.bubble.out.continued { border-top-right-radius: 6px; }
.bubble.tail::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 8px;
  height: 13px;
}
.bubble.in.tail::after {
  left: -7px;
  background: var(--bubble-in);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
  border-bottom-left-radius: 8px;
}
.bubble.out.tail::after {
  right: -7px;
  background: var(--bubble-out);
  clip-path: polygon(0 0, 100% 100%, 0 100%);
}
.bubble.deleted {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.16);
  pointer-events: none;
  user-select: none;
}
.bubble.deleted::after { display: none; }
.forwarded { color: var(--link); font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.edited { margin-right: 3px; }
.unread-line {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 16px;
  color: var(--link);
  font-size: 13px;
  line-height: 1.3;
}
.unread-line::before,
.unread-line::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(106, 179, 243, .55);
}
.unread-line span { padding: 0 4px; }
.chat-flags { display: inline-flex; gap: 4px; color: var(--faint); margin-left: 4px; }
.person-add { color: var(--link); font-size: 14px; font-weight: 600; flex: none; margin-left: 8px; }
.chat-item.muted .badge { background: #607484; }
.chat-item.pinned { box-shadow: inset 2px 0 0 #5288c1; }
.bubble .sender { font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; word-break: break-word; line-height: 18px; }
.meta {
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 16px;
  margin: 1px 0 0 12px;
  position: relative;
  top: 3px;
  line-height: 16px;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  white-space: nowrap;
  user-select: none;
}
.checks { display: inline-flex; color: rgba(255,255,255,.7); }
.checks.read { color: #8ec8ff; }
.quote {
  border-left: 2px solid var(--link);
  background: rgba(0,0,0,.16);
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 4px;
  cursor: pointer;
  max-width: 280px;
}
.quote b { display: block; color: var(--link); font-size: 13px; }
.quote span { display: block; color: rgba(255,255,255,.72); font-size: 13px; }
.photo {
  display: block;
  max-width: min(320px, 70vw);
  max-height: 360px;
  border-radius: 10px;
  cursor: zoom-in;
}
.bubble.media .text { padding: 4px 4px 0; }
.file-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: rgba(0,0,0,.15);
  border-radius: 10px;
  padding: 8px;
  min-width: 210px;
  color: inherit;
  text-decoration: none;
  margin-bottom: 4px;
}
.file-ico {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
}
.file-row b { display: block; font-weight: 600; }
.file-row span { color: rgba(255,255,255,.65); font-size: 12px; }
.actions {
  position: absolute;
  bottom: 0;
  display: flex;
  gap: 2px;
  opacity: 0;
  z-index: 2;
  transition: opacity .15s ease;
}
.msg-row.out .actions { right: calc(100% + 4px); }
.msg-row.in .actions { left: calc(100% + 4px); }
.msg-row:hover .actions { opacity: 1; }
.reply-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 0;
  background: rgba(0,0,0,.28);
  color: #fff;
  display: grid;
  place-items: center;
}
@keyframes arrive {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.bubble.arrive { animation: arrive .18s cubic-bezier(.2, .7, .2, 1); }
@keyframes flash {
  from { filter: brightness(1.45); }
  to { filter: none; }
}
.bubble.flash { animation: flash 1.1s ease; }

.jump {
  position: absolute;
  right: 18px;
  bottom: 78px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 0;
  background: var(--bg-side);
  color: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.45);
  z-index: 3;
  font-size: 18px;
}
.composer { background: var(--bg-side); padding: 6px 10px calc(8px + env(safe-area-inset-bottom)); }
.reply-bar, .file-chips { padding: 4px 8px 0 46px; }
.reply-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 2px solid var(--link);
  margin: 4px 8px 4px 46px;
  padding: 4px 8px;
}
.reply-bar .grow { flex: 1; min-width: 0; }
.reply-bar b { display: block; color: var(--link); font-size: 13px; }
.reply-bar span { color: var(--muted); font-size: 13px; }
.file-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-input);
  border-radius: 14px;
  padding: 4px 8px;
  font-size: 13px;
  max-width: 100%;
}
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.chip-x { border: 0; background: transparent; color: var(--muted); font-size: 16px; }
.composer-row { display: flex; align-items: flex-end; gap: 4px; }
.composer-input {
  flex: 1;
  resize: none;
  border: 0;
  background: transparent;
  font-size: 15px;
  line-height: 1.4;
  max-height: 160px;
  padding: 10px 4px;
}
.composer-input:focus { outline: none; }
.composer-input::placeholder { color: #6d7f8d; }
.send {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
  margin-bottom: 2px;
}
.send:disabled { background: #2a3a4a; color: #6d7f8d; cursor: default; }

.empty {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}
.main.is-empty .empty { display: flex; }
.main.is-empty .chat-head,
.main.is-empty .messages,
.main.is-empty .composer,
.main.is-empty .jump { display: none !important; }
.empty h2 { margin: 14px 0 6px; color: #fff; font-size: 20px; font-weight: 600; }
.empty p { margin: 0; }

.info {
  display: none;
  width: var(--info-w);
  flex: none;
  flex-direction: column;
  background: var(--bg-side);
  border-left: 1px solid #101921;
  overflow-y: auto;
}
.info.open { display: flex; }
.info-top { height: var(--head-h); display: flex; align-items: center; padding: 0 6px; gap: 6px; font-weight: 600; }
.info-hero { display: flex; flex-direction: column; align-items: center; padding: 12px 16px 18px; text-align: center; }
.info-hero h3 { margin: 10px 0 2px; font-size: 18px; }
.info-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.info-block { padding: 8px 0 12px; border-top: 8px solid #0e1621; }
.info-block h4 { margin: 8px 16px; font-size: 14px; color: var(--link); font-weight: 600; }
.member, .menu-item, .pick-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}
.member:hover, .menu-item:hover, .pick-item:hover { background: rgba(255,255,255,.04); }
.who { flex: 1; min-width: 0; }
.who b { display: block; font-weight: 500; }
.who span { display: block; color: var(--muted); font-size: 13px; }
.who span.on { color: var(--online); }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 0 12px 12px; }
.media-grid img { width: 100%; height: 86px; object-fit: cover; cursor: zoom-in; background: #0e1621; }
.doc-link { display: block; padding: 6px 16px; color: var(--link); text-decoration: none; font-size: 14px; }
.kick {
  border: 0;
  background: transparent;
  color: #ff8a80;
  font-size: 13px;
  flex: none;
}

.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 25; }
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(320px, 88vw);
  background: var(--bg-side);
  z-index: 26;
  transform: translateX(-105%);
  transition: transform .18s ease;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 24px rgba(0,0,0,.35);
}
.drawer.open { transform: none; }
.drawer-profile { padding: 28px 20px 18px; background: #1c2733; }
.drawer-profile .d-name { margin-top: 14px; font-size: 18px; font-weight: 650; }
.drawer-profile .d-user { color: var(--muted); margin-top: 2px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 13px 20px;
  font-size: 15px;
}
.menu-item:hover { background: rgba(255,255,255,.04); }
.menu-item.danger { color: #ff8a80; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dialog {
  width: min(440px, 100%);
  max-height: min(680px, 100%);
  background: #1c2733;
  border-radius: 12px;
  overflow: auto;
  box-shadow: 0 16px 48px rgba(0,0,0,.45);
}
.dialog.wide { width: min(560px, 100%); }
.dialog-head {
  padding: 14px 16px;
  font-weight: 650;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: #1c2733;
}
.dialog-body { padding: 0 12px 16px; }
.field {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px;
  margin: 8px 0;
  font-size: 15px;
}
.field:focus { outline: none; border-color: var(--accent); }
.pick-list { max-height: 360px; overflow: auto; margin: 0 -12px; }
.tick {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--faint);
  flex: none;
}
.pick-item.on .tick { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px #1c2733; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.confirm-text { padding: 8px 4px 12px; line-height: 1.45; }

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.9);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox img { max-width: 94vw; max-height: 92vh; }
.lightbox .icon-btn { position: absolute; top: 12px; right: 12px; color: #fff; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #243140;
  color: #fff;
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 70;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  max-width: min(420px, 90vw);
}

@media (max-width: 1099px) {
  .info.open {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    box-shadow: -8px 0 24px rgba(0,0,0,.4);
  }
}
@media (max-width: 899px) {
  .app { flex-direction: column; height: var(--app-h, 100dvh); }
  .login, .boot { height: var(--app-h, 100dvh); }
  .sidebar { width: 100%; }
  .app.show-list .content { display: none; }
  .app:not(.show-list) .sidebar { display: none; }
  .back-btn { display: grid; }
  .info.open { width: 100%; left: 0; }
  .avatar { width: 48px; height: 48px; }
  .cluster { max-width: 82%; }
  #btn-menu { display: none; }
  .phone-brand { display: block; font-size: 20px; font-weight: 700; padding-left: 8px; }
  .side-head, .chat-head, .info-top {
    padding-top: env(safe-area-inset-top);
    height: calc(var(--head-h) + env(safe-area-inset-top));
  }
  .login { padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  .composer-input, .search-wrap input, .login-card input, #inchat-search { font-size: 16px; }
  .app.show-list .phone-tabs {
    display: flex;
    flex: none;
    background: var(--bg-side);
    border-top: 1px solid rgba(255,255,255,.06);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app:has(.sidebar.picking) .phone-tabs,
  .app:not(.show-list) .phone-tabs { display: none; }
  .phone-tabs button {
    flex: 1;
    height: 54px;
    border: 0;
    background: transparent;
    color: #7d8e9e;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    position: relative;
  }
  .phone-tabs button.on { color: #6ab3f3; }
  .tab-badge {
    position: absolute;
    top: 4px;
    margin-left: 28px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 8px;
    background: #40a7e3;
    color: #fff;
    font-size: 11px;
    line-height: 16px;
  }
  .app.tab-settings.show-list .side-head,
  .app.tab-settings.show-list .search-wrap,
  .app.tab-settings.show-list .chat-list,
  .app.tab-settings.show-list .pick-bar { display: none; }
  .app.tab-settings.show-list .phone-settings {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: auto;
  }
  .phone-settings .drawer-profile { flex: none; }
  html.kb-open .composer { padding-bottom: 8px; }
  .toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
}
body:has(.app.show-list:not(.hidden)) .toast { bottom: calc(78px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) {
  body:has(.app.show-list:not(.hidden)) .toast { bottom: 24px; }
}
@media (hover: none) {
  .actions { opacity: .85; }
}
