/* beemes в браузере и на Windows: медовый на тёмно-фиолетовом (тёмная тема) и на кремовом (светлая), шестиугольники. */
:root, [data-theme="dark"] {
  color-scheme: dark;
  --bg: #15121F; --surface: #1C1828; --c1: #221D33; --c2: #2A2440; --c3: #332C4C;
  --fg: #F3EFFF; --muted: #B4ADC9; --line: #3A3352; --outline: #6E6787;
  --primary: #FFB627; --on-primary: #241800; --primary-soft: #3A2B05; --on-primary-soft: #FFDE9E;
  --honey-a: #FFC23D; --honey-b: #FF8A00;
  --online: #39D98A; --danger: #FF6B6E;
  --bubble-in: #2A2440; --chip: rgba(255, 255, 255, 0.07);
  --comb-color: rgba(255, 182, 39, 0.05);
  --shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.7);
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #FFF8EA; --surface: #FFFFFF; --c1: #FBF2E1; --c2: #F4EBD8; --c3: #EDE2CB;
  --fg: #1B1626; --muted: #5F5870; --line: #E7DDC8; --outline: #A59D8C;
  --primary: #E89A00; --on-primary: #FFFFFF; --primary-soft: #FFE3A6; --on-primary-soft: #2B1D00;
  --online: #1FA866; --danger: #D32F2F;
  --bubble-in: #FFFFFF; --chip: rgba(0, 0, 0, 0.06);
  --comb-color: rgba(232, 154, 0, 0.07);
  --shadow: 0 18px 50px -24px rgba(80, 60, 20, 0.35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.45; overflow: hidden; -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
#app { height: 100%; }
.boot { display: grid; place-items: center; }
.boot img { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: 0.8; } }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; z-index: 100; background: var(--primary); color: var(--on-primary); padding: 6px 12px; border-radius: 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.pad { padding: 16px; }
.pad-x { padding: 0 14px 10px; }
.grow { flex: 1; }
.ic { flex: none; }

