/* ============================================================
   anka — siyah/beyaz ultra premium
   shadcn neutral/dark token'larından türetildi (docs/DESIGN.md)
   ============================================================ */

:root {
  --bg: #000000;
  --surface: #0a0a0a;
  --elevated: #111111;
  --popover: #0f0f0f;

  --fg: #fafafa;
  --muted: #a3a3a3;
  --subtle: #737373;

  --primary: #fafafa;
  --on-primary: #0a0a0a;
  --secondary: #1a1a1a;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --ring: #737373;
  --danger: #ff6467;

  --glow: rgba(255, 255, 255, 0.06);
  --grid-dot: rgba(255, 255, 255, 0.045);
  --hairline: rgba(255, 255, 255, 0.04);
  --focus-border: rgba(255, 255, 255, 0.28);
  --hover-solid: #ffffff;
  --ghost-wordmark: rgba(255, 255, 255, 0.06);
  --overlay: rgba(0, 0, 0, 0.72);
  --card-tint: rgba(255, 255, 255, 0.06);
  --scrollbar: #222;

  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-2xl: 20px;
  --r-full: 999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ---------- açık tema ---------- */
:root[data-theme="light"] {
  --bg: #ffffff;
  --surface: #f7f7f8;
  --elevated: #ececee;
  --popover: #ffffff;

  --fg: #0a0a0a;
  --muted: #525252;
  --subtle: #737373;

  --primary: #0a0a0a;
  --on-primary: #fafafa;
  --secondary: #e6e6e8;

  --border: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.22);
  --ring: #a3a3a3;
  --danger: #dc2626;

  --glow: rgba(0, 0, 0, 0.04);
  --grid-dot: rgba(0, 0, 0, 0.05);
  --hairline: rgba(0, 0, 0, 0.05);
  --focus-border: rgba(0, 0, 0, 0.30);
  --hover-solid: #262626;
  --ghost-wordmark: rgba(0, 0, 0, 0.06);
  --overlay: rgba(0, 0, 0, 0.45);
  --card-tint: rgba(0, 0, 0, 0.05);
  --scrollbar: #c4c4c6;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- ortak ---------- */
.wordmark {
  font-weight: 700;
  font-size: 40px;
  letter-spacing: -0.04em;
  line-height: 1;
  user-select: none;
}
.wordmark.small { font-size: 22px; letter-spacing: -0.03em; }

.brandmark { display: flex; align-items: center; gap: 12px; }
.brandmark.compact { gap: 8px; }
.brand-logo {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 6px 24px rgba(255,255,255,0.10));
  user-select: none;
}
.brand-logo.sm { width: 30px; height: 30px; filter: none; }

.avatar {
  width: 44px; height: 44px;
  border-radius: var(--r-full);
  background: var(--secondary);
  border: 1px solid var(--border);
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--fg);
  flex: 0 0 auto;
  overflow: hidden;
}
  .avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease), border-color 160ms var(--ease);
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--elevated); color: var(--fg); border-color: var(--border); }
.icon-btn:active { transform: scale(0.97); }

.btn {
  height: 44px; padding: 0 18px;
  border-radius: var(--r-lg);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600; font-size: 14px;
  transition: transform 120ms var(--ease), background 160ms var(--ease), opacity 160ms var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--hover-solid); }
.btn-outline { background: transparent; color: var(--fg); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--elevated); }

.screen { height: 100dvh; }
#login { overflow-y: auto; }

/* ============================================================
   GİRİŞ / QR
   ============================================================ */
#login {
  display: grid;
  place-items: center;
  padding: 32px;
  position: relative;
  overflow: hidden;
}
#login::before {
  content: "";
  position: absolute;
  width: 900px; height: 900px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow) 0%, transparent 62%);
  top: -380px; right: -260px;
  pointer-events: none;
}
#login::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: radial-gradient(circle at 30% 40%, black, transparent 65%);
  pointer-events: none;
}

.login-wrap {
  position: relative;
  display: grid;
  grid-template-columns: minmax(320px, 520px) 400px;
  gap: 72px;
  align-items: center;
  max-width: 1080px;
  width: 100%;
  animation: rise 420ms var(--ease) both;
}

.brand h1 {
  font-size: 46px;
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 28px 0 20px;
  font-weight: 600;
}
.brand .lead {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 420px;
  margin: 0 0 36px;
}
.brand .lead strong { color: var(--fg); font-weight: 600; }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps li {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); font-size: 14px;
}
.steps li span {
  width: 26px; height: 26px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600; color: var(--fg);
}

