/* ==========================================================================
   Lallo — arayüz
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f5f3ee;
  --panel: #ffffff;
  --panel-2: #f8f7f3;
  --hover: #f1efe9;
  --active: #ebe8f9;
  --line: #e8e5dd;
  --text: #17161c;
  --muted: #6d6a76;
  --faint: #a3a0ab;
  --brand: #5a48f2;
  --brand-2: #7b5cff;
  --brand-ink: #ffffff;
  --brand-soft: #eeebff;
  --chat-bg: #efece4;
  --chat-dot: rgba(90, 72, 242, 0.06);
  --bubble-in: #ffffff;
  --bubble-out: #e6e0ff;
  --bubble-text: #17161c;
  --quote: rgba(0, 0, 0, 0.05);
  --ok: #17a660;
  --danger: #e5484d;
  --warn: #e39b12;
  --read: #3b82f6;
  --scrim: rgba(18, 16, 28, 0.42);
  --shadow-1: 0 1px 2px rgba(20, 18, 30, 0.06);
  --shadow-2: 0 2px 6px rgba(20, 18, 30, 0.06), 0 12px 32px rgba(20, 18, 30, 0.10);
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --msg-size: 15px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --side-w: 400px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e13;
    --panel: #15151c;
    --panel-2: #1a1a22;
    --hover: #1f1f28;
    --active: #262245;
    --line: #25252f;
    --text: #ecebf2;
    --muted: #9c99a8;
    --faint: #6c6978;
    --brand: #7c6cff;
    --brand-2: #9a7dff;
    --brand-soft: #221e42;
    --chat-bg: #0f0f15;
    --chat-dot: rgba(124, 108, 255, 0.07);
    --bubble-in: #1e1e27;
    --bubble-out: #3a2f86;
    --bubble-text: #f1effa;
    --quote: rgba(255, 255, 255, 0.07);
    --read: #6aa8ff;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e13;
  --panel: #15151c;
  --panel-2: #1a1a22;
  --hover: #1f1f28;
  --active: #262245;
  --line: #25252f;
  --text: #ecebf2;
  --muted: #9c99a8;
  --faint: #6c6978;
  --brand: #7c6cff;
  --brand-2: #9a7dff;
  --brand-soft: #221e42;
  --chat-bg: #0f0f15;
  --chat-dot: rgba(124, 108, 255, 0.07);
  --bubble-in: #1e1e27;
  --bubble-out: #3a2f86;
  --bubble-text: #f1effa;
  --quote: rgba(255, 255, 255, 0.07);
  --read: #6aa8ff;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 2px 8px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.45);
}
:root[data-size="small"] { --msg-size: 14px; }
:root[data-size="large"] { --msg-size: 17px; }

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.4 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; opacity: 0.5; }
a { color: var(--brand); }
img, video { display: block; max-width: 100%; }
svg.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
svg.i.fill { fill: currentColor; stroke: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app { position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%); display: flex; }

/* ---------- Açılış ---------- */
.boot { flex: 1; display: grid; place-items: center; }
.boot-logo, .logo-mark {
  width: 72px; height: 72px; border-radius: 22px;
  background: linear-gradient(145deg, var(--brand-2), var(--brand));
  box-shadow: 0 10px 30px rgba(90, 72, 242, 0.35);
  position: relative;
}
.boot-logo::after, .logo-mark::after {
  content: ""; position: absolute; inset: 0;
  background: center / 58% no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M7.9 20A9 9 0 1 0 4 16.1L2 22Z'/%3E%3Cpath d='M9 10v4M12 8v8M15 10v4'/%3E%3C/svg%3E");
}
.boot-logo { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(0.94); opacity: 0.8; } }