/* ---------- Кнопки, поля ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: none; cursor: pointer; border-radius: 999px;
  padding: 10px 20px; font-weight: 600; text-decoration: none; transition: filter 0.15s, transform 0.1s; background: var(--c2); color: var(--fg);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: linear-gradient(135deg, var(--honey-a, #FFC23D), var(--honey-b, #FF8A00)); color: #241800; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--fg); }
.btn-text { background: transparent; color: var(--primary); padding: 8px 12px; }
.btn-danger { background: transparent; color: var(--danger); }
.btn-wide { width: 100%; padding: 13px 20px; font-size: 16px; }
.btn-small { padding: 6px 14px; font-size: 13px; }
.link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 0 6px; font-weight: 600; }
.icon-btn {
  width: 42px; height: 42px; flex: none; display: inline-grid; place-items: center; border: none; border-radius: 50%;
  background: transparent; color: var(--muted); cursor: pointer; transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--chip); color: var(--fg); }
.icon-btn.on-color { color: var(--on, #fff); }
.icon-btn.on-color:hover { background: rgba(255, 255, 255, 0.18); }
.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--surface); border-radius: 14px; padding: 11px 14px; outline: none;
  transition: border-color 0.15s;
}
.input:focus { border-color: var(--primary); }
textarea.input { resize: vertical; min-height: 70px; }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-hint { margin: 0; font-size: 12.5px; color: var(--muted); min-height: 1em; }
.field-hint.bad, .form-error { color: var(--danger); }
.form-error { margin: 6px 0; font-size: 14px; min-height: 0; }
.form-error:empty { display: none; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-prefix { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.input-wrap.has-prefix .input { padding-left: 30px; }
.input-wrap:has(.pw-toggle) .input { padding-right: 44px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: none; cursor: pointer; opacity: 0.7; font-size: 16px; padding: 6px; border-radius: 8px; }
.pw-toggle[aria-pressed="true"] { opacity: 1; }
.check-row { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }
.switch { appearance: none; width: 46px; height: 28px; border-radius: 999px; background: var(--c3); position: relative; cursor: pointer; flex: none; transition: background 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform 0.2s; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(18px); }

/* ---------- Соты и аватары ---------- */
.comb, .auth-comb {
  position: absolute; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='72.75' viewBox='0 0 56 97'%3E%3Cpath d='M28 1 54 16v30L28 61 2 46V16z M28 61v36' fill='none' stroke='%23FFB627' stroke-opacity='.09' stroke-width='2.4'/%3E%3C/svg%3E");
}
.hex-avatar {
  --size: 48px; width: var(--size); height: calc(var(--size) * 1.1); flex: none; display: inline-grid; place-items: center; overflow: hidden;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(135deg, var(--a1), var(--a2)); color: var(--on); font-weight: 800; font-size: calc(var(--size) * 0.42);
}
.hex-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-wrap { position: relative; flex: none; display: inline-flex; }
.online-dot { position: absolute; right: 1px; bottom: 4px; width: 13px; height: 13px; border-radius: 50%; background: var(--online); box-shadow: 0 0 0 2.5px var(--surface); }
.animoji { display: inline-block; width: var(--s); height: var(--s); vertical-align: -0.3em; line-height: 1; }
.animoji svg { display: block; }
.name-status { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.name-status .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.name-status .animoji { vertical-align: middle; }

/* ---------- Вход ---------- */
.auth { position: relative; height: 100%; overflow: auto; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(80% 60% at 50% 0%, rgba(255, 182, 39, 0.12), transparent 70%), var(--bg); }
.auth-comb { -webkit-mask-image: radial-gradient(70% 60% at 50% 30%, #000 20%, transparent 75%); mask-image: radial-gradient(70% 60% at 50% 30%, #000 20%, transparent 75%); }
.auth-card { position: relative; width: min(440px, 100%); background: var(--surface); border-radius: 28px; padding: 28px 28px 24px; box-shadow: var(--shadow); display: grid; gap: 12px; }
.auth-hero { display: grid; place-items: center; margin: 4px 0 6px; }
.logo-float { filter: drop-shadow(0 14px 22px rgba(255, 138, 0, 0.35)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-8px) rotate(-2deg); } }
.auth-hero.small { margin: 0; }
.brand-title { margin: 0; text-align: center; font-size: 44px; font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
.brand-title span, .brand span { color: var(--primary); }
.auth-sub { margin: 0 0 6px; text-align: center; color: var(--muted); }
.features { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 10px; }
.features li { display: flex; gap: 12px; align-items: center; }
.features li > span:last-child { display: grid; font-size: 14px; color: var(--muted); }
.features b { color: var(--fg); font-size: 15px; }
.feat-ic { width: 34px; text-align: center; font-size: 26px; }
.auth-top { display: flex; align-items: center; gap: 6px; margin: -6px 0 0 -10px; }
.auth-top h1 { margin: 0; font-size: 22px; }
.auth-form { display: grid; gap: 2px; }
.note-card { display: flex; gap: 10px; align-items: flex-start; background: var(--primary-soft); color: var(--on-primary-soft); border-radius: 16px; padding: 12px 14px; font-size: 14px; }
.note-card p { margin: 0; }
.note-ic { font-size: 20px; }

/* ---------- Раскладка ---------- */
.layout { display: grid; grid-template-columns: minmax(300px, 380px) 1fr; height: 100vh; height: 100dvh; }
.sidebar { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.pane { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.side-header { display: flex; align-items: center; gap: 4px; padding: 12px 10px 10px 16px; min-height: 64px; }
.side-title { margin: 0 0 0 4px; font-size: 19px; }
.brand { font-size: 26px; font-weight: 900; letter-spacing: -0.03em; color: var(--fg); text-decoration: none; }
.me-btn { display: inline-flex; padding: 4px; border-radius: 12px; margin-left: 2px; }
.me-btn:hover { background: var(--chip); }

/* Список чатов */
.chat-list { flex: 1; overflow-y: auto; padding: 0 8px 90px; }
.chat-row { display: flex; gap: 12px; align-items: center; padding: 9px 10px; border-radius: 16px; color: inherit; text-decoration: none; }
.chat-row:hover { background: var(--chip); }
.chat-row.active { background: var(--primary-soft); }
.chat-main { flex: 1; min-width: 0; display: grid; gap: 1px; }
.chat-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.chat-line .name-status { flex: 1; }
.chat-line > .ic { color: var(--muted); }
.chat-time { margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--muted); }
.chat-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.tick.read { color: var(--primary); }
.badge { flex: none; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.badge.muted { background: var(--outline); color: var(--surface); }
.fab {
  position: absolute; right: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 18px; border: none; cursor: pointer;
  background: linear-gradient(135deg, #FFC23D, #FF8A00); color: #241800; display: grid; place-items: center; box-shadow: 0 10px 24px -8px rgba(255, 138, 0, 0.7);
}
.empty { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 40px 20px; }
.empty h3 { margin: 6px 0 0; }
.empty p { margin: 0 0 6px; }
.search-input { border-radius: 999px; }

/* Пустая правая часть */
.empty-pane { position: relative; flex: 1; display: grid; place-items: center; overflow: hidden; }
.empty-pane .comb { -webkit-mask-image: radial-gradient(60% 60% at 50% 45%, #000 10%, transparent 75%); mask-image: radial-gradient(60% 60% at 50% 45%, #000 10%, transparent 75%); }
.empty-pane-inner { position: relative; display: grid; justify-items: center; text-align: center; gap: 4px; padding: 20px; max-width: 420px; }
.empty-pane h2 { margin: 8px 0 0; }
.empty-pane p { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- Переписка ---------- */
.chat-pane { position: relative; flex: 1; display: flex; flex-direction: column; min-height: 0; }
.chat-pane.drop::after { content: "Отпустите, чтобы отправить фото"; position: absolute; inset: 10px; border: 2px dashed var(--primary); border-radius: 20px; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 80%, transparent); font-weight: 600; z-index: 5; }
.chat-header { display: flex; align-items: center; gap: 4px; padding: 8px 10px; min-height: 64px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; border: none; background: none; cursor: pointer; text-align: left; padding: 4px 8px; border-radius: 14px; }
.chat-who:hover { background: var(--chip); }
.who-text { display: grid; min-width: 0; }
.who-status { font-size: 13px; color: var(--muted); }
.who-status.online, .online { color: var(--online); }
.scroller { position: relative; flex: 1; overflow-y: auto; min-height: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='42' height='72.75' viewBox='0 0 56 97'%3E%3Cpath d='M28 1 54 16v30L28 61 2 46V16z M28 61v36' fill='none' stroke='%23FFB627' stroke-opacity='.06' stroke-width='2.4'/%3E%3C/svg%3E"); }
.messages { max-width: 860px; margin: 0 auto; padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 4px; }
.e2e-note { align-self: center; display: flex; gap: 8px; align-items: center; max-width: 440px; margin: 6px 0 10px; padding: 9px 14px; border-radius: 14px; background: var(--primary-soft); color: var(--on-primary-soft); font-size: 13px; text-align: center; }
.day-chip { align-self: center; margin: 10px 0 6px; }
.day-chip span { background: var(--chip); color: var(--muted); font-size: 12.5px; padding: 3px 12px; border-radius: 999px; backdrop-filter: blur(6px); }
.msg-row { display: flex; flex-direction: column; align-items: flex-start; }
.msg-row.mine { align-items: flex-end; }
.msg-row.flash .bubble { animation: flash 1.2s; }
@keyframes flash { 30% { box-shadow: 0 0 0 3px var(--primary); } }
.bubble {
  position: relative; max-width: min(72%, 560px); padding: 8px 12px 6px; border-radius: 20px 20px 20px 6px; background: var(--bubble-in);
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06); overflow-wrap: anywhere; outline-offset: 2px;
}
.mine .bubble { border-radius: 20px 20px 6px 20px; background: linear-gradient(135deg, var(--a1), var(--a2)); color: var(--on); }
.mine .bubble a { color: inherit; }
.bubble .text { white-space: pre-wrap; }
.meta { float: right; display: inline-flex; align-items: center; gap: 3px; margin: 6px 0 -2px 10px; font-size: 11.5px; opacity: 0.7; }
.mine .meta .ic { opacity: 0.95; }
.bubble.photo { padding: 4px; max-width: min(72%, 420px); }
.bubble.photo .meta { position: absolute; right: 10px; bottom: 8px; margin: 0; background: rgba(0, 0, 0, 0.45); color: #fff; opacity: 1; padding: 1px 7px; border-radius: 999px; }
.bubble.photo .photo-body:has(.caption) + .meta, .bubble.photo:has(.caption) .meta { position: static; float: right; background: none; color: inherit; margin: 4px 6px 2px 10px; padding: 0; opacity: 0.7; }
.photo-body { display: grid; }
.photo-wrap { border: none; padding: 0; background: none; cursor: zoom-in; border-radius: 16px; overflow: hidden; display: block; }
.photo-img { display: block; width: 100%; max-height: 460px; object-fit: cover; background: var(--c2); transition: filter 0.3s; }
.photo-img.blur { filter: blur(12px); transform: scale(1.04); }
.photo-img.broken { opacity: 0.4; }
.caption { padding: 6px 8px 0; }
.big-emoji { display: flex; align-items: flex-end; gap: 2px; }
.big-emoji .meta { float: none; align-self: flex-end; background: var(--chip); padding: 1px 8px; border-radius: 999px; margin: 0 0 6px 4px; }
.call-bubble { display: flex; gap: 10px; align-items: center; padding: 2px 0; }
.call-bubble small { display: block; opacity: 0.75; font-size: 12.5px; }
.call-ic { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: rgba(127, 127, 127, 0.18); }
.call-ic.missed { color: var(--danger); }
.quote { display: grid; text-align: left; width: 100%; border: none; cursor: pointer; margin: 0 0 4px; padding: 5px 10px; border-left: 3px solid currentColor; border-radius: 8px; background: rgba(127, 127, 127, 0.14); color: inherit; font-size: 13.5px; }
.quote b { color: inherit; }
.quote-text { opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undecryptable { font-style: italic; opacity: 0.75; }
.failed { font-size: 12.5px; color: var(--danger); margin: 2px 6px 4px; }
.empty-chat { display: grid; justify-items: center; gap: 4px; margin: auto; padding: 30px; text-align: center; color: var(--muted); }
.wave { border: none; background: none; cursor: pointer; border-radius: 30px; padding: 6px; }
.wave:hover { background: var(--chip); }

/* Поле ввода */
.composer { background: var(--surface); border-top: 1px solid var(--line); padding: 8px 12px 10px; }
.composer-row { display: flex; align-items: flex-end; gap: 4px; max-width: 900px; margin: 0 auto; }
.composer-input {
  flex: 1; resize: none; border: none; outline: none; background: var(--c1); border-radius: 22px; padding: 10px 16px; max-height: 180px; min-height: 42px;
  line-height: 1.4;
}
.composer-input:focus { box-shadow: inset 0 0 0 1.5px var(--primary); }
.send-btn { width: 44px; height: 44px; flex: none; border: none; border-radius: 50%; cursor: pointer; display: grid; place-items: center; background: linear-gradient(135deg, #FFC23D, #FF8A00); color: #241800; }
.reply-bar { display: flex; align-items: center; gap: 10px; max-width: 900px; margin: 0 auto 6px; padding: 6px 4px 6px 12px; border-left: 3px solid var(--primary); color: var(--primary); }
.reply-bar[hidden] { display: none; }
.bar-text { flex: 1; min-width: 0; display: grid; color: var(--fg); font-size: 13.5px; }
.bar-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.emoji-panel { max-width: 900px; margin: 8px auto 0; }
.emoji-panel[hidden] { display: none; }
.emoji-tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.emoji-tabs button { flex: none; border: none; background: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.emoji-tabs button[aria-selected="true"] { background: var(--primary-soft); color: var(--on-primary-soft); font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(50px, 1fr)); height: 230px; overflow-y: auto; }
.emoji-grid.tall { height: min(60vh, 420px); width: min(520px, 80vw); }
.emoji-cell { border: none; background: none; cursor: pointer; height: 50px; border-radius: 12px; display: grid; place-items: center; }
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--chip); }
.emoji-hint { margin: 6px 4px 0; font-size: 12px; color: var(--muted); }

/* Просмотр фото */
.viewer { position: fixed; inset: 0; z-index: 50; background: rgba(8, 6, 14, 0.92); display: grid; place-items: center; padding: 30px; }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6); }
.viewer-close { position: absolute; top: 14px; right: 14px; color: #fff; }
.viewer-save { position: absolute; bottom: 18px; color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.5); }
.photo-send { display: grid; gap: 12px; }
.photo-send img { max-width: min(520px, 80vw); max-height: 50vh; border-radius: 14px; justify-self: center; }

/* ---------- Профиль и настройки ---------- */
.profile-pane { flex: 1; overflow-y: auto; min-height: 0; }
.profile-head { position: relative; padding: 14px 14px 26px; background: linear-gradient(160deg, var(--a1), var(--a2)); color: var(--on); }
.profile-hero { display: grid; justify-items: center; text-align: center; gap: 4px; }
.profile-hero h1 { margin: 10px 0 0; font-size: 28px; }
.profile-hero p { margin: 0; opacity: 0.85; }
.profile-hero .online { color: inherit; font-weight: 600; }
.profile-body { max-width: 640px; margin: 0 auto; padding: 18px 18px 40px; display: flex; flex-direction: column; gap: 14px; }
.profile-body > * { flex: none; }
.profile-body h3, .settings h3 { margin: 10px 4px 2px; font-size: 13px; color: var(--primary); font-weight: 700; }
.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick-actions button { display: grid; justify-items: center; gap: 4px; border: none; cursor: pointer; padding: 14px 6px; border-radius: 18px; background: var(--c1); color: var(--primary); font-weight: 600; font-size: 13.5px; }
.quick-actions button:hover { background: var(--c2); }
.section { display: grid; gap: 6px; }
.card { background: var(--c1); border-radius: 20px; overflow: hidden; }
.card.pad { padding: 14px 16px; }
.row-item { width: 100%; display: flex; align-items: center; gap: 14px; padding: 13px 16px; border: none; background: none; cursor: pointer; text-align: left; color: inherit; text-decoration: none; }
.row-item + .row-item { border-top: 1px solid var(--line); }
.row-item:hover { background: var(--chip); }
.row-item > .ic { color: var(--primary); }
.row-item > span:not(.chev):not(.hex-avatar) { flex: 1; display: grid; min-width: 0; }
.row-item small { color: var(--muted); font-size: 13px; }
.row-item.danger, .row-item.danger > .ic { color: var(--danger); }
.row-item.active { background: var(--primary-soft); }
.chev { color: var(--outline); font-size: 22px; line-height: 1; }
.pane-header { display: flex; align-items: center; gap: 6px; padding: 10px 12px; min-height: 64px; border-bottom: 1px solid var(--line); background: var(--surface); }
.pane-header h2 { margin: 0; font-size: 19px; }
.settings { flex: 1; overflow-y: auto; padding: 0 12px 24px; display: flex; flex-direction: column; gap: 8px; }
.settings > * { flex: none; }
.me-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 22px; background: var(--c1); color: inherit; text-decoration: none; }
.me-card > span:not(.hex-avatar) { flex: 1; display: grid; min-width: 0; }
.me-card small { color: var(--muted); }
.me-card > .ic { color: var(--primary); }
.me-card.active { background: var(--primary-soft); }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line); overflow: hidden; }
.segmented button { border: none; background: none; cursor: pointer; padding: 8px 6px; font-size: 13.5px; }
.segmented button + button { border-left: 1.5px solid var(--line); }
.segmented button[aria-checked="true"] { background: var(--primary-soft); color: var(--on-primary-soft); font-weight: 600; }
.accents { display: flex; flex-wrap: wrap; gap: 10px; }
.accent { width: 46px; height: 51px; border: none; cursor: pointer; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: linear-gradient(135deg, var(--a1), var(--a2)); transition: transform 0.15s; }
.accent:hover { transform: scale(1.06); }
.accent[aria-checked="true"] { transform: scale(1.12); }
.accent[aria-checked="true"]::after { content: "✓"; color: var(--on); font-weight: 900; font-size: 20px; }
.avatar-edit { position: relative; border: none; background: none; padding: 0; cursor: pointer; }
.avatar-cam { position: absolute; right: 2px; bottom: 10px; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
.status-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; background: var(--c1); }
.status-box > span:nth-child(2) { flex: 1; display: grid; }
.status-box small { color: var(--muted); }
.status-preview { width: 44px; text-align: center; font-size: 30px; }
.form .btn-primary { justify-self: start; }
.safety-body { display: grid; justify-items: center; gap: 18px; padding: 30px 20px; max-width: 520px; margin: 0 auto; text-align: center; }
.safety-code { display: grid; grid-template-columns: repeat(2, auto); gap: 6px 36px; padding: 18px 30px; border-radius: 22px; background: var(--c1); font: 700 30px/1.3 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.06em; }
.about { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 30px 20px; max-width: 520px; margin: 0 auto; }

.push-test p { margin: 0 0 10px; }
.ok-line { color: var(--online); }
.bad-line { color: var(--danger); }

/* ---------- Окна, меню, уведомления ---------- */
.modal-back { position: fixed; inset: 0; z-index: 40; background: rgba(8, 6, 14, 0.55); display: grid; place-items: center; padding: 16px; animation: fade 0.15s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 26px; padding: 22px 22px 14px; box-shadow: var(--shadow); }
.modal.wide { width: auto; }
.modal-title { margin: 0 0 10px; font-size: 20px; }
.modal-body p { margin: 0 0 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.popup-menu { position: fixed; z-index: 45; min-width: 210px; padding: 6px; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow), 0 0 0 1px var(--line); display: grid; }
.popup-menu button { display: flex; align-items: center; gap: 12px; border: none; background: none; cursor: pointer; padding: 9px 12px; border-radius: 10px; text-align: left; }
.popup-menu button:hover, .popup-menu button:focus-visible { background: var(--chip); outline: none; }
.popup-menu button .ic { color: var(--muted); }
.popup-menu button.danger, .popup-menu button.danger .ic { color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; transition: 0.25s; background: var(--fg); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow); }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.notify-ask { position: fixed; left: 16px; bottom: 16px; z-index: 30; display: flex; align-items: center; gap: 10px; max-width: 360px; padding: 10px 8px 10px 14px; border-radius: 18px; background: var(--surface); box-shadow: var(--shadow), 0 0 0 1px var(--line); font-size: 14px; }
.notify-ask > .ic { color: var(--primary); }

/* Входящий звонок */
.incoming { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: radial-gradient(70% 60% at 50% 30%, #3A2B5C, rgba(16, 12, 26, 0.96)); color: #fff; animation: fade 0.2s; }
.incoming-card { display: grid; justify-items: center; text-align: center; gap: 6px; }
.incoming-card h2 { margin: 18px 0 0; font-size: 30px; }
.incoming-card p { margin: 0; opacity: 0.8; }
.incoming-pulse { position: relative; }
.incoming-pulse::before { content: ""; position: absolute; inset: -10px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: #FFB627; animation: ring 1.6s ease-out infinite; z-index: -1; }
@keyframes ring { from { opacity: 0.5; transform: scale(1); } to { opacity: 0; transform: scale(1.5); } }
.incoming-actions { display: flex; gap: 70px; margin-top: 40px; }
.round-btn { width: 74px; height: 74px; border-radius: 50%; border: none; cursor: pointer; display: grid; place-items: center; color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.round-btn.answer { background: #2BC48A; animation: glow 1.4s ease-out infinite; }
.round-btn.decline { background: #F0444F; }
.round-btn.decline .ic { transform: rotate(135deg); }
@keyframes glow { from { box-shadow: 0 0 0 0 rgba(43, 196, 138, 0.6), 0 10px 30px rgba(0, 0, 0, 0.4); } to { box-shadow: 0 0 0 22px rgba(43, 196, 138, 0), 0 10px 30px rgba(0, 0, 0, 0.4); } }

.only-narrow { display: none; }

/* ---------- Узкое окно / телефон: одна колонка ---------- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .layout[data-view="side"] .pane, .layout[data-view="pane"] .sidebar { display: none; }
  .sidebar { border-right: none; }
  .only-narrow { display: inline-grid; }
  .bubble { max-width: 86%; }
  .messages { padding: 10px 10px 8px; }
  .auth-card { padding: 22px 18px 18px; }
  .incoming-actions { gap: 50px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