.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  display: grid;
  gap: 16px;
  box-shadow: 0 1px 0 var(--hairline) inset;
}
.qr-frame {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
}
.qr-box { width: 100%; height: 100%; display: grid; place-items: center; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-loading { color: #444; font-size: 13px; }

.qr-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted);
}
#qr-timer { color: var(--subtle); }

.qr-note { margin: 0; font-size: 12px; color: var(--subtle); text-align: center; }

/* ============================================================
   UYGULAMA
   ============================================================ */
#app {
  display: grid;
  grid-template-columns: 400px 1fr;
  height: 100dvh;
  overflow: hidden;
  animation: fade 260ms var(--ease) both;
}

/* ---------- kenar çubuğu ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  min-height: 64px;
}
.side-actions { display: flex; gap: 4px; }

.search {
  margin: 0 16px 12px;
  display: flex; align-items: center; gap: 10px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 12px;
  height: 44px;
  transition: border-color 160ms var(--ease);
}
.search:focus-within { border-color: var(--border-strong); }
.search svg { width: 17px; height: 17px; color: var(--subtle); flex: 0 0 auto; }
.search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  font-size: 14px;
}
.search input::placeholder { color: var(--subtle); }

.chat-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 8px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.chat-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: var(--r-lg);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 150ms var(--ease), border-color 150ms var(--ease);
}
.chat-item:hover { background: var(--elevated); }
.chat-item.active { background: var(--elevated); border-color: var(--border); }

.chat-body { min-width: 0; }
.chat-top { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.chat-name {
  font-weight: 600; font-size: 15px; letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-time { font-size: 11px; color: var(--subtle); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
.chat-preview {
  margin-top: 3px;
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.badge {
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--primary); color: var(--on-primary);
  border-radius: var(--r-full);
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}

.side-foot {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 140ms var(--ease);
}
.side-foot:hover { background: var(--popover); }
.me-text { min-width: 0; flex: 1; }
.me-name { font-size: 14px; font-weight: 600; }
.me-phone { font-size: 12px; color: var(--subtle); }
.avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.presence-dot {
  position: absolute; right: 0; bottom: 1px;
  width: 11px; height: 11px; border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--bg);
  box-sizing: content-box;
}
.dot-online {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.16);
}

/* ---------- sohbet ---------- */
.pane { display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; background: var(--bg); position: relative; }

.empty {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}
.empty-wordmark {
  font-size: 72px; font-weight: 700; letter-spacing: -0.05em;
  color: var(--ghost-wordmark);
  user-select: none;
}
.empty p { margin: 0; font-size: 15px; }
.empty .hint { font-size: 12px; color: var(--subtle); }

.convo { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.convo-head {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 24px;
  min-height: 72px;
  border-bottom: 1px solid var(--border);
  background: var(--overlay);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 2;
}
.convo-meta { min-width: 0; flex: 1; }
.convo-name { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.convo-status { font-size: 12px; color: var(--subtle); }
.convo-actions { display: flex; gap: 4px; }

.messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 32px 16px;
  display: flex; flex-direction: column; gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar) transparent;
}

.msg-row { display: flex; }
.msg-row.out { justify-content: flex-end; }
.msg-row + .msg-row.gap { margin-top: 12px; }

.bubble {
  max-width: min(72%, 560px);
  padding: 10px 14px 8px;
  border-radius: var(--r-2xl);
  font-size: 14.5px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-row.in .bubble {
  background: var(--elevated);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}
.msg-row.out .bubble {
  background: var(--primary);
  color: var(--on-primary);
  border-bottom-right-radius: 6px;
}
.bubble .stamp {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  text-align: right;
  opacity: 0.55;
  font-variant-numeric: tabular-nums;
}
.bubble .stamp.read { color: #34b7f1; opacity: 0.95; }
.msg-row.in .sender {
  font-size: 11.5px;
  color: var(--muted);
  margin: 0 0 3px 4px;
}

.composer {
  position: relative;
  display: flex; align-items: flex-end; gap: 10px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--border);
}
.composer textarea {
  flex: 1;
  resize: none;
  max-height: 132px;
  background: var(--popover);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-2xl);
  padding: 13px 18px;
  outline: none;
  font-size: 14.5px;
  line-height: 1.4;
  transition: border-color 160ms var(--ease);
}
.composer textarea:focus { border-color: var(--focus-border); }
.composer textarea::placeholder { color: var(--subtle); }