/* ---------- Genel bileşenler ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink); font-weight: 600;
  transition: transform 0.1s, filter 0.15s, background 0.15s;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn.block { width: 100%; }
.btn.ghost { background: var(--hover); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.small { height: 36px; padding: 0 14px; border-radius: 10px; font-size: 14px; }
.btn .spin { width: 18px; height: 18px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--muted); flex: none;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--brand); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 500; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 12px;
  border: 1.5px solid var(--line); background: var(--panel); outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
textarea.input { height: auto; padding: 12px 14px; resize: none; }

.avatar {
  --s: 48px;
  width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden; position: relative;
  font-weight: 600; font-size: calc(var(--s) * 0.38); color: #fff;
  background: var(--av, #8b80f9); user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar svg.i { width: 55%; height: 55%; }
.avatar-wrap { position: relative; flex: none; }
.avatar-wrap .dot {
  position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--ok); border: 2.5px solid var(--panel);
}

.badge {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--brand); color: #fff; font-size: 12px; font-weight: 700;
  display: inline-grid; place-items: center;
}
.badge.muted { background: var(--faint); }

.empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 32px; text-align: center; color: var(--muted);
}
.empty h3 { margin: 6px 0 0; color: var(--text); font-size: 18px; }
.empty p { margin: 0; max-width: 320px; }
.empty .art { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.empty .art svg.i { width: 40px; height: 40px; }

.spinner { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.8s linear infinite; }

/* ---------- Bildirim balonları ---------- */
#toasts {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 100;
  top: calc(12px + var(--safe-top)); display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(92vw, 420px);
}
.toast {
  pointer-events: auto; padding: 11px 16px; border-radius: 12px; background: #1d1b26; color: #fff;
  box-shadow: var(--shadow-2); font-size: 14px; animation: toast-in 0.2s ease-out;
  display: flex; gap: 10px; align-items: center;
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Katmanlar (alt sayfa, modal, menü) ---------- */
.layer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.layer .scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade 0.18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: calc(100% - 40px - var(--safe-top));
  background: var(--panel); border-radius: 20px 20px 0 0; box-shadow: var(--shadow-2);
  display: flex; flex-direction: column; animation: sheet-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
  padding-bottom: var(--safe-bottom);
}
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 700px) {
  .layer { align-items: center; }
  .sheet { border-radius: 20px; max-height: min(760px, calc(100% - 64px)); }
}
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 14px 12px 8px 20px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 18px; }
.sheet-body { padding: 8px 20px 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
@media (min-width: 700px) { .sheet-grab { display: none; } }

.menu {
  position: fixed; z-index: 70; min-width: 200px; padding: 6px; border-radius: 14px;
  background: var(--panel); box-shadow: var(--shadow-2); border: 1px solid var(--line);
  animation: pop 0.14s ease-out; transform-origin: top left;
}
@keyframes pop { from { opacity: 0; transform: scale(0.96); } }
.menu button, .action-list button {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; text-align: left;
}
.menu button:hover, .action-list button:hover { background: var(--hover); }
.menu button.danger, .action-list button.danger { color: var(--danger); }
.menu svg.i, .action-list svg.i { width: 20px; height: 20px; color: var(--muted); }
.menu button.danger svg.i, .action-list button.danger svg.i { color: var(--danger); }
.action-list { display: flex; flex-direction: column; padding: 4px 8px 12px; }
.action-list button { padding: 14px 12px; font-size: 16px; }

.quick-react { display: flex; justify-content: space-around; padding: 6px 12px 2px; font-size: 26px; }

/* ---------- Giriş ---------- */
.login {
  flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(123, 92, 255, 0.18), transparent 60%),
    radial-gradient(900px 500px at -20% 110%, rgba(90, 72, 242, 0.12), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); border-radius: 24px; padding: 32px 26px 26px;
  box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: 18px;
}
.login-card .logo-mark { margin: 0 auto 2px; }
.login-card h1 { margin: 0; text-align: center; font-size: 26px; letter-spacing: -0.02em; }
.login-card .lead { margin: -8px 0 4px; text-align: center; color: var(--muted); }
.login-card .fine { font-size: 13px; color: var(--muted); text-align: center; margin: 0; }
.login-card .link { color: var(--brand); font-weight: 600; }
.form-error { color: var(--danger); font-size: 14px; text-align: center; margin: -6px 0 0; min-height: 1em; }
.input.err { border-color: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 15%, transparent); }
.login-tabs { width: 100%; }
.login-tabs button { flex: 1; padding: 9px 10px; font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card .muted, .field .muted { color: var(--faint); font-weight: 400; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 48px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); }
.pw-eye:hover { background: var(--hover); }
.pw-eye svg.i { width: 20px; height: 20px; }
.prefix-row { display: flex; align-items: stretch; }
.prefix-row .prefix { display: grid; place-items: center; padding: 0 12px; border: 1.5px solid var(--line); border-right: 0; border-radius: 12px 0 0 12px; background: var(--panel-2); color: var(--muted); font-weight: 600; }
.prefix-row .input { border-radius: 0 12px 12px 0; }
.hint { font-size: 12.5px; color: var(--muted); min-height: 1em; }
.hint.good { color: var(--ok); }
.hint.bad { color: var(--danger); }
.handle { color: var(--muted); font-size: 13px; }
.share-me { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft); font-size: 14px; }
.share-me b { color: var(--brand); }
.share-me .grow { flex: 1; min-width: 0; }
.results { display: flex; flex-direction: column; gap: 2px; }
.result { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 12px; cursor: pointer; text-align: left; width: 100%; }
.result:hover { background: var(--hover); }
.result .grow { flex: 1; min-width: 0; }
.result .grow b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .icon-btn { width: 38px; height: 38px; color: var(--brand); }
.avatar-pick { align-self: center; position: relative; }
.avatar-pick .cam {
  position: absolute; right: -2px; bottom: -2px; width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff; display: grid; place-items: center; border: 3px solid var(--panel);
}
.avatar-pick .cam svg.i { width: 16px; height: 16px; }

