/* ============================== Tokenlar ============================== */

:root,
[data-tone="graphite"] {
  --bg: #111113;
  --panel: #161618;
  --raise: #1d1d20;
  --hover: #232327;
  --line: #26262b;
  --line-2: #33333a;
  --text: #ececee;
  --muted: #8d8d95;
  --faint: #5a5a62;
  --them: #1b1b1e;
  --them-text: #e6e6e9;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, .6), 0 0 0 1px rgba(255, 255, 255, .02);
  --mix-base: #1d1d20;
  color-scheme: dark;
}

[data-tone="night"] {
  --bg: #000;
  --panel: #08080a;
  --raise: #111113;
  --hover: #17171a;
  --line: #1a1a1e;
  --line-2: #26262b;
  --text: #e8e8ea;
  --muted: #7d7d85;
  --faint: #4a4a52;
  --them: #0f0f11;
  --them-text: #e2e2e5;
  --mix-base: #121214;
}

[data-tone="mist"] {
  --bg: #e7e7ea;
  --panel: #f1f1f3;
  --raise: #fbfbfc;
  --hover: #e3e3e7;
  --line: #d9d9de;
  --line-2: #c9c9cf;
  --text: #17171a;
  --muted: #696970;
  --faint: #a2a2aa;
  --them: #fbfbfc;
  --them-text: #1b1b1e;
  --scrim: rgba(20, 20, 24, .35);
  --shadow: 0 24px 60px -16px rgba(20, 20, 30, .28), 0 0 0 1px rgba(0, 0, 0, .03);
  --mix-base: #2a2a2e;
  color-scheme: light;
}

[data-accent="silver"] { --accent: #d4d4d9; --accent-ink: #111113; }
[data-accent="ice"]    { --accent: #a9b6c8; --accent-ink: #0f1217; }
[data-accent="sand"]   { --accent: #cbbca4; --accent-ink: #15120d; }
[data-accent="sage"]   { --accent: #adbdad; --accent-ink: #0f130f; }

[data-tone="mist"][data-accent="silver"] { --accent: #3a3a40; --accent-ink: #fafafa; }
[data-tone="mist"][data-accent="ice"]    { --accent: #4f5f75; --accent-ink: #fafafa; }
[data-tone="mist"][data-accent="sand"]   { --accent: #7a6a50; --accent-ink: #fafafa; }
[data-tone="mist"][data-accent="sage"]   { --accent: #566a57; --accent-ink: #fafafa; }

:root { --fs: 15px; --r: 18px; --r-tail: 6px; }
[data-size="s"] { --fs: 14px; }
[data-size="m"] { --fs: 15px; }
[data-size="l"] { --fs: 17px; }

:root {
  --me: color-mix(in srgb, var(--accent) 17%, var(--mix-base));
  --me-text: #f3f3f5;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ============================== Temel ============================== */

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

/* Uygulama gibi hissettirsin: sayfa yakınlaşmaz, kenardan sekmez, düğmeler seçilip büyüteç açılmaz.
   Yazı alanları ve fotoğraf görüntüleyici bunun dışında. */
html, body { height: 100%; margin: 0; overscroll-behavior: none; }
/* pan-x pan-y: sadece kaydırma; iki parmakla ve çift dokunuşla yakınlaşma tarayıcıya hiç bırakılmaz. */
html, body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; touch-action: pan-x pan-y; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, [contenteditable] { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs)/1.45 var(--font);
  letter-spacing: -.005em;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
/* iPhone'da ana ekrandan açılınca 100dvh ekranın altını tam doldurmuyor; sabit konum hep doldurur. */
#app { position: fixed; inset: 0; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

.ic { flex: none; display: block; }
.muted { color: var(--muted); margin: 0 0 14px; font-size: .92em; }

/* ============================== Logo ============================== */

.logo-mark {
  --s: 26px;
  --w: 3.5px;
  position: relative;
  width: var(--s);
  height: var(--s);
  flex: none;
  border-radius: 50%;
  background: conic-gradient(from 60deg,
    color-mix(in srgb, var(--accent) 6%, transparent),
    var(--accent) 300deg,
    transparent 300deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--w) - .5px), #000 calc(100% - var(--w)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--w) - .5px), #000 calc(100% - var(--w)));
}
/* Halka yavaşça döner; uygulamanın her yerindeki logo canlı durur. */
.logo-mark { animation: logo-spin 4.5s linear infinite; }
@keyframes logo-spin { to { transform: rotate(360deg); } }
.logo-mark.big { --s: 56px; --w: 6px; margin: 0 auto 18px; }
.logo-mark.huge { --s: 96px; --w: 9px; opacity: .14; }

/* Açılış: uygulama hazır olana kadar ortada dönen halka. */
.splash { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: var(--bg); transition: opacity .25s ease; }
.splash .logo-mark { --s: 72px; --w: 7px; margin: 0; }
.splash.gone { opacity: 0; pointer-events: none; }

/* ============================== Butonlar ============================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 14px;
  font-weight: 600; letter-spacing: -.01em;
  transition: transform .15s var(--ease), background-color .2s, opacity .2s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn.danger { background: #b4413c; color: #fff; }
.btn.ghost { color: var(--muted); height: 40px; font-weight: 500; font-size: .92em; }
.btn.ghost:hover { color: var(--text); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; color: var(--muted);
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--raise); border: 1px solid var(--line);
  border-radius: 14px; padding: 4px; gap: 4px;
}
.seg button {
  height: 36px; border-radius: 10px; color: var(--muted); font-weight: 500; font-size: .93em;
  transition: background-color .2s, color .2s;
}
.seg button.on { background: var(--hover); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 1px 3px rgba(0, 0, 0, .25); }
.seg.small button { height: 30px; padding: 0 12px; font-size: .88em; }

.field {
  display: flex; align-items: center; gap: 10px;
  height: 50px; padding: 0 14px; margin-bottom: 10px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 14px;
  color: var(--faint);
  transition: border-color .2s, box-shadow .2s;
}
.field:focus-within { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); color: var(--muted); }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text); }
.field input::placeholder { color: var(--faint); }

.form-err { min-height: 1.3em; margin: 10px 0 0; font-size: .86em; color: #e0716b; text-align: center; }

/* ============================== Giriş ============================== */

.auth {
  height: 100%; display: grid; place-items: center; padding: 24px 16px;
  overflow-y: auto;
  background: radial-gradient(900px 520px at 50% -12%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
}
.auth-card { width: 100%; max-width: 360px; text-align: center; animation: rise .5s var(--ease) both; }
.auth h1 { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.03em; }
.auth .tag { margin: 6px 0 28px; color: var(--muted); font-size: .95em; }
.auth .seg { margin-bottom: 14px; }
.auth form { text-align: left; }
.auth .install-btn { margin-top: 8px; }

/* ============================== Yerleşim ============================== */

.main { display: grid; grid-template-columns: 340px 1fr; height: 100%; }
.list-pane { display: flex; flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.chat-pane { position: relative; display: flex; min-width: 0; min-height: 0; background: var(--bg); }
.chat { display: flex; flex-direction: column; flex: 1; min-width: 0; min-height: 0; }
.placeholder { flex: 1; display: grid; place-items: center; }

.bar {
  display: flex; align-items: center; gap: 8px;
  min-height: calc(60px + var(--safe-t)); padding: var(--safe-t) 10px 0 14px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 23px; letter-spacing: -.03em; flex: 1; }
.brand .logo-mark { --s: 30px; --w: 4px; }
.bar-actions { display: flex; gap: 2px; }

.conn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

/* ============================== Sohbet listesi ============================== */

.chats { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; }
.chat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 14px; cursor: pointer;
  transition: background-color .15s;
}
.chat-item:hover { background: var(--hover); }
.chat-item.on { background: var(--raise); box-shadow: inset 0 0 0 1px var(--line); }
.chat-item .body { flex: 1; min-width: 0; }
.chat-item .name { font-weight: 600; letter-spacing: -.01em; }
.chat-item .prev { color: var(--muted); font-size: .9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .prev.typing { color: var(--accent); }
.chat-item .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.chat-item .time { font-size: 11.5px; color: var(--faint); }
.chat-item .left { display: flex; align-items: center; gap: 4px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chat-item .left.soon { color: #e0716b; }
.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 600; font-size: 17px; color: #ededf0; text-transform: uppercase;
  background: linear-gradient(145deg, var(--a1, #3a3a40), var(--a2, #26262b));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}

.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--faint); padding-bottom: 60px; }
.empty p { margin: 0; font-size: .92em; }
.empty-btn {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  border: 1px dashed var(--line-2); color: var(--muted);
  transition: border-color .2s, color .2s, transform .2s var(--ease);
}
.empty-btn:hover { border-color: var(--accent); color: var(--text); transform: scale(1.04); }
.empty-btn .ic { width: 26px; height: 26px; }

/* ============================== Alt menü ============================== */

/* Ana eylemler ekranın altında: telefonu tek elle tutarken sağ başparmak buraya rahat uzanır.
   Sohbetler Kişiler'den başladığı için o en sağda. */
.dock {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px calc(8px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--panel);
  flex: none;
}
.dock-btn {
  flex: 1; min-width: 0; height: 54px; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11.5px; font-weight: 500; letter-spacing: 0;
  transition: background-color .15s, color .15s, transform .15s var(--ease);
}
.dock-btn:hover { background: var(--hover); color: var(--text); }
.dock-btn:active { transform: scale(.95); }
.dock-btn .ic { width: 22px; height: 22px; }

/* ============================== Sohbet ============================== */

.peer {
  display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;
  padding: 4px 8px 4px 4px; margin-left: -4px; border-radius: 14px;
  text-align: left; cursor: default; transition: background-color .15s;
}
.peer.clickable { cursor: pointer; }
.peer.clickable:hover { background: var(--hover); }
.peer .avatar { width: 38px; height: 38px; font-size: 15px; }
.peer-text { min-width: 0; display: flex; flex-direction: column; }
.peer-name { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peer-sub { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); }
.peer-sub.typing { color: var(--accent); }
.back { display: none; }

.msgs {
  flex: 1; overflow-y: auto; overscroll-behavior: contain;
  padding: 16px clamp(12px, 4vw, 40px) 8px;
  display: flex; flex-direction: column;
}
.msgs::before { content: ""; flex: 1; }
.msgs, .chats { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.msgs:has(.hint)::before { display: none; }

.hint {
  align-self: center; margin: auto 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--faint); font-size: .88em; text-align: center;
}
.hint div { max-width: 300px; text-wrap: balance; }

.msg { display: flex; margin-top: 3px; }
.msg.me { justify-content: flex-end; }
.msg.me + .msg.them, .msg.them + .msg.me { margin-top: 12px; }

.bubble {
  position: relative;
  max-width: min(78%, 560px);
  padding: 8px 12px 6px;
  border-radius: var(--r);
  transition: opacity .4s, filter .4s;
}
.me .bubble { background: var(--me); color: var(--me-text); border-bottom-right-radius: var(--r-tail); }
.them .bubble { background: var(--them); color: var(--them-text); border: 1px solid var(--line); border-bottom-left-radius: var(--r-tail); }
[data-tone="mist"] .them .bubble { box-shadow: 0 1px 2px rgba(0, 0, 0, .04); }

.text { white-space: pre-wrap; overflow-wrap: anywhere; }
.meta {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  margin-top: 2px; font-size: 11px; line-height: 16px;
  opacity: .6; font-variant-numeric: tabular-nums;
}
.st { display: flex; align-items: center; gap: 4px; }
.ring { width: 13px; height: 13px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 2.4; }
.ring .bg { stroke: currentColor; opacity: .22; }
.ring .fg { stroke: currentColor; stroke-linecap: round; transition: stroke-dashoffset .3s linear; }
.msg:not(.waiting) .meta { opacity: .85; }

.msg.enter .bubble { animation: pop .28s var(--ease) both; }
.msg.dying .bubble { animation: fade 1s ease-in-out infinite alternate; }
.msg.leaving { animation: vanish .55s var(--ease) forwards; }

/* ============================== Yazma alanı ============================== */

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px clamp(10px, 4vw, 40px) calc(10px + var(--safe-b));
  flex: none;
}
.composer textarea {
  flex: 1; min-width: 0; resize: none;
  max-height: 160px; min-height: 46px;
  padding: 12px 16px; line-height: 1.4;
  background: var(--raise); border: 1px solid var(--line); border-radius: 23px;
  outline: 0; color: var(--text);
  transition: border-color .2s;
}
.composer textarea:focus { border-color: var(--line-2); }
.composer textarea::placeholder { color: var(--faint); }
.send {
  width: 46px; height: 46px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  transition: transform .15s var(--ease), opacity .2s;
}
.send:active:not(:disabled) { transform: scale(.92); }
.send:disabled { opacity: .25; }

/* ============================== Diyaloglar ============================== */

dialog.sheet {
  width: min(420px, calc(100vw - 24px));
  max-height: min(86vh, 720px);
  padding: 0; border: 1px solid var(--line); border-radius: 22px;
  background: var(--panel); color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
}
dialog.sheet[open] { animation: rise .3s var(--ease); }
dialog.sheet:focus { outline: none; }
dialog.sheet::backdrop { background: var(--scrim); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.sheet-in { padding: 8px 18px 20px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px 10px 0; min-height: 48px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.02em; }

.me-card { display: flex; align-items: center; gap: 12px; padding: 4px 0 16px; }
.me-name { font-weight: 650; font-size: 1.05em; }

.group { background: var(--raise); border: 1px solid var(--line); border-radius: 16px; padding: 4px 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.row + .row { border-top: 1px solid var(--line); }
.lbl { color: var(--muted); font-size: .92em; }

.swatches { display: flex; gap: 8px; }
.swatch {
  width: 28px; height: 28px; border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .35);
  transition: transform .15s var(--ease), box-shadow .2s;
}
.swatch:hover { transform: scale(1.08); }
.swatch.on { box-shadow: inset 0 0 0 1px rgba(128, 128, 128, .35), 0 0 0 2px var(--panel), 0 0 0 4px var(--text); }

.group.list { padding: 4px; }
.item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  height: 46px; padding: 0 12px; border-radius: 12px;
  text-align: left; color: var(--text);
  transition: background-color .15s;
}
.item:hover { background: var(--hover); }
.item .ic { color: var(--muted); }
.item.danger, .item.danger .ic { color: #e0716b; }
.item-sub { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: .84em; -webkit-user-select: text; user-select: text; }
.item.done, .item.done .ic { color: var(--accent); }

.pw-form { display: grid; gap: 8px; padding: 6px 10px 12px; }
.pw-form input {
  height: 44px; padding: 0 14px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line); outline: 0;
}
.pw-form input:focus { border-color: var(--line-2); }
.pw-form .btn { height: 42px; }
.pw-form .form-err { margin: 0; min-height: 0; }

.steps { margin: 0; padding: 0 0 4px; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li {
  counter-increment: s; display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line);
}
.steps li::before {
  content: counter(s); width: 24px; height: 24px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--accent); color: var(--accent-ink);
}
.steps .ic { display: inline-block; vertical-align: -4px; color: var(--muted); }

/* ============================== Bildirim ============================== */

.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); z-index: 50;
  transform: translateX(-50%);
  padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  font-size: .9em; font-weight: 500; box-shadow: var(--shadow);
  animation: rise .25s var(--ease);
  max-width: calc(100vw - 32px);
}

/* ============================== Animasyonlar ============================== */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@keyframes fade { to { opacity: .45; } }
@keyframes pulse { 50% { opacity: .25; transform: scale(.8); } }
@keyframes vanish {
  to { opacity: 0; filter: blur(8px); transform: scale(.96); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============================== Mobil ============================== */

@media (max-width: 760px) {
  .main { grid-template-columns: 1fr; }
  .list-pane { border-right: 0; }
  .chat-pane { display: none; }
  .main.in-chat .list-pane { display: none; }
  .main.in-chat .chat-pane { display: flex; }
  .placeholder { display: none; }
  .back { display: grid; margin-left: -6px; }
  .bar { padding-left: 12px; }

  dialog.sheet {
    width: 100%; max-width: 100%;
    margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0;
    max-height: 90vh;
  }
  dialog.sheet[open] { animation: slide .32s var(--ease); }
  dialog.sheet { transition: transform .25s var(--ease); }
  /* Tutamaç: pencere başlığından aşağı çekilince kapanır. */
  dialog.sheet::before {
    content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
    width: 38px; height: 4px; border-radius: 2px; background: var(--line-2);
  }
  .sheet-in { padding-bottom: calc(20px + var(--safe-b)); }
  .sheet-head { padding-top: 6px; }

  /* Parmakla rahat dokunulsun diye hedefler büyür. */
  .icon-btn { width: 44px; height: 44px; }
  .chat-item { padding: 12px 10px; }
  .chats { padding: 6px 8px; }
  .item { height: 52px; }
}
@keyframes slide { from { transform: translateY(40px); opacity: 0; } }

@media (hover: none) {
  .chat-item:hover, .icon-btn:hover, .item:hover { background: transparent; }
  .chat-item.on:hover { background: var(--raise); }
}

/* ============================== Anahtar (switch) ============================== */

.switch { position: relative; width: 46px; height: 28px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--line-2); transition: background-color .2s; }
.switch span::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%;
  background: #f4f4f5; box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
  transition: transform .2s var(--ease);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); background: var(--accent-ink); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; }
.lbl-i { display: flex; align-items: center; gap: 10px; }
.lbl-i .ic { color: var(--muted); }

/* ============================== Gruplar ============================== */

.avatar.grp { border-radius: 32%; }
.avatar.big { width: 72px; height: 72px; font-size: 28px; }
.sender {
  font-size: 12px; font-weight: 600; color: var(--muted);
  margin: 10px 0 3px 12px; letter-spacing: -.01em;
}
.msg { flex-wrap: wrap; }
.msg .sender { flex-basis: 100%; }

.new-pane { margin-top: 14px; }
.add-row { display: flex; gap: 8px; align-items: flex-start; }
.add-row .field { flex: 1; }
.add-btn { width: 50px; height: 50px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line); flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.chips:empty { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 4px 3px 3px; border-radius: 999px;
  background: var(--raise); border: 1px solid var(--line); font-size: .9em;
}
.chip .avatar { width: 22px; height: 22px; font-size: 11px; }
.chip-x { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chip-x:hover { background: var(--hover); color: var(--text); }
.pick:empty { display: none; }
.pick { margin: 0 0 12px; }
.pick-title { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; margin: 4px 2px 6px; }
.pick-list { max-height: 228px; overflow-y: auto; overscroll-behavior: contain; border-radius: 14px; background: var(--raise); border: 1px solid var(--line); }
.pick-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 12px; text-align: left; }
.pick-row + .pick-row { border-top: 1px solid var(--line); }
.pick-row .avatar { width: 32px; height: 32px; font-size: 14px; flex: none; }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-mark { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--muted); border: 1px solid var(--line-2); }
.pick-row.on .pick-mark { background: var(--text); color: var(--bg); border-color: transparent; }
@media (hover: hover) { .pick-row:hover { background: var(--hover); } }

.grp-hero { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 0 14px; }
.grp-rename { display: flex; align-items: center; gap: 4px; max-width: 100%; }
.grp-rename input {
  min-width: 0; width: 240px; max-width: 70vw; text-align: center;
  font-size: 1.1em; font-weight: 650; letter-spacing: -.02em;
  background: none; border: 1px solid transparent; border-radius: 10px; padding: 6px 8px; outline: 0;
}
.grp-rename input:not([readonly]):hover, .grp-rename input:focus { border-color: var(--line); background: var(--raise); }
.grp-count { color: var(--muted); font-size: .88em; }
.members { list-style: none; margin: 4px 0 12px; padding: 0; display: grid; gap: 2px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 4px; border-radius: 12px; }
.member .avatar { width: 36px; height: 36px; font-size: 14px; }
.mb-info { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.mb-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-size: 11px; flex: none; }
.mb-acts { display: flex; gap: 4px; flex: none; }
.mini {
  height: 28px; padding: 0 10px; border-radius: 9px; font-size: 12px; font-weight: 500;
  background: var(--raise); border: 1px solid var(--line); color: var(--muted);
}
.mini:hover { color: var(--text); border-color: var(--line-2); }
.mini.danger:hover { color: #e0716b; }

/* ============================== Yazma alanı: ekler ve ses ============================== */

.attach-wrap { position: relative; flex: none; }
.attach { width: 46px; height: 46px; border-radius: 50%; }
.attach[aria-expanded="true"] { background: var(--hover); color: var(--text); }
.attach[aria-expanded="true"] .ic { transform: rotate(45deg); }
.attach .ic { transition: transform .2s var(--ease); }
.attach-menu {
  position: absolute; left: 0; bottom: 54px; z-index: 5;
  width: max-content; padding: 6px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; gap: 2px; animation: rise .2s var(--ease);
}
.attach-menu button {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px 0 12px; border-radius: 11px;
  text-align: left; color: var(--text); white-space: nowrap;
}
.attach-menu button:hover { background: var(--hover); }
.attach-menu .ic { color: var(--muted); }
html:not(.touch) .touch-only { display: none; }

.recbar {
  flex: 1; min-width: 0; height: 46px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px 0 4px; border-radius: 23px; background: var(--raise); border: 1px solid var(--line);
}
.recbar .icon-btn { width: 38px; height: 38px; border-radius: 50%; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: #e0605a; animation: pulse 1.1s ease-in-out infinite; flex: none; }
.rec-time { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec-hint { color: var(--muted); font-size: .88em; margin-left: auto; }
.composer.recording .send { background: #e0605a; color: #fff; }

/* ============================== Medya ============================== */

.bubble.kind-image, .bubble.kind-video { padding: 4px; }
.bubble.kind-image .meta, .bubble.kind-video .meta { padding: 0 8px 2px; }
.bubble.kind-audio { min-width: 240px; }

.media { position: relative; border-radius: calc(var(--r) - 4px); overflow: hidden; }
.media.ready img, .media.ready video {
  display: block; max-width: min(300px, 66vw); max-height: 380px; width: auto; height: auto;
  border-radius: calc(var(--r) - 4px); background: rgba(0, 0, 0, .25);
}
.media.ready img { pointer-events: none; }
.media-image.ready { cursor: zoom-in; }
.media img, .media video, .viewer img { -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
.wm {
  position: absolute; inset: 0; pointer-events: none;
  background-image: var(--wm); background-size: 200px 120px;
}

.media-card {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 220px;
  padding: 8px 10px 8px 8px; border-radius: calc(var(--r) - 4px); text-align: left; color: inherit;
  background: color-mix(in srgb, currentColor 6%, transparent);
}
button.media-card:hover:not(:disabled) { background: color-mix(in srgb, currentColor 10%, transparent); }
.mc-icon {
  width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.mc-icon .ring.big { width: 28px; height: 28px; }
.mc-icon .ring.big circle { stroke-width: 2; }
.mc-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.mc-title { font-weight: 600; font-size: .95em; }
.mc-sub { font-size: .8em; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-cancel { width: 32px; height: 32px; color: inherit; opacity: .7; }
.msg.pending .bubble { opacity: .92; }

.audio { display: flex; align-items: center; gap: 10px; padding: 4px 2px 0; }
.ap-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, currentColor 14%, transparent); color: inherit;
}
.ap-track { flex: 1; height: 24px; display: flex; align-items: center; cursor: pointer; position: relative; }
.ap-track::before { content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: currentColor; opacity: .2; }
.ap-fill { position: relative; height: 3px; border-radius: 2px; background: currentColor; width: 0; }
.ap-time { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .75; min-width: 34px; text-align: right; }

.loc {
  display: flex; align-items: center; gap: 12px; min-width: 230px;
  padding: 8px 10px 8px 8px; border-radius: calc(var(--r) - 4px);
  color: inherit; text-decoration: none;
  background: color-mix(in srgb, currentColor 6%, transparent);
}
.loc:hover { background: color-mix(in srgb, currentColor 10%, transparent); }
.loc-pin {
  width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.loc-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.loc-title { font-weight: 600; font-size: .95em; }
.loc-sub { font-size: .8em; opacity: .7; font-variant-numeric: tabular-nums; }
.loc-go { opacity: .6; }

/* Görüntüleyici */
dialog.viewer {
  max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; margin: 0; padding: 0;
  border: 0; background: rgba(0, 0, 0, .92);
}
dialog.viewer[open] { display: grid; place-items: center; animation: fadein .2s ease; }
dialog.viewer::backdrop { background: transparent; }
dialog.viewer:focus { outline: none; }
.viewer-in { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; }
.viewer-frame { position: relative; max-width: 100%; max-height: 100%; transform-origin: 0 0; will-change: transform; }
dialog.viewer, .viewer-in { touch-action: none; }
.viewer-frame img { display: block; max-width: calc(100vw - 32px); max-height: calc(100vh - 32px); border-radius: 12px; }
@keyframes fadein { from { opacity: 0; } }

/* ============================== İlk giriş pencereleri ============================== */

.sheet-in.center { text-align: center; padding-top: 28px; display: flex; flex-direction: column; align-items: center; }
.sheet-in.center h2 { margin: 14px 0 6px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.sheet-in.center .muted { margin-bottom: 20px; max-width: 300px; }
.sheet-in.center .btn.block + .btn.block { margin-top: 6px; }
.hero-icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .5); }
.hero-bell {
  width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, var(--raise)); color: var(--accent);
}
.hero-bell .ic { width: 34px; height: 34px; }

/* ============================== Gizlilik perdesi ============================== */

.shield {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(26px) saturate(.6); backdrop-filter: blur(26px) saturate(.6);
}
.shield .logo-mark { margin: 0; opacity: .5; }
body.shielded .main { filter: blur(18px); }

/* ============================== Uygulama kilidi ============================== */

.lock {
  position: fixed; inset: 0; z-index: 110;
  display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b));
  overflow-y: auto;
  background: radial-gradient(900px 520px at 50% -12%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%), var(--bg);
}
.lock h1 { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.lock .tag { margin: 6px 0 24px; color: var(--muted); font-size: .95em; }
.lock form { text-align: left; }
.lock-mark {
  width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, var(--raise)); color: var(--accent);
}
.lock-mark .ic { width: 28px; height: 28px; }
body.locked .main { visibility: hidden; }
#lockAfterRow .lbl { white-space: nowrap; }
/* Telefonda form alta, başparmağın erişeceği yere iner. */
@media (max-width: 760px) {
  .lock { place-items: end center; padding-bottom: calc(40px + var(--safe-b)); }
}

@media print {
  #app { display: none !important; }
}

@media (max-width: 760px) {
  .attach-menu { min-width: 200px; }
  .bubble.kind-audio { min-width: 220px; }
}

/* ============================== Kişiler ============================== */

#contactBtn.on { color: var(--accent); }
#contactForm { margin-bottom: 2px; }
#contactErr:empty, #grpErr:empty { min-height: 0; margin: 0; }

.cg { margin-top: 16px; }
.cg-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 8px;
  font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.cg-title .ic { width: 15px; height: 15px; }
.cg-count { margin-left: auto; font-weight: 500; letter-spacing: 0; color: var(--faint); }

.favs { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: none; }
.favs::-webkit-scrollbar { display: none; }
.fav {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  width: 64px; flex: none; font-size: 12px; color: var(--text);
}
.fav .avatar { width: 54px; height: 54px; font-size: 20px; transition: transform .15s var(--ease); }
.fav:hover .avatar { transform: scale(1.05); }
.fav span:last-child { max-width: 64px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.clist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.crow { display: flex; align-items: center; border-radius: 12px; transition: background-color .15s; }
.crow:hover { background: var(--hover); }
.crow-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px;
  padding: 7px 6px; text-align: left; color: var(--text);
}
.crow-main .avatar { width: 38px; height: 38px; font-size: 15px; }
.crow-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow-sub { flex: none; color: var(--muted); font-size: .85em; }
.crow-del { width: 34px; height: 34px; margin-right: 2px; opacity: .45; }
.crow-fav { width: 38px; height: 38px; color: var(--faint); }
.crow-fav.on { color: var(--accent); }
.crow-fav.on .ic { fill: currentColor; }
.crow:hover .crow-del, .crow-del:focus-visible { opacity: 1; }
.cg-empty { margin: 0; padding: 8px 6px; color: var(--faint); font-size: .9em; }
.cg-note {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin: 20px 0 2px; color: var(--faint); font-size: 12px;
}
.cg-note .ic { width: 13px; height: 13px; }

/* ============================== Hakkında ============================== */

.about-hero { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0 4px; }
.about-hero .logo-mark.big { margin: 0 0 10px; }
.about-name { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.about-tag { color: var(--muted); font-size: .9em; }
.about-sec { margin-top: 18px; }
.about-list {
  list-style: none; margin: 0; padding: 2px 14px;
  background: var(--raise); border: 1px solid var(--line); border-radius: 16px;
}
.about-list li { padding: 10px 0; font-size: .92em; line-height: 1.45; }
.about-list li + li { border-top: 1px solid var(--line); }

@media (hover: none) {
  .crow:hover { background: transparent; }
  .crow-del { opacity: .7; }
}

/* ============================== Sayaç ============================== */

/* Görülmeyen mesajın uzun bekleme süresi soluk; görülünce bir an bulanıklaşıp kısa süreyle netleşir. */
.tm { display: inline-flex; align-items: center; gap: 4px; }
.msg.waiting .tm { opacity: .62; }
.tm.morph { animation: morph .75s var(--ease); }
@keyframes morph {
  0% { filter: blur(0); transform: scale(1); opacity: .62; }
  36% { filter: blur(4px); transform: scale(.82); opacity: .25; }
  72% { filter: blur(0); transform: scale(1.12); opacity: 1; }
  100% { filter: blur(0); transform: scale(1); opacity: 1; }
}

/* ============================== Gizli adlar ============================== */

.veiled {
  display: inline-block; vertical-align: bottom;
  filter: blur(.32em); opacity: .85;
  -webkit-user-select: none; user-select: none;
}
.avatar.veiled { color: transparent; text-shadow: 0 0 10px rgba(237, 237, 240, .85); }
.sn-ic { display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.sn-ic .ic { display: inline-block; }

/* ============================== Davetler ============================== */

.invites { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 6px 6px 0; }
.invite {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 7%, var(--raise));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  animation: rise .3s var(--ease);
}
.invite .body { flex: 1; min-width: 0; }
.invite .name { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite .prev { color: var(--muted); font-size: .85em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.invite .prev .ic { display: inline-block; vertical-align: -2px; margin-right: 5px; }
.invite.flash { animation: flash 1.2s var(--ease); }
.inv-acts { display: flex; gap: 6px; flex: none; }
.inv-acts .mini { height: 32px; padding: 0 12px; font-size: 13px; }
.mini.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.mini.primary:hover { color: var(--accent-ink); border-color: transparent; filter: brightness(1.06); }
.member.invited .mb-name { opacity: .6; }
.form-note { margin: -2px 0 12px; font-size: .84em; color: var(--muted); }

/* ============================== Yanıt ============================== */

.quote {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; min-width: 150px; margin: 2px 0 6px; padding: 5px 10px;
  border-radius: 10px; text-align: left; color: inherit;
  background: color-mix(in srgb, currentColor 7%, transparent);
  border-left: 3px solid color-mix(in srgb, var(--accent) 75%, transparent);
  font-size: .86em; line-height: 1.35;
}
.quote:hover { background: color-mix(in srgb, currentColor 11%, transparent); }
.bubble.kind-image .quote, .bubble.kind-video .quote { margin: 0 0 4px; }
.q-who { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-text { display: block; max-width: 100%; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote.gone .q-text { font-style: italic; opacity: .5; }

.replybar {
  display: flex; align-items: center; gap: 10px; flex: none;
  margin: 0 clamp(10px, 4vw, 40px) -4px; padding: 6px 4px 6px 12px;
  background: var(--raise); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 14px;
  animation: rise .2s var(--ease);
}
.replybar > .ic { color: var(--accent); }
.rb-body { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: .88em; line-height: 1.35; }
.rb-body .q-who { color: var(--accent); }
.replybar .icon-btn { width: 34px; height: 34px; }

.msg.flash .bubble { animation: flash 1.2s var(--ease); }
@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  25% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 45%, transparent); }
}

/* Kaydırarak yanıtla */
.msg { position: relative; touch-action: pan-y; }
.msg .bubble, .msg .reacts { transform: translateX(var(--sx, 0px)); transition: transform .25s var(--ease), opacity .4s, filter .4s; }
.msg.swiping .bubble, .msg.swiping .reacts { transition: none; }
.msg::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 30px; height: 30px; margin-top: -15px; border-radius: 50%;
  background: var(--raise) center / 16px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238d8d95' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.5 14.5L4.5 9.5l5-5'/%3E%3Cpath d='M4.5 9.5H14a5.5 5.5 0 0 1 0 11h-2.5'/%3E%3C/svg%3E");
  opacity: 0; transform: scale(.4); pointer-events: none;
  transition: opacity .15s, transform .2s var(--ease), background-color .15s;
}
.msg.swiping::before { opacity: .9; transform: scale(.8); }
.msg.armed::before { opacity: 1; transform: scale(1); background-color: color-mix(in srgb, var(--accent) 32%, var(--raise)); }

/* ============================== Tepkiler ============================== */

.reacts {
  order: 3; flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px;
  position: relative; z-index: 1; margin: -6px 0 2px; padding: 0 10px;
}
.msg.me .reacts { justify-content: flex-end; }
.react {
  display: inline-flex; align-items: center; gap: 3px;
  height: 24px; padding: 0 7px; border-radius: 12px;
  background: var(--panel); border: 1px solid var(--line-2); color: var(--muted);
  font-size: 13px; line-height: 1; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .15s var(--ease), border-color .15s;
}
.react:active { transform: scale(.9); }
.react .e { font-size: 14px; }
.react .n { font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.react.on { color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, var(--line-2)); background: color-mix(in srgb, var(--accent) 14%, var(--panel)); }
.react.new { animation: bounce .35s var(--ease); }
@keyframes bounce { 0% { transform: scale(.4); opacity: 0; } 60% { transform: scale(1.18); } }

/* Masaüstü: balonun yanında tepki / yanıt */
.acts {
  position: absolute; top: 50%; transform: translateY(-50%);
  display: flex; gap: 2px; padding: 0 6px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.msg.me .acts { right: 100%; flex-direction: row-reverse; }
.msg.them .acts { left: 100%; }
html:not(.touch) .msg:hover .acts, .msg.picked .acts { opacity: 1; pointer-events: auto; }
html.touch .acts, .msg.leaving .acts { display: none; }
.act { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--faint); }
.act:hover { background: var(--hover); color: var(--text); }
.msg.picked .bubble { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 40%, transparent); }

.msg-menu {
  position: fixed; z-index: 40;
  display: grid; gap: 4px; padding: 6px; border-radius: 18px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.msg-menu.in { animation: menu-in .18s var(--ease); }
@keyframes menu-in { from { opacity: 0; transform: translateY(4px) scale(.96); } }
.mm-emojis { display: flex; gap: 2px; }
.mm-e {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  font-size: 24px; line-height: 1;
  transition: transform .15s var(--ease), background-color .15s;
}
.mm-e:hover { background: var(--hover); transform: scale(1.12); }
.mm-e:active { transform: scale(.9); }
.mm-e.on { background: color-mix(in srgb, var(--accent) 24%, var(--raise)); }
.mm-item { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; color: var(--text); text-align: left; }
.mm-item:hover { background: var(--hover); }
.mm-item .ic { color: var(--muted); }

/* ============================== Anket ============================== */

.bubble.kind-poll { min-width: min(280px, 70vw); }
.poll { display: grid; gap: 8px; padding: 2px 0; }
.poll-head { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; }
.poll-head .ic { margin-top: 3px; opacity: .7; }
.poll-q { overflow-wrap: anywhere; }
.poll-sub { margin-top: -5px; font-size: .78em; opacity: .65; }
.poll-list { display: grid; gap: 6px; }
.poll-opt {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 9px;
  min-height: 38px; padding: 7px 10px; border-radius: 11px;
  text-align: left; color: inherit;
  background: color-mix(in srgb, currentColor 6%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  transition: border-color .2s, transform .15s var(--ease);
}
.poll-opt:active { transform: scale(.985); }
.po-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: color-mix(in srgb, var(--accent) 20%, transparent); transition: width .45s var(--ease); }
.poll-opt.on { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.poll-opt.on .po-fill { background: color-mix(in srgb, var(--accent) 32%, transparent); }
.po-mark {
  position: relative; width: 18px; height: 18px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid color-mix(in srgb, currentColor 40%, transparent);
}
.poll.multi .po-mark { border-radius: 5px; }
.poll-opt.on .po-mark { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.po-label { position: relative; flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .95em; }
.po-n { position: relative; font-size: .8em; font-variant-numeric: tabular-nums; opacity: .75; }

.poll-opts .add-row .field { margin-bottom: 8px; }
.po-del { width: 50px; height: 50px; border-radius: 14px; flex: none; }
.poll-add { height: 36px; margin: -2px 0 10px; padding: 0 10px; }
#dlgPoll .group { margin-bottom: 14px; }

/* ============================== Sesli arama ============================== */

.call {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: calc(72px + var(--safe-t)) 24px calc(36px + var(--safe-b));
  background: radial-gradient(120% 65% at 50% 18%, color-mix(in srgb, var(--accent) 13%, var(--bg)), var(--bg) 72%);
  animation: fadein .25s ease;
}
.call-top { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; max-width: 100%; }
.call-av-wrap { position: relative; margin-bottom: 16px; }
.call-av { position: relative; z-index: 1; width: 116px; height: 116px; font-size: 46px; }
.call-av-wrap::before, .call-av-wrap::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  opacity: 0;
}
.call[data-state="ringing"] .call-av-wrap::before, .call[data-state="incoming"] .call-av-wrap::before,
.call[data-state="ringing"] .call-av-wrap::after, .call[data-state="incoming"] .call-av-wrap::after {
  animation: ripple 2.2s ease-out infinite;
}
.call-av-wrap::after { animation-delay: 1.1s !important; }
@keyframes ripple { from { transform: scale(1); opacity: .7; } to { transform: scale(1.9); opacity: 0; } }
.call-name { max-width: 100%; font-size: 26px; font-weight: 650; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.call-status { min-height: 1.5em; color: var(--muted); font-variant-numeric: tabular-nums; }
.call[data-state="active"] .call-status { color: var(--text); }
.call[data-state="ended"] .call-av { opacity: .5; transition: opacity .4s; }
.call-bottom { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.call-acts { display: flex; align-items: flex-start; justify-content: center; gap: 26px; min-height: 96px; }
.call-ctl { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 72px; }
.call-ctl > span { font-size: 12px; color: var(--muted); }
.call-btn {
  width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center;
  transition: transform .15s var(--ease), background-color .2s, color .2s;
}
.call-btn:active { transform: scale(.92); }
.call-btn .ic { width: 28px; height: 28px; }
.call-btn.mute, .call-btn.out { background: var(--raise); border: 1px solid var(--line-2); color: var(--text); }
.call-btn.mute.on, .call-btn.out.on { background: var(--text); color: var(--bg); }
.call-btn.end { background: #d9443d; color: #fff; }
.call-btn.end .ic { transform: rotate(135deg); }
.call-btn.accept { background: #2fa866; color: #fff; animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.call-note { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--faint); font-size: 12px; text-align: center; }
.call-note .ic { width: 13px; height: 13px; }

/* Sohbetteki arama notu */
.bubble.kind-call { padding: 6px 8px 6px; }
.callrow {
  display: flex; align-items: center; gap: 12px; width: 100%; min-width: 210px;
  padding: 4px 10px 4px 2px; border-radius: calc(var(--r) - 6px); text-align: left; color: inherit;
}
.callrow:hover { background: color-mix(in srgb, currentColor 6%, transparent); }
.cr-ic { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, currentColor 10%, transparent); }
.callrow.missed .cr-ic { color: #e0716b; background: color-mix(in srgb, #e0716b 16%, transparent); }
.cr-text { display: flex; flex-direction: column; min-width: 0; }
.cr-title { font-weight: 600; font-size: .95em; }
.cr-sub { font-size: .8em; opacity: .7; }

@media (hover: none) {
  .mm-e:hover { background: transparent; transform: none; }
  .mm-e.on:hover { background: color-mix(in srgb, var(--accent) 24%, var(--raise)); }
}

/* ============================== Beni ekle bağlantısı ============================== */

.link-note { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); color: var(--muted); font-size: .88em; text-align: left; }
.link-note .ic { flex: none; color: var(--accent); }
#dlgContacts .group.list { margin: 4px 0 12px; }
#linkSetup .row .seg { flex: none; }
.link-live { display: flex; flex-direction: column; align-items: center; }
.qr-box { width: min(240px, 70vw); aspect-ratio: 1; padding: 12px; border-radius: 18px; background: #fff; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.link-meta { display: flex; justify-content: center; gap: 14px; margin: 12px 0 14px; color: var(--muted); font-size: .9em; font-variant-numeric: tabular-nums; }
.link-meta #linkLeft { color: var(--text); font-weight: 600; }
.link-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
.link-actions .btn:not(.primary) { background: var(--raise); border: 1px solid var(--line); color: var(--text); }
.link-live .btn.ghost { margin-top: 6px; }
.link-done { text-align: center; display: flex; flex-direction: column; align-items: center; padding-top: 12px; }
.link-done h2 { margin: 14px 0 6px; font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.link-done .muted { margin-bottom: 20px; max-width: 300px; }
.qr-box .qr-miss { display: grid; place-items: center; height: 100%; margin: 0; padding: 12px; color: #444; font-size: .9em; text-align: center; }

/* ============================== Soru sor ============================== */

.ask { margin-bottom: 18px; }
.ask-log { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.ask-b {
  max-width: 88%; padding: 8px 12px; border-radius: 16px; font-size: .93em; line-height: 1.4;
  background: var(--raise); border: 1px solid var(--line); border-bottom-left-radius: 6px; align-self: flex-start;
  animation: pop .25s var(--ease) both;
}
.ask-b.me { align-self: flex-end; background: var(--me); color: var(--me-text); border: 0; border-radius: 16px; border-bottom-right-radius: 6px; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-chip {
  padding: 7px 12px; border-radius: 999px; font-size: .86em; color: var(--muted);
  background: var(--raise); border: 1px solid var(--line);
}
.ask-chip:active { color: var(--text); }
.ask .field { margin-bottom: 0; }

/* ============================== Yönetim ============================== */

@media (min-width: 761px) { dialog.admin { width: min(560px, calc(100vw - 24px)); } }
.admin .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.admin .stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 16px; background: var(--raise); border: 1px solid var(--line); }
.admin .stat .num { font-size: 22px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.admin .stat .lbl { color: var(--muted); font-size: 12px; }
.admin .cg-title { margin-top: 6px; }
.adm-set { padding: 4px 14px 14px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-of-type { border-bottom: 0; margin-bottom: 8px; }
.set-row .t { font-weight: 550; }
.set-row .d { color: var(--muted); font-size: 12px; }
.dur { display: flex; gap: 6px; flex: none; align-items: center; }
.dur input, .dur select {
  height: 40px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); color: var(--text);
  outline: 0; font: inherit; font-size: 15px;
}
.dur input { width: 74px; padding: 0 10px; text-align: right; font-variant-numeric: tabular-nums; }
.dur select { padding: 0 8px; min-width: 64px; }
.dur .unit { color: var(--muted); font-size: 13px; }
.users { list-style: none; margin: 0 -6px 12px; padding: 0; }
.users li { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; }
.users .avatar { width: 36px; height: 36px; font-size: 14px; position: relative; }
.users .avatar.online::after {
  content: ""; position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #7fbf8a; box-shadow: 0 0 0 2px var(--panel);
}
.users .info { flex: 1; min-width: 0; }
.users .n { font-weight: 550; }
.users .s { color: var(--muted); font-size: 12px; }
.users .s.warn { color: #d79a62; }
.adm-cast { margin-bottom: 18px; }
.adm-cast textarea {
  display: block; width: 100%; min-height: 88px; resize: vertical; margin-bottom: 10px;
  padding: 12px 14px; border-radius: 14px; background: var(--raise); border: 1px solid var(--line);
  color: var(--text); font: inherit; outline: 0;
}
.adm-cast textarea:focus { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.ro-note { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 0; padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.ro-note[hidden], .composer[hidden] { display: none; }
.cf-actions { display: flex; justify-content: flex-end; gap: 8px; }
.cf-actions .btn { height: 44px; }
@media (max-width: 420px) {
  .admin .stats { grid-template-columns: repeat(2, 1fr); }
  .set-row { flex-wrap: wrap; }
}