.send-btn {
  width: 46px; height: 46px;
  border-radius: var(--r-full);
  border: 0;
  background: var(--primary);
  color: var(--on-primary);
  display: grid; place-items: center;
  cursor: pointer;
  transition: transform 120ms var(--ease), background 160ms var(--ease);
}
.send-btn svg { width: 20px; height: 20px; }
.send-btn:hover { background: var(--hover-solid); }
.send-btn:active { transform: scale(0.94); }
.send-btn:disabled { opacity: 0.35; cursor: default; }

/* ---------- bildirim ---------- */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--elevated);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  padding: 11px 18px;
  border-radius: var(--r-full);
  font-size: 13px;
  z-index: 50;
  animation: rise 180ms var(--ease) both;
}

/* ---------- animasyon ---------- */
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- duyarlı ---------- */
@media (max-width: 1020px) {
  .login-wrap { grid-template-columns: 1fr; gap: 36px; max-width: 420px; }
  .brand h1 { font-size: 34px; }
  .brand .lead { margin-bottom: 24px; }
  .steps { display: none; }
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .pane { display: flex; }
}

/* ---------- medya mesajlari ---------- */
.bubble.media {
  padding: 4px;
  background: transparent !important;
  border: 0 !important;
}
.bubble.media .media-wrap {
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  max-width: 420px;
}
.bubble.media img.msg-img,
.bubble.media video.msg-video {
  display: block;
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  cursor: zoom-in;
}
.bubble.media video.msg-video { cursor: default; background: #000; }
.bubble.media .caption {
  padding: 8px 10px 4px;
  color: var(--fg);
  font-size: 14px;
  white-space: pre-wrap;
}
.bubble.media.out .media-wrap { border-color: transparent; }
.bubble.media .stamp {
  padding: 0 8px 4px;
  color: var(--muted);
}
.bubble.media.out .stamp { color: var(--muted); opacity: .85; }

.file-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; min-width: 200px;
}
.file-pill svg { width: 22px; height: 22px; flex: 0 0 auto; }
.file-pill .file-name {
  font-size: 13px; font-weight: 500;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-pill .file-size { font-size: 11px; opacity: .6; }

.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,.94);
  overflow: hidden;
  touch-action: none;
  animation: fade 160ms var(--ease) both;
}
.lb-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  transform-origin: center center;
  will-change: transform;
  touch-action: none;
  cursor: grab;
}
.lb-stage img,
.lb-stage video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r-md);
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  user-select: none;
  -webkit-user-drag: none;
}
.lb-stage img { cursor: zoom-in; }
.lb-close {
  position: absolute; top: 14px; right: 16px; z-index: 3;
  width: 42px; height: 42px; padding: 9px;
  border: none; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff;
  cursor: pointer;
  display: grid; place-items: center;
}
.lb-close:hover { background: rgba(255,255,255,.24); }

.media-shell { position: relative; display: block; }
.media-expand {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px; padding: 7px;
  border: none; border-radius: 10px;
  background: rgba(0,0,0,.55); color: #fff;
  cursor: pointer; display: grid; place-items: center;
}
.media-expand:hover { background: rgba(0,0,0,.75); }

/* Yeni sohbet / kişi seçici */
.modal {
  position: fixed; inset: 0; z-index: 85;
  background: var(--overlay);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 160ms var(--ease) both;
}
.modal-card {
  width: 100%; max-width: 420px; max-height: 76vh;
  display: flex; flex-direction: column;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0,0,0,.7);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.newchat-search {
  margin: 12px 14px 4px;
  height: 44px; padding: 0 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg); font-size: 14px;
  outline: none;
}
.newchat-search:focus { border-color: var(--border-strong); }
.newchat-list { overflow-y: auto; padding: 6px 8px 12px; }
.newchat-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 10px; border-radius: var(--r-md);
  cursor: pointer;
}
.newchat-item:hover { background: var(--popover); }
.newchat-name { font-size: 14px; color: var(--fg); }
.newchat-new .avatar { background: var(--primary); color: var(--on-primary); font-size: 20px; }
.newchat-empty { padding: 26px 12px; text-align: center; color: var(--subtle); font-size: 13px; }