/* ---------- Ana yerleşim ---------- */
.shell { flex: 1; display: flex; min-width: 0; position: relative; overflow: hidden; }
.side {
  width: 100%; display: flex; flex-direction: column; background: var(--panel); min-width: 0;
  padding-top: var(--safe-top);
}
.main {
  position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--chat-bg); min-width: 0;
  transform: translateX(100%); transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); z-index: 5;
}
.shell.in-chat .main { transform: none; box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08); }
@media (min-width: 900px) {
  .side { width: var(--side-w); flex: none; border-right: 1px solid var(--line); }
  .main { position: relative; transform: none; flex: 1; transition: none; box-shadow: none; }
}

.side-head { display: flex; align-items: center; gap: 4px; padding: 10px 10px 6px 18px; min-height: 58px; }
.side-head h1 { flex: 1; margin: 0; font-size: 24px; letter-spacing: -0.02em; }
.search {
  margin: 4px 14px 8px; position: relative;
}
.search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--faint); }
.search input {
  width: 100%; height: 40px; border-radius: 12px; border: 0; background: var(--panel-2); padding: 0 12px 0 38px; outline: none;
}
.search input:focus { box-shadow: 0 0 0 2px var(--brand-soft); }

.side-body { flex: 1; overflow: auto; overscroll-behavior: contain; position: relative; }
.tabs {
  display: flex; border-top: 1px solid var(--line); background: var(--panel);
  padding-bottom: var(--safe-bottom);
}
.tabs button {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0 7px;
  font-size: 12px; font-weight: 600; color: var(--muted); position: relative;
}
.tabs button .pill { padding: 3px 16px; border-radius: 14px; transition: background 0.15s; position: relative; }
.tabs button.on { color: var(--text); }
.tabs button.on .pill { background: var(--brand-soft); color: var(--brand); }
.tabs button .badge { position: absolute; top: -4px; right: 2px; min-width: 18px; height: 18px; font-size: 11px; }

.fab {
  position: absolute; right: 16px; bottom: 16px; width: 56px; height: 56px; border-radius: 18px;
  background: var(--brand); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(90, 72, 242, 0.4); z-index: 3;
}
.fab:active { transform: scale(0.96); }

.banner {
  margin: 4px 12px 8px; padding: 12px 14px; border-radius: 14px; background: var(--brand-soft);
  display: flex; gap: 12px; align-items: center; font-size: 14px;
}
.banner svg.i { color: var(--brand); }
.banner .grow { flex: 1; }
.banner b { display: block; }
.banner .x { color: var(--muted); }