/* Sohbetteki ekle (attach) menüsü */
.attach-menu {
  position: absolute; bottom: calc(100% + 10px); left: 12px; right: 12px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding: 10px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: 0 22px 60px rgba(0,0,0,.6);
  z-index: 7;
  animation: fade 140ms var(--ease) both;
}
.attach-menu.live-menu { grid-template-columns: repeat(3, 1fr); left: auto; right: 12px; width: 260px; }
.attach-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  padding: 13px 4px;
  border: none; border-radius: var(--r-md);
  background: var(--surface);
  color: var(--fg); font-size: 11.5px; font-family: inherit;
  cursor: pointer;
  transition: background 140ms var(--ease), transform 140ms var(--ease);
}
.attach-item:hover { background: var(--popover); transform: translateY(-1px); }
.attach-item .ai { display: block; height: 22px; color: var(--fg); }
.attach-item .ai svg { width: 22px; height: 22px; display: block; }

/* Yapıştırma (çıkartma) paneli */
.sticker-panel {
  position: absolute; bottom: calc(100% + 10px); left: 12px; right: 12px;
  max-height: 288px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 2px; padding: 10px;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  box-shadow: 0 22px 60px rgba(0,0,0,.6);
  z-index: 7;
  animation: fade 140ms var(--ease) both;
}
.sticker-pack-title {
  grid-column: 1 / -1;
  padding: 8px 4px 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  color: var(--subtle);
}
.sticker-item {
  border: none; background: transparent; cursor: pointer;
  font-size: 38px; line-height: 1; padding: 8px 0;
  border-radius: 12px;
  transition: background 120ms var(--ease), transform 120ms var(--ease);
}
.sticker-item:hover { background: var(--popover); transform: scale(1.12); }

/* Profil düzenleme */
.avatar.xl { width: 84px; height: 84px; font-size: 26px; }
.profile-body { padding: 18px 16px 20px; display: flex; flex-direction: column; overflow-y: auto; }
.profile-avatar {
  position: relative; align-self: center;
  border: none; background: transparent; cursor: pointer;
  margin-bottom: 6px; border-radius: 50%;
}
.profile-avatar .avatar { border: 2px solid var(--border-strong); }
.profile-avatar-edit {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  background: var(--primary); color: var(--on-primary);
  font-size: 10.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  white-space: nowrap;
}
.profile-label {
  margin: 12px 0 5px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; color: var(--subtle);
}
.profile-body .newchat-search { margin: 0; width: 100%; box-sizing: border-box; }
.profile-save {
  margin-top: 20px; height: 46px; border: none; border-radius: var(--r-md);
  background: var(--primary); color: var(--on-primary);
  font-size: 14.5px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.profile-save:hover { filter: brightness(.92); }

/* Görünüm (tema + vurgu) */
.settings-sep {
  height: 1px; margin: 20px 0 4px;
  background: var(--border);
}
.settings-title {
  margin: 16px 0 0; font-size: 15px; font-weight: 700;
}
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  margin-top: 8px; padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.seg-btn {
  border: none; background: transparent; color: var(--muted);
  padding: 9px 4px; border-radius: 7px;
  font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background 140ms var(--ease), color 140ms var(--ease);
}
.seg-btn:hover { color: var(--fg); }
.seg-btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }
.swatch-row { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.swatch {
  width: 34px; height: 34px; border-radius: 50%;
  cursor: pointer; padding: 0;
  border: 2px solid var(--border);
  position: relative;
  transition: transform 120ms var(--ease), border-color 120ms var(--ease);
}
.swatch:hover { transform: scale(1.08); }
.swatch[aria-pressed="true"] { border-color: var(--fg); }
.swatch.mono {
  background: linear-gradient(135deg, #fafafa 0 50%, #0a0a0a 50% 100%);
}

/* Mesaj içindeki tıklanabilir telefon numarası */
.msg-phone {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.msg-phone:hover { opacity: .8; }

/* Mesaj içindeki link (şemasız da olabilir) */
.msg-link {
  color: #4d9fff;
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-word;
  cursor: pointer;
}
.msg-link:hover { opacity: .85; }

.msg-row .bubble.sticker {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 0;
  font-size: 96px;
  line-height: 1.05;
}
.bubble.sticker .stamp { color: var(--muted); font-size: 11px; }

/* ============================================================
   GİRİŞ SEKMELERİ + TELEFON KODU
   ============================================================ */
.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
}
.tab {
  height: 36px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: background 160ms var(--ease), color 160ms var(--ease);
}
.tab.active { background: var(--elevated); color: var(--fg); }

.field-label {
  display: block;
  font-size: 12px; color: var(--muted);
  margin: 4px 0 8px;
}
.field-input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--popover);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  outline: 0;
  font-size: 15px;
  transition: border-color 160ms var(--ease);
}
.field-input:focus { border-color: var(--border-strong); }
.field-input.code {
  text-align: center;
  letter-spacing: 0.5em;
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.btn-solid {
  width: 100%;
  background: var(--primary);
  color: var(--on-primary);
  margin-top: 14px;
}
.btn-solid:hover { background: var(--hover-solid); }
.btn-solid:disabled { opacity: 0.45; cursor: default; }

.otp-actions {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 12px;
}
.link-btn {
  background: transparent; border: 0;
  color: var(--muted);
  font-size: 13px; cursor: pointer;
  padding: 6px 2px;
}
.link-btn:hover { color: var(--fg); }
.link-btn:disabled { color: var(--subtle); cursor: default; }

.form-error {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--danger);
}

#pane-phone, #pane-qr { display: grid; gap: 0; }

/* ============================================================
   iOS: ANA EKRANA EKLE REHBERİ
   ============================================================ */
.get-app {
  display: inline-flex; align-items: center; gap: 8px;
  margin-top: 24px;
  height: 44px; padding: 0 18px;
  border-radius: var(--r-lg);
  background: var(--primary); color: var(--on-primary);
  border: 0; font-weight: 600; font-size: 14px;
  cursor: pointer;
}
.ios-install {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(14px);
  display: grid; place-items: center;
  padding: 24px;
  animation: fade 200ms var(--ease) both;
}
.ios-install-card {
  width: 100%; max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  padding: 32px 26px 26px;
  text-align: center;
  box-shadow: 0 40px 120px rgba(0,0,0,.7);
}
.ios-install-card .brand-logo {
  width: 72px; height: 72px;
  margin: 0 auto 6px;
}
.ios-install-card h2 {
  font-size: 24px; letter-spacing: -0.03em;
  margin: 6px 0 8px; font-weight: 700;
}
.ios-install-lead {
  color: var(--muted); font-size: 14px;
  line-height: 1.55; margin: 0 0 22px;
}
.ios-steps { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 16px; text-align: left; }
.ios-steps li {
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); font-size: 14px;
}
.ios-steps li strong { color: var(--fg); font-weight: 600; }
.ios-ico {
  flex: 0 0 auto;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--fg);
}
.ios-ico svg { width: 20px; height: 20px; }

/* ============================================================
   MOBİL / PWA (iPhone tek sütun)
   ============================================================ */
.convo-back { display: none; }

@media (max-width: 1020px) {
  #login { padding: 0; place-items: stretch; }
  .login-wrap {
    grid-template-columns: 1fr;
    gap: 24px;
    max-width: none;
    padding: max(28px, env(safe-area-inset-top)) 22px max(28px, env(safe-area-inset-bottom));
    align-content: center;
  }
  .brand h1 { font-size: 32px; margin: 20px 0 14px; }
  .brand .lead { margin-bottom: 8px; }
  .steps { display: none; }

  .qr-card { padding: 18px; }

  /* Tek sütun: ya sohbet listesi ya konuşma */
  #app { grid-template-columns: 1fr; }
  .sidebar { display: flex; }
  .pane { display: none; }
  body.convo-open .sidebar { display: none; }
  body.convo-open .pane { display: flex; }

  .convo-back { display: grid; }
  .convo-head {
    padding: max(10px, env(safe-area-inset-top)) 12px 10px;
    gap: 8px;
  }
  .messages { padding: 16px 12px 12px; }
  .bubble { max-width: 84%; }
  .composer {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .side-foot {
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (display-mode: standalone) {
  /* Ana ekrandan açıldığında çentik/durum çubuğu boşluğu */
  .sidebar { padding-top: env(safe-area-inset-top); }
}

/* ============ AÇILIŞ ============ */

/* ============================================================
   arama ekranı (sesli + görüntülü)
   ============================================================ */
.call {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background: #000;
  color: var(--fg);
  padding: 30px 22px calc(30px + env(safe-area-inset-bottom));
}
.call.hidden { display: none; }

.call-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.call-remote {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.call-avatar {
  position: absolute;
  width: 104px;
  height: 104px;
  border-radius: var(--r-full);
  background: var(--elevated);
  border: 1px solid var(--border);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: .5px;
}
.call[data-video="1"] .call-avatar { display: none; }
.call[data-video="1"] .call-remote { display: block; }
.call[data-video="0"] .call-remote { display: none; }

.call-local {
  position: absolute;
  top: 18px;
  right: 16px;
  width: 108px;
  height: 152px;
  object-fit: cover;
  border-radius: 14px;
  background: #000;
  z-index: 4;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  border: 1px solid var(--border);
}
.call[data-video="0"] .call-local { display: none; }

.call-head {
  position: relative;
  z-index: 5;
  text-align: center;
  margin-top: 10px;
  width: 100%;
}
.call-name { font-size: 24px; font-weight: 650; }
.call-status { margin-top: 6px; font-size: 14px; color: var(--muted); }

.call-controls {
  position: relative;
  z-index: 5;
  display: flex;
  gap: 22px;
  align-items: center;
  justify-content: center;
}
.call-ctrl {
  width: 64px;
  height: 64px;
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--elevated);
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease) .15s, transform .1s;
}
.call-ctrl svg { width: 26px; height: 26px; }
.call-ctrl:active { transform: scale(.94); }
.call-ctrl.hangup { background: var(--danger); border-color: transparent; color: #fff; }
.call-ctrl.hangup svg { transform: rotate(135deg); }
.call-ctrl.accept { background: var(--primary); border-color: transparent; color: var(--on-primary); }
.call-ctrl.muted { background: var(--primary); border-color: transparent; color: var(--on-primary); }

.call[data-mode="incoming"] .active-only { display: none; }
.call[data-mode="outgoing"] .incoming-only,
.call[data-mode="active"] .incoming-only { display: none; }

/* konum kartı */
.bubble.loc { padding: 8px 8px 4px; }
.loc-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--r-md);
  background: var(--card-tint);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
.loc-map {
  display: block;
  width: 240px;
  max-width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--card-tint);
}
.loc-meta { display: flex; align-items: center; gap: 10px; padding: 4px 12px 10px; }
.loc-meta svg { width: 22px; height: 22px; flex: 0 0 auto; }
.loc-card small { color: inherit; opacity: .65; }

/* Canlı konum: akan harita + üstünde "Haritada aç" butonu */
.loc-live-wrap { position: relative; }
.loc-live-wrap img.loc-map { width: 100%; max-width: 100%; height: 168px; }
.loc-live.ended .loc-live-wrap img.loc-map { filter: grayscale(1) brightness(.8); }
.loc-live-badge {
  position: absolute; top: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px; border-radius: var(--r-full);
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  backdrop-filter: blur(6px);
}
.loc-live-badge.ended { background: rgba(0, 0, 0, .5); font-weight: 500; }
.loc-pulse {
  width: 7px; height: 7px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .7);
  animation: locPulse 1.8s infinite;
}
@keyframes locPulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .7); }
  70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}
.loc-open {
  position: absolute; top: 8px; right: 8px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: var(--r-full);
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 11.5px; font-weight: 600; text-decoration: none;
  backdrop-filter: blur(6px);
  transition: background 140ms var(--ease);
}
.loc-open:hover { background: rgba(0, 0, 0, .82); }
.loc-open svg { width: 13px; height: 13px; }
.loc-live { cursor: pointer; }

/* Canlı konum akışı (tam ekran) */
.livemap-card {
  width: 100%; max-width: 720px; max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .7);
  animation: rise 180ms var(--ease) both;
}
.livemap-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.livemap-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.livemap-title-text { min-width: 0; display: flex; flex-direction: column; }
.livemap-title-text strong { font-size: 15px; }
.livemap-title-text small { font-size: 12px; color: var(--subtle); }
.livemap-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.loc-open-static {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: var(--r-md);
  border: 1px solid var(--border-strong);
  color: var(--fg); font-size: 12.5px; font-weight: 600; text-decoration: none;
  transition: background 140ms var(--ease);
}
.loc-open-static:hover { background: var(--popover); }
.loc-open-static svg { width: 14px; height: 14px; }
.livemap-stage { flex: 1; min-height: 0; background: var(--surface); }
.livemap-stage img { display: block; width: 100%; height: 100%; min-height: 300px; max-height: 64vh; object-fit: cover; }
@media (max-width: 620px) {
  .loc-open-static span { display: none; }
}