/* Sohbet listesi */
.list { list-style: none; margin: 0; padding: 2px 6px 90px; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 14px; cursor: pointer; position: relative;
  user-select: none;
}
.row:hover { background: var(--hover); }
.row.sel { background: var(--active); }
.row .txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .l1, .row .l2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row .name { flex: 1; font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .time { font-size: 12px; color: var(--faint); flex: none; }
.row.unread .time { color: var(--brand); font-weight: 600; }
.row .prev { flex: 1; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; min-width: 0; }
.row .prev > span { overflow: hidden; text-overflow: ellipsis; }
.row .prev svg.i { width: 16px; height: 16px; }
.row .prev.typing { color: var(--brand); font-weight: 500; }
.row .muted-ic { color: var(--faint); }
.row .muted-ic svg.i { width: 16px; height: 16px; }
.row .live-call { color: var(--ok); font-weight: 600; }
.ticks { display: inline-flex; color: var(--faint); flex: none; }
.ticks svg.i { width: 17px; height: 17px; stroke-width: 2.2; }
.ticks.read { color: var(--read); }
.ticks.pending svg.i { width: 13px; height: 13px; }
.section-title { padding: 14px 16px 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.call-row .dir { display: inline-flex; }
.call-row .dir svg.i { width: 15px; height: 15px; }
.call-row .dir.missed { color: var(--danger); }
.call-row .dir.ok { color: var(--ok); }
.call-row .actions { display: flex; }

/* ---------- Sohbet ekranı ---------- */
.chat-head {
  display: flex; align-items: center; gap: 6px; padding: calc(6px + var(--safe-top)) 8px 6px 4px;
  background: var(--panel); border-bottom: 1px solid var(--line); min-height: 60px; z-index: 2;
}
.chat-head .who { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 4px; border-radius: 12px; }
.chat-head .who .avatar { --s: 40px; }
.chat-head .who .t { min-width: 0; }
.chat-head .who .n { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who .s { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .who .s.hl { color: var(--brand); }
@media (min-width: 900px) { .chat-head .back { display: none; } .chat-head { padding-left: 12px; } }

.call-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--ok); color: #fff; font-weight: 600; font-size: 14px;
}
.call-banner .grow { flex: 1; }
.call-banner .btn { background: rgba(255, 255, 255, 0.22); color: #fff; }

.msgs {
  flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; position: relative;
  padding: 10px 0 8px;
  background-color: var(--chat-bg);
  background-image: radial-gradient(var(--chat-dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}
.msgs-inner { display: flex; flex-direction: column; max-width: 900px; margin: 0 auto; padding: 0 10px; }
.msgs .loader { display: grid; place-items: center; padding: 14px; }
.day { align-self: center; margin: 12px 0 8px; padding: 5px 12px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--panel); box-shadow: var(--shadow-1); position: sticky; top: 6px; z-index: 1; }
.sys { align-self: center; margin: 6px 20px; padding: 6px 12px; border-radius: 10px; font-size: 13px; color: var(--muted); background: var(--panel); box-shadow: var(--shadow-1); text-align: center; max-width: 80%; }
.unread-sep { align-self: stretch; margin: 10px -10px; padding: 6px; text-align: center; font-size: 13px; font-weight: 600; color: var(--brand); background: color-mix(in srgb, var(--brand-soft) 80%, transparent); }

.msg { display: flex; gap: 8px; align-items: flex-end; margin-top: 2px; position: relative; max-width: 100%; }
.msg.first { margin-top: 8px; }
.msg.out { justify-content: flex-end; }
.msg .avatar { --s: 30px; visibility: hidden; font-size: 12px; }
.msg.last .avatar { visibility: visible; }
.bubble {
  position: relative; max-width: min(78%, 560px); padding: 6px 9px 6px 10px; border-radius: 16px;
  background: var(--bubble-in); color: var(--bubble-text); box-shadow: var(--shadow-1);
  font-size: var(--msg-size); line-height: 1.38; overflow-wrap: anywhere; word-break: break-word;
  transition: background 0.3s;
}
.msg.out .bubble { background: var(--bubble-out); }
.msg.in.last .bubble { border-bottom-left-radius: 5px; }
.msg.out.last .bubble { border-bottom-right-radius: 5px; }
.bubble .sender { font-size: 13px; font-weight: 600; margin-bottom: 1px; }
.bubble .text { white-space: pre-wrap; }
.bubble .text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.bubble .text.jumbo { font-size: 40px; line-height: 1.15; }
.bubble .meta {
  float: right; margin: 6px 0 -4px 10px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11.5px; color: var(--muted); position: relative; top: 2px; user-select: none; white-space: nowrap;
}
.msg.out .bubble .meta { color: color-mix(in srgb, var(--bubble-text) 55%, transparent); }
.bubble .meta .ticks { color: inherit; }
.bubble .meta .ticks.read { color: var(--read); }
.bubble .meta .ticks svg.i { width: 16px; height: 16px; }
.bubble.deleted .text { font-style: italic; color: var(--muted); }
.bubble.compact { padding-bottom: 18px; min-width: 150px; }
.bubble.compact > .meta { position: absolute; right: 10px; bottom: 5px; float: none; margin: 0; top: auto; }
.bubble.flash { animation: flash 1.2s; }
@keyframes flash { 30% { background: var(--brand-soft); } }
.bubble.media { padding: 4px; }
.bubble.media .meta.over {
  position: absolute; right: 10px; bottom: 9px; margin: 0; float: none; top: auto;
  padding: 2px 7px; border-radius: 10px; background: rgba(0, 0, 0, 0.45); color: #fff;
}
.bubble.media .caption { padding: 4px 6px 2px; }
.bubble .img {
  border-radius: 12px; overflow: hidden; background: var(--quote); cursor: zoom-in; position: relative;
  width: min(300px, 64vw); max-height: 380px;
}
.bubble .img img, .bubble .img video { width: 100%; height: 100%; object-fit: cover; }
.bubble video.vid { border-radius: 12px; width: min(320px, 64vw); max-height: 420px; background: #000; }
.bubble .progress {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.35); color: #fff; font-weight: 600;
}
.ring { width: 48px; height: 48px; }
.ring circle { fill: none; stroke-width: 4; }
.ring .bg { stroke: rgba(255, 255, 255, 0.3); }
.ring .fg { stroke: #fff; stroke-linecap: round; transform: rotate(-90deg); transform-origin: center; transition: stroke-dashoffset 0.2s; }

.quote {
  display: flex; gap: 8px; margin: 2px 0 5px; padding: 6px 10px; border-radius: 10px; background: var(--quote);
  border-left: 4px solid var(--brand); cursor: pointer; font-size: 13.5px; min-width: 0;
}
.quote .qt { min-width: 0; flex: 1; }
.quote .qn { font-weight: 600; color: var(--brand); font-size: 13px; }
.quote .qp { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote img { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }

.file-card { display: flex; align-items: center; gap: 10px; padding: 6px 4px; min-width: 220px; color: inherit; text-decoration: none; }
.file-card .fi { width: 42px; height: 42px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.file-card .fn { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.file-card .fs { font-size: 12px; color: var(--muted); }

.voice { display: flex; align-items: center; gap: 10px; min-width: 230px; padding: 4px 2px 2px; }
.voice .play { width: 38px; height: 38px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.voice .play svg.i { width: 18px; height: 18px; }
.voice .wave { flex: 1; height: 30px; display: flex; align-items: center; gap: 2px; cursor: pointer; }
.voice .wave i { flex: 1; min-width: 2px; border-radius: 2px; background: color-mix(in srgb, var(--bubble-text) 28%, transparent); }
.voice .wave i.p { background: var(--brand); }
.voice .dur { font-size: 12px; color: var(--muted); min-width: 34px; font-variant-numeric: tabular-nums; }
.voice .rate { font-size: 11px; font-weight: 700; padding: 3px 6px; border-radius: 8px; background: var(--quote); }

.call-msg { display: flex; align-items: center; gap: 10px; padding: 4px 2px; min-width: 200px; cursor: pointer; }
.call-msg .ci { width: 38px; height: 38px; border-radius: 50%; background: var(--quote); display: grid; place-items: center; flex: none; }
.call-msg .ci svg.i { width: 19px; height: 19px; }
.call-msg.missed .ci { color: var(--danger); }
.call-msg .cl { font-weight: 600; }
.call-msg .cs { font-size: 13px; color: var(--muted); }

.jump {
  position: absolute; right: 16px; bottom: 90px; width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel); color: var(--muted); box-shadow: var(--shadow-2); display: grid; place-items: center; z-index: 3;
}
.jump .badge { position: absolute; top: -6px; right: -4px; }

/* Yazma alanı */
.composer-wrap { background: transparent; padding: 6px 8px calc(8px + var(--safe-bottom)); z-index: 2; }
.composer-inner { max-width: 900px; margin: 0 auto; }
.composer-top {
  display: flex; align-items: center; gap: 10px; margin: 0 52px 6px 0; padding: 8px 8px 8px 12px; border-radius: 16px; background: var(--panel); box-shadow: var(--shadow-1);
}
.composer-top .quote { flex: 1; margin: 0; }
.composer { display: flex; align-items: flex-end; gap: 6px; }
.composer .box {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; background: var(--panel); border-radius: 24px; box-shadow: var(--shadow-1); padding: 3px 4px;
}
.composer .box .icon-btn { width: 42px; height: 42px; }
.composer textarea {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; resize: none; padding: 10px 4px; max-height: 150px;
  font-size: 16px; line-height: 1.35;
}
.send {
  width: 50px; height: 50px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none;
  box-shadow: 0 4px 12px rgba(90, 72, 242, 0.35); transition: transform 0.12s;
}
.send:active { transform: scale(0.92); }
.send svg.i { width: 22px; height: 22px; }
.recording {
  flex: 1; display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 24px; box-shadow: var(--shadow-1); padding: 4px 6px 4px 14px; height: 50px;
}
.recording .rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: pulse 1s infinite; }
.recording .rec-time { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 44px; }
.recording .rec-level { flex: 1; display: flex; align-items: center; gap: 2px; height: 28px; overflow: hidden; justify-content: flex-end; }
.recording .rec-level i { width: 3px; border-radius: 2px; background: var(--brand); flex: none; }
.recording .icon-btn { color: var(--danger); }

.emoji-panel {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 2px; padding: 8px; max-height: 220px; overflow: auto;
  background: var(--panel); border-radius: 18px; box-shadow: var(--shadow-1); margin-bottom: 6px;
}
.emoji-panel button { height: 42px; font-size: 26px; border-radius: 10px; }
.emoji-panel button:hover { background: var(--hover); }

.drop-hint {
  position: absolute; inset: 10px; border: 3px dashed var(--brand); border-radius: 20px; background: color-mix(in srgb, var(--brand-soft) 85%, transparent);
  display: grid; place-items: center; font-size: 18px; font-weight: 600; color: var(--brand); z-index: 20; pointer-events: none;
}

/* ---------- Bilgi / Ayarlar ekranları ---------- */
.page { position: absolute; inset: 0; background: var(--bg); z-index: 8; display: flex; flex-direction: column; animation: slide-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1); }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } }
.page-head { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-top)) 10px 8px 4px; background: var(--panel); border-bottom: 1px solid var(--line); min-height: 58px; }
.page-head h2 { margin: 0; font-size: 18px; flex: 1; }
.page-body { flex: 1; overflow: auto; padding-bottom: calc(24px + var(--safe-bottom)); }
.hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 26px 20px 18px; background: var(--panel); text-align: center; }
.hero .avatar { --s: 112px; }
.hero h3 { margin: 8px 0 0; font-size: 22px; }
.hero .sub { color: var(--muted); }
.hero-actions { display: flex; gap: 10px; margin-top: 14px; }
.hero-actions button { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 86px; padding: 12px 6px; border-radius: 14px; background: var(--panel-2); color: var(--brand); font-size: 13px; font-weight: 600; border: 1px solid var(--line); }
.hero-actions button:hover { background: var(--hover); }
.card { background: var(--panel); margin-top: 10px; }
@media (min-width: 700px) { .page-body .card, .page-body .hero { margin-left: 16px; margin-right: 16px; border-radius: 16px; } .page-body .hero { margin-top: 16px; } }
.card-title { padding: 14px 18px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.item { display: flex; align-items: center; gap: 14px; padding: 13px 18px; min-height: 54px; width: 100%; text-align: left; }
button.item:hover { background: var(--hover); }
.item > svg.i { color: var(--muted); }
.item .grow { flex: 1; min-width: 0; }
.item .grow small { display: block; color: var(--muted); font-size: 13px; margin-top: 1px; }
.item.danger, .item.danger > svg.i { color: var(--danger); }
.item select.input { width: auto; height: 38px; }
.item + .item { border-top: 1px solid var(--line); }
.item .avatar { --s: 42px; }
.item .role { font-size: 12px; color: var(--brand); background: var(--brand-soft); padding: 2px 8px; border-radius: 8px; font-weight: 600; }

.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 14px; background: var(--line); transition: background 0.2s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); transition: transform 0.2s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(20px); }
.seg { display: flex; background: var(--panel-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button.on { background: var(--panel); color: var(--text); box-shadow: var(--shadow-1); }
input[type="range"] { accent-color: var(--brand); }

.pick-list { display: flex; flex-direction: column; }
.pick-list label { display: flex; align-items: center; gap: 12px; padding: 9px 4px; border-radius: 12px; cursor: pointer; }
.pick-list label:hover { background: var(--hover); }
.pick-list input[type="checkbox"] { width: 22px; height: 22px; accent-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border-radius: 20px; background: var(--brand-soft); font-size: 13px; font-weight: 600; }
.chip .avatar { --s: 24px; font-size: 10px; }

/* ---------- Medya görüntüleyici ---------- */
.viewer { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.94); display: flex; flex-direction: column; animation: fade 0.15s; }
.viewer-head { display: flex; align-items: center; gap: 6px; padding: calc(8px + var(--safe-top)) 8px 8px 16px; color: #fff; }
.viewer-head .grow { flex: 1; min-width: 0; font-size: 14px; }
.viewer-head .icon-btn { color: #fff; }
.viewer-head .icon-btn:hover { background: rgba(255, 255, 255, 0.12); }
.viewer-body { flex: 1; display: grid; place-items: center; overflow: auto; padding: 8px; touch-action: pinch-zoom; }
.viewer-body img, .viewer-body video { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; }

/* ---------- Arama ekranı ---------- */
.call {
  position: fixed; inset: 0; z-index: 80; color: #fff; display: flex; flex-direction: column;
  background: radial-gradient(900px 700px at 50% 20%, #3b2f8f 0%, #1b1640 45%, #0b0a16 100%);
  animation: fade 0.2s;
  user-select: none;
}
.call.video-mode { background: #07070b; }
.call-top { position: absolute; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 8px; padding: calc(10px + var(--safe-top)) 12px 10px; background: linear-gradient(rgba(0, 0, 0, 0.45), transparent); transition: opacity 0.25s; }
.call-top .grow { flex: 1; min-width: 0; text-align: center; }
.call-top .t1 { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.call-top .t2 { font-size: 13px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.call .icon-btn { color: #fff; }
.call .icon-btn:hover { background: rgba(255, 255, 255, 0.14); }
.call-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 90px 20px 150px; text-align: center; }
.call-center .avatar { --s: 136px; box-shadow: 0 0 0 0 rgba(124, 108, 255, 0.5); }
.call-center .avatar.speaking { animation: speak 1.2s ease-out infinite; }
@keyframes speak { 0% { box-shadow: 0 0 0 0 rgba(160, 145, 255, 0.55); } 100% { box-shadow: 0 0 0 26px rgba(160, 145, 255, 0); } }
.call-center .avatar.ringing { animation: ringp 1.6s ease-out infinite; }
@keyframes ringp { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.35); } 100% { box-shadow: 0 0 0 40px rgba(255, 255, 255, 0); } }
.call-center h2 { margin: 6px 0 0; font-size: 28px; letter-spacing: -0.01em; }
.call-center .st { font-size: 16px; opacity: 0.8; font-variant-numeric: tabular-nums; }
.call-hint { font-size: 13px; opacity: 0.7; max-width: 320px; }

.call-bar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 16px calc(22px + var(--safe-bottom)); background: linear-gradient(transparent, rgba(0, 0, 0, 0.55)); transition: opacity 0.25s;
}
.cbtn { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; color: rgba(255, 255, 255, 0.85); width: 64px; }
.cbtn .c { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, 0.16); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); transition: background 0.15s, transform 0.1s; }
.cbtn:hover .c { background: rgba(255, 255, 255, 0.24); }
.cbtn:active .c { transform: scale(0.93); }
.cbtn.on .c { background: #fff; color: #17161c; }
.cbtn.red .c { background: var(--danger); color: #fff; }
.cbtn.green .c { background: var(--ok); color: #fff; }
.cbtn .c svg.i { width: 26px; height: 26px; }
.cbtn.big .c { width: 72px; height: 72px; }
.cbtn.big .c svg.i { width: 30px; height: 30px; }
.call.hide-ui .call-top, .call.hide-ui .call-bar { opacity: 0; pointer-events: none; }
.incoming-bar { gap: 80px; padding-bottom: calc(50px + var(--safe-bottom)); }
.incoming-bar .cbtn { width: 80px; font-size: 14px; }
.cbtn.green .c { animation: wiggle 1.4s ease-in-out infinite; }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg); } 80% { transform: rotate(14deg); } 90% { transform: rotate(-8deg); } }

.stage { position: absolute; inset: 0; display: grid; gap: 4px; padding: 0; background: #07070b; }
.stage.n2 { grid-template-rows: 1fr 1fr; }
@media (min-aspect-ratio: 1/1) { .stage.n2 { grid-template-rows: none; grid-template-columns: 1fr 1fr; } }
.stage.n3, .stage.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.stage.n5, .stage.n6 { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(3, 1fr); }
@media (min-aspect-ratio: 1/1) { .stage.n5, .stage.n6 { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr 1fr; } }
.stage.many { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); grid-auto-rows: minmax(140px, 1fr); overflow: auto; padding-top: 70px; padding-bottom: 130px; }
.tile { position: relative; overflow: hidden; background: #15141f; display: grid; place-items: center; min-height: 0; }
.tile video { width: 100%; height: 100%; object-fit: cover; }
.tile video.contain { object-fit: contain; background: #000; }
.tile video.mirror { transform: scaleX(-1); }
.tile .avatar { --s: 96px; }
.tile .avatar.speaking { animation: speak 1.2s ease-out infinite; }
.tile.speaking::after { content: ""; position: absolute; inset: 0; border: 3px solid #8f80ff; pointer-events: none; }
.tile .label {
  position: absolute; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 10px;
  background: rgba(0, 0, 0, 0.5); font-size: 13px; font-weight: 600; max-width: calc(100% - 20px);
}
.tile .label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label svg.i { width: 15px; height: 15px; }
.tile .label .mic-off { display: inline-flex; color: #ff8a8e; }
/* Tek kişilik sahnede isim zaten üst çubukta; yalnızca "mikrofonu kapalı" göstergesi kalır */
.stage.solo .tile .label { display: none; top: calc(70px + var(--safe-top)); bottom: auto; }
.stage.solo .tile .label:has(.mic-off:not([hidden])) { display: flex; }
.tile .q { position: absolute; top: 10px; right: 10px; }
.stage.solo .tile.focus { position: absolute; inset: 0; }
.pip {
  position: absolute; z-index: 4; width: 116px; height: 164px; right: 14px; top: calc(76px + var(--safe-top));
  border-radius: 16px; overflow: hidden; box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5); background: #222; touch-action: none; cursor: grab;
}
@media (min-width: 700px) { .pip { width: 220px; height: 150px; } }
.pip video { width: 100%; height: 100%; object-fit: cover; }
.pip video.mirror { transform: scaleX(-1); }
.pip .avatar { --s: 54px; margin: auto; position: absolute; inset: 0; }

.call-notice {
  position: absolute; left: 50%; transform: translateX(-50%); top: calc(74px + var(--safe-top)); z-index: 5;
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 20px; background: rgba(229, 72, 77, 0.92); font-size: 14px; font-weight: 600; white-space: nowrap;
}
.call-notice.warn { background: rgba(227, 155, 18, 0.95); color: #1b1300; }
.call-notice svg.i { width: 17px; height: 17px; }

.q-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.q-bars i { width: 3px; border-radius: 1px; background: rgba(255, 255, 255, 0.35); }
.q-bars i:nth-child(1) { height: 5px; } .q-bars i:nth-child(2) { height: 9px; } .q-bars i:nth-child(3) { height: 14px; }
.q-bars.q3 i, .q-bars.q2 i:nth-child(-n+2), .q-bars.q1 i:nth-child(1) { background: #4ade80; }
.q-bars.q1 i:nth-child(1) { background: #f87171; }
.q-bars.q2 i:nth-child(-n+2) { background: #fbbf24; }

.call-mini {
  position: fixed; z-index: 55; left: 50%; transform: translateX(-50%); top: calc(8px + var(--safe-top));
  display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 14px; border-radius: 26px;
  background: var(--ok); color: #fff; box-shadow: var(--shadow-2); font-weight: 600; font-size: 14px; cursor: pointer; max-width: calc(100vw - 24px);
}
.call-mini .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.call-mini .end { width: 34px; height: 34px; border-radius: 50%; background: var(--danger); display: grid; place-items: center; flex: none; }
.call-mini .end svg.i { width: 18px; height: 18px; }
.call-mini.warn { background: var(--warn); }

.devices { display: flex; flex-direction: column; gap: 12px; }
.devices select { height: 42px; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.08s; }

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