:root {
    color-scheme: light;
    --bg: #f4ecdf;
    --surface: #fff9f1;
    --surface-2: #efe2d1;
    --surface-3: #e3d1bb;
    --line: #d8c5ae;
    --ink: #2b2018;
    --muted: #7e6a56;
    --primary: #b24a2e;
    --primary-ink: #8e3520;
    --on-primary: #fff8f2;
    --accent: #d99a3d;
    --teal: #2f6f65;
    --danger: #b3261e;
    --tick: #2f6f65;
    --indigo: var(--primary);
    --violet: var(--accent);
    --green: var(--teal);
    --glow-a: rgba(217, 154, 61, .18);
    --glow-b: rgba(178, 74, 46, .13);
    --pattern: rgba(178, 74, 46, .055);
    --shadow: 0 24px 70px rgba(74, 47, 27, .16);
    --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, "Times New Roman", serif;
  }

  [data-theme="dark"] {
    color-scheme: dark;
    --bg: #16110d;
    --surface: #201913;
    --surface-2: #2b221b;
    --surface-3: #372b21;
    --line: #493a2d;
    --ink: #f7ecde;
    --muted: #b9a791;
    --primary: #e08a5b;
    --primary-ink: #f2ae8b;
    --on-primary: #2a160d;
    --accent: #e8b45c;
    --teal: #7bc8b8;
    --danger: #f2a099;
    --tick: #7bc8b8;
    --indigo: var(--primary);
    --violet: var(--accent);
    --green: var(--teal);
    --glow-a: rgba(232, 180, 92, .12);
    --glow-b: rgba(224, 138, 91, .11);
    --pattern: rgba(232, 180, 92, .045);
    --shadow: 0 26px 80px rgba(0, 0, 0, .55);
  }

  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  button, input, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  ::selection { background: rgba(99, 102, 241, .45); }

  .hidden { display: none !important; }

  /* ---------- Giriş ---------- */
  .login-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
      radial-gradient(900px 500px at 15% 0%, rgba(99, 102, 241, .18), transparent 60%),
      radial-gradient(700px 500px at 100% 100%, rgba(139, 92, 246, .14), transparent 60%),
      var(--bg);
  }
  .login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 26px;
    padding: 32px 28px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
  }
  .logo-row { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
  .logo {
    width: 54px; height: 54px; border-radius: 17px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
    font-size: 27px; font-weight: 800; color: #fff;
    box-shadow: 0 8px 24px rgba(99, 102, 241, .35);
  }
  .brand { font-size: 26px; font-weight: 750; letter-spacing: -.5px; }
  .tagline { color: var(--muted); font-size: 12.5px; letter-spacing: .2px; }
  .login-title { margin: 26px 0 4px; font-size: 21px; font-weight: 700; }
  .login-sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
  .field { margin-bottom: 14px; }
  .field label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px 2px; }
  .field input {
    width: 100%; padding: 13px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
  }
  .field input:focus { border-color: var(--indigo); box-shadow: 0 0 0 3px rgba(99, 102, 241, .18); }
  .btn-primary {
    width: 100%; padding: 13px 16px; margin-top: 6px;
    border: 0; border-radius: 14px;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
    color: #fff; font-weight: 700;
    transition: filter .15s, transform .05s;
  }
  .btn-primary:hover { filter: brightness(1.07); }
  .btn-primary:active { transform: translateY(1px); }
  .btn-primary:disabled { opacity: .55; cursor: default; }
  .login-error {
    margin-top: 14px; padding: 10px 12px;
    background: rgba(248, 113, 113, .12);
    border: 1px solid rgba(248, 113, 113, .35);
    border-radius: 12px;
    color: #fca5a5; font-size: 13px;
  }
  .demo-hint { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
  .demo-hint code { color: #c7d2fe; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }

  /* ---------- Uygulama ---------- */
  .app {
    height: 100vh;
    height: 100dvh;
    display: grid;
    grid-template-columns: 350px 1fr;
    overflow: hidden;
  }
  .sidebar {
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--line);
    min-width: 0; min-height: 0; overflow: hidden;
  }
  .side-top {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 18px 12px;
  }
  .side-top .logo { width: 38px; height: 38px; border-radius: 12px; font-size: 19px; }
  .side-brand { font-size: 19px; font-weight: 750; letter-spacing: -.3px; line-height: 1.1; }
  .side-brand small { display: block; font-size: 10.5px; font-weight: 500; color: var(--muted); letter-spacing: .3px; }
  .side-user { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .icon-btn {
    width: 38px; height: 38px; border-radius: 12px;
    display: grid; place-items: center;
    background: transparent; border: 0; color: var(--muted);
    transition: background .15s, color .15s;
  }
  .icon-btn:hover { background: var(--surface-2); color: var(--ink); }
  .icon-btn svg { width: 20px; height: 20px; }

  .side-actions { display: flex; gap: 8px; padding: 0 14px 12px; }
  .new-chat-btn {
    flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
    padding: 10px 12px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 12px; color: var(--ink); font-size: 13.5px; font-weight: 600;
  }
  .new-chat-btn:hover { background: var(--surface-3); }
  .new-chat-btn svg { width: 17px; height: 17px; color: var(--indigo); }

  .chat-list { flex: 1; overflow-y: auto; padding: 2px 8px 14px; }
  .chat-row {
    display: flex; gap: 12px; align-items: center;
    padding: 11px 10px; border-radius: 15px;
    cursor: pointer; border: 1px solid transparent;
  }
  .chat-row:hover { background: var(--surface-2); }
  .chat-row.active { background: linear-gradient(135deg, rgba(99, 102, 241, .18), rgba(139, 92, 246, .12)); border-color: rgba(99, 102, 241, .35); }
  .chat-row .chat-more {
    flex: none; width: 26px; height: 26px; border: 0; border-radius: 8px;
    background: transparent; color: var(--muted); cursor: pointer; font-size: 16px;
    line-height: 1; opacity: 0; transition: opacity .12s;
  }
  .chat-row:hover .chat-more, .chat-row .chat-more:focus { opacity: 1; }
  .chat-row .chat-more:hover { background: var(--surface); color: var(--ink); }
  .chat-pin { font-size: 11px; margin-right: 4px; }
  .archive-toggle {
    margin: 10px 14px 16px; padding: 11px 14px; border: 1px solid var(--line);
    border-radius: 12px; background: var(--surface-2); color: var(--muted);
    font-size: 12.5px; font-weight: 600; cursor: pointer; text-align: left;
  }
  .archive-toggle:hover { color: var(--ink); border-color: var(--indigo); }
  .info-summary { color: var(--muted); font-size: 12px; padding: 2px 6px 8px; }
  .info-state { flex: none; font-size: 11.5px; color: var(--muted); }
  .info-state.read { color: var(--indigo); font-weight: 600; }
  .context-menu {
    position: fixed; z-index: 80; min-width: 190px; padding: 6px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .35);
  }
  .context-menu button {
    display: block; width: 100%; text-align: left; padding: 9px 11px;
    border: 0; border-radius: 9px; background: transparent; color: var(--ink);
    font-size: 13px; cursor: pointer;
  }
  .context-menu button:hover { background: var(--surface-2); }
  .context-menu button.danger { color: #f87171; }
  .context-menu .sep { height: 1px; margin: 5px 7px; background: var(--line); }
  .reply-bar {
    display: flex; align-items: center; gap: 10px; padding: 8px 14px;
    border-top: 1px solid var(--line); background: var(--surface-2);
  }
  .mention-bar {
    display: flex; align-items: center; gap: 7px; padding: 8px 14px;
    border-top: 1px solid var(--line); background: var(--surface);
    overflow-x: auto;
  }
  .mention-chip {
    flex: none; border: 1px solid rgba(99, 102, 241, .35);
    background: rgba(99, 102, 241, .12); color: var(--ink);
    border-radius: 999px; padding: 6px 11px; font-size: 12px; cursor: pointer;
  }
  .mention-chip b { color: var(--indigo); }
  .reply-bar .reply-main { flex: 1; min-width: 0; }
  .reply-bar .reply-label { color: var(--indigo); font-size: 11px; font-weight: 700; }
  .reply-bar .reply-text { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .reply-bar button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px; }
  .reply-quote {
    border-left: 3px solid var(--indigo); padding: 4px 8px; margin-bottom: 5px;
    background: rgba(99, 102, 241, .1); border-radius: 0 8px 8px 0;
    font-size: 12px; color: var(--muted); max-width: 100%;
  }
  .reply-quote b { display: block; color: var(--indigo); font-size: 11px; }
  .reply-quote span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msg.mine .reply-quote {
    background: rgba(255, 255, 255, .14);
    border-left-color: rgba(255, 255, 255, .85);
  }
  .msg.mine .reply-quote b { color: #fff; }
  .msg.mine .reply-quote span { color: rgba(255, 255, 255, .82); }
  .msg.mine .poll-option { background: rgba(255, 255, 255, .14); }
  .msg.mine .poll-total { color: rgba(255, 255, 255, .72); }
  .msg.mine .pending-label { color: rgba(255, 255, 255, .8); }
  .msg { cursor: context-menu; }
  .msg.pending .bubble { opacity: .72; }
  .pending-label { font-size: 10px; color: var(--muted); margin-left: 4px; }
  .mention {
    color: var(--indigo); font-weight: 650; background: rgba(99, 102, 241, .12);
    border-radius: 4px; padding: 0 2px;
  }
  .msg-more {
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0 3px; opacity: 0;
  }
  .msg:hover .msg-more, .msg-more:focus { opacity: 1; }
  .msg.mine .meta { justify-content: flex-end; }
  .avatar {
    width: 48px; height: 48px; flex: 0 0 48px;
    border-radius: 50%;
    display: grid; place-items: center;
    color: #fff; font-weight: 700; font-size: 16px;
    background: var(--c, #4f46e5);
    position: relative;
    user-select: none;
  }
  .avatar.small { width: 36px; height: 36px; flex-basis: 36px; font-size: 13px; }
  .avatar .online-dot {
    position: absolute; right: 0; bottom: 0;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--green); border: 2.5px solid var(--surface);
  }
  .conv-sub.typing { color: var(--indigo) !important; font-weight: 600; }
  .chat-main { flex: 1; min-width: 0; }
  .chat-line1 { display: flex; align-items: baseline; gap: 8px; }
  .chat-name { font-weight: 650; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .chat-time { margin-left: auto; font-size: 11px; color: var(--muted); flex: none; }
  .chat-line2 { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
  .chat-preview { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 13px; }
  .chat-preview.unread { color: var(--ink); }
  .chat-muted { flex: none; font-size: 11px; opacity: .75; }
  .badge {
    flex: none; min-width: 20px; height: 20px; padding: 0 6px;
    border-radius: 999px; background: var(--indigo);
    color: #fff; font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
  }
  .side-foot { padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
  .foot-btn {
    width: 28px; height: 28px; border-radius: 9px; border: 1px solid var(--line);
    background: var(--surface-2); color: var(--ink); font-size: 13px;
    display: grid; place-items: center; cursor: pointer;
  }
  .foot-btn:hover { filter: brightness(1.15); }
  .foot-btn.on { border-color: rgba(34, 197, 94, .45); color: var(--green); }
  .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
  .dot.off { background: var(--danger); }

  .conversation { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); position: relative; }
  .conv-head {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 18px; min-height: 72px;
    background: rgba(23, 23, 31, .86); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
  }
  .conv-title { font-weight: 700; font-size: 15.5px; line-height: 1.2; }
  .conv-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .back-btn { display: none; }
  .conv-actions { margin-left: auto; display: flex; gap: 4px; }
  .conv-actions .icon-btn { color: var(--ink); }
  .conv-actions .hidden { display: none; }

  .call-overlay {
    position: fixed; inset: 0; z-index: 80;
    display: grid; place-items: center;
    background: rgba(5, 5, 10, .78); -webkit-backdrop-filter: blur(9px); backdrop-filter: blur(9px);
  }
  .call-card {
    width: min(360px, calc(100vw - 36px));
    border: 1px solid var(--line); border-radius: 26px;
    background: var(--surface); padding: 26px 22px;
    text-align: center; box-shadow: 0 30px 100px rgba(0, 0, 0, .65);
  }
  .call-avatar {
    width: 76px; height: 76px; margin: 0 auto 12px; border-radius: 50%;
    display: grid; place-items: center; font-size: 26px; font-weight: 700;
    background: linear-gradient(135deg, var(--indigo), var(--violet)); color: #fff;
  }
  .call-name { font-size: 20px; font-weight: 700; }
  .call-status { color: var(--muted); font-size: 13px; margin-top: 6px; min-height: 18px; }
  .call-timer { font-variant-numeric: tabular-nums; color: var(--green); font-size: 13px; margin-top: 4px; }
  .call-remote-video {
    width: 100%; max-height: 210px; margin-top: 14px; border-radius: 14px;
    background: #000; object-fit: cover;
  }
  .call-actions { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
  .call-actions.hidden { display: none; }
  .call-btn {
    border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
    border-radius: 999px; padding: 10px 18px; font-weight: 600; cursor: pointer;
  }
  .call-btn.accept { background: rgba(34, 197, 94, .2); border-color: rgba(34, 197, 94, .5); }
  .call-btn.reject { background: rgba(239, 68, 68, .2); border-color: rgba(239, 68, 68, .5); }

  .pinned-bar {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 14px; background: var(--surface-2);
    border-bottom: 1px solid var(--line); cursor: pointer;
  }
  .pinned-bar .pin-icon { color: var(--indigo); font-size: 15px; }
  .pinned-text {
    flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 12.5px; color: var(--muted);
  }
  .pinned-text b { color: var(--ink); font-weight: 600; }
  .pinned-bar button {
    border: 0; background: transparent; color: var(--muted);
    font-size: 18px; cursor: pointer; line-height: 1;
  }
  .messages {
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 18px 20px 10px;
    display: flex; flex-direction: column; gap: 3px;
    background-image: radial-gradient(rgba(99, 102, 241, .055) 1px, transparent 1px);
    background-size: 22px 22px;
  }
  .messages > :first-child { margin-top: auto; }
  .sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .load-older-wrap { align-self: center; margin: 2px 0 8px; }
  .load-older {
    border: 1px solid var(--border, rgba(255, 255, 255, .12));
    background: var(--surface-2); color: var(--muted);
    border-radius: 999px; padding: 5px 14px; font-size: 12px; cursor: pointer;
  }
  .load-older:hover { color: var(--ink); }
  .load-older[disabled] { opacity: .6; cursor: default; }
  .day { align-self: center; margin: 12px 0 8px; padding: 4px 12px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; }
  .sys { align-self: center; margin: 5px 0; padding: 5px 12px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 12px; }
  .msg { display: flex; margin: 2px 0; }
  .msg.mine { justify-content: flex-end; }
  .bubble {
    max-width: min(68%, 560px);
    background: var(--surface-2);
    border-radius: 17px 17px 17px 5px;
    padding: 8px 11px 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
    overflow-wrap: anywhere;
  }
  .msg.mine .bubble {
    background: linear-gradient(135deg, #4f46e5, #6d4ae0);
    border-radius: 17px 17px 5px 17px;
  }
  .sender { font-size: 11.5px; font-weight: 700; margin-bottom: 2px; }
  .text { font-size: 14.5px; line-height: 1.42; white-space: pre-wrap; }
  .meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; margin-top: 2px; font-size: 10.5px; color: rgba(236, 236, 243, .62); }
  .msg.mine .meta { color: rgba(255, 255, 255, .72); }
  .ticks { font-size: 11px; letter-spacing: -2px; }
  .ticks.read { color: var(--tick); }
  .media-note { font-size: 13.5px; opacity: .9; }
  .msg-image {
    display: block;
    width: 100%;
    max-width: 320px;
    max-height: 320px;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(0, 0, 0, .18);
  }
  .msg-audio { width: 250px; max-width: 100%; height: 38px; }
  .msg-video {
    display: block; width: 100%; max-width: 320px; max-height: 360px;
    border-radius: 12px; background: #000;
  }
  .view-once { font-size: 10.5px; opacity: .78; margin-bottom: 4px; letter-spacing: .2px; }
  .reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
  .reaction {
    display: inline-flex; align-items: center; gap: 3px;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--surface-2); color: var(--ink);
    padding: 2px 7px; font-size: 11.5px; line-height: 1.4;
  }
  .reaction.mine { border-color: rgba(99, 102, 241, .65); background: rgba(99, 102, 241, .18); }
  .reaction.add {
    color: var(--muted); font-weight: 700; opacity: 0;
    width: 0; padding: 0; border: 0; margin: 0; overflow: hidden;
    transition: opacity .12s;
  }
  .msg:hover .reaction.add, .reactions:hover .reaction.add {
    opacity: 1; width: auto; padding: 2px 7px; border: 1px solid var(--line);
  }
  @media (hover: none) {
    .reaction.add { display: none; }
  }
  .poll { min-width: 220px; max-width: 290px; }
  .poll-question { font-weight: 650; margin-bottom: 7px; }
  .poll-option {
    position: relative; display: flex; align-items: center; gap: 6px;
    padding: 8px 9px; margin: 3px 0; border-radius: 10px;
    background: var(--surface-2); border: 1px solid transparent;
    cursor: pointer; overflow: hidden;
  }
  .poll-option.mine { border-color: rgba(99, 102, 241, .6); }
  .poll-option .bar {
    position: absolute; inset: 0 auto 0 0; height: 100%;
    background: rgba(99, 102, 241, .2);
  }
  .poll-option .txt { position: relative; flex: 1; font-size: 13px; }
  .poll-option .num { position: relative; font-size: 11px; color: var(--muted); }
  .poll-total { font-size: 11px; color: var(--muted); margin-top: 4px; }
  .edited { opacity: .6; font-size: 10px; margin-right: 4px; }
  .file-download { color: inherit; font-weight: 600; text-decoration: underline; }
  .location-card {
    display: flex; align-items: center; gap: 9px;
    color: inherit; text-decoration: none;
    background: rgba(255, 255, 255, .10);
    border-radius: 12px; padding: 9px 11px;
    min-width: 180px;
  }
  .location-card .loc-icon { font-size: 22px; }
  .location-card small { opacity: .75; }
  .composer {
    display: flex; align-items: flex-end; gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--line);
  }
  .composer textarea {
    flex: 1; resize: none; min-height: 46px; max-height: 150px;
    padding: 12px 15px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 22px; outline: none; line-height: 1.35;
  }
  .composer textarea:focus { border-color: rgba(99, 102, 241, .65); }
  .composer #attach-btn { margin-bottom: 4px; flex: none; }
  .send-btn {
    width: 46px; height: 46px; flex: none;
    border: 0; border-radius: 50%;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
    color: #fff;
  }
  .send-btn:disabled { opacity: .5; cursor: default; }
  .send-btn svg { width: 21px; height: 21px; }

  .empty-conv {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 10px; color: var(--muted); text-align: center; padding: 40px;
  }
  .empty-conv .big { width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: rgba(99, 102, 241, .12); color: var(--indigo); }
  .empty-conv .big svg { width: 34px; height: 34px; }
  .empty-conv h3 { margin: 8px 0 0; color: var(--ink); font-size: 17px; }
  .empty-conv p { margin: 0; font-size: 13.5px; max-width: 320px; }
  .empty-chats { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

  .banner {
    position: absolute; top: 82px; left: 50%; transform: translateX(-50%);
    background: rgba(248, 113, 113, .16); border: 1px solid rgba(248, 113, 113, .4);
    color: #fca5a5; padding: 7px 14px; border-radius: 999px; font-size: 12px; z-index: 5;
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }

  /* ---------- Yeni sohbet ---------- */
  dialog {
    border: 1px solid var(--line); border-radius: 22px; padding: 0;
    background: var(--surface); color: var(--ink);
    width: min(440px, calc(100vw - 32px));
    box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
  }
  dialog::backdrop { background: rgba(5, 5, 10, .65); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
  .dialog-head { display: flex; align-items: center; padding: 18px 20px 10px; }
  .dialog-head h3 { margin: 0; font-size: 17px; }
  .dialog-head .icon-btn { margin-left: auto; }
  .dialog-body { padding: 0 20px 20px; }
  .search-input {
    width: 100%; padding: 12px 14px; margin-bottom: 12px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: 13px; outline: none;
  }
  .search-input:focus { border-color: var(--indigo); }
  .user-row {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 8px; border-radius: 12px; cursor: pointer;
  }
  .user-row:hover { background: var(--surface-2); }
  .user-row .name { font-weight: 600; font-size: 14px; }
  .user-row .uname { color: var(--muted); font-size: 12px; }
  .search-hit {
    padding: 10px 10px; border-radius: 12px; cursor: pointer;
    border: 1px solid transparent;
  }
  .search-hit:hover { background: var(--surface-2); }
  .search-hit .hit-top {
    display: flex; justify-content: space-between; gap: 8px;
    font-size: 11px; color: var(--muted);
  }
  .search-hit .hit-body { margin-top: 3px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .msg.flash .bubble { outline: 2px solid var(--indigo); outline-offset: 2px; }
  .dialog-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }

  .toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--surface-3); border: 1px solid var(--line);
    padding: 10px 16px; border-radius: 12px; font-size: 13px; z-index: 50;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  }

  @media (max-width: 820px) {
    .app { grid-template-columns: 1fr; }
    .sidebar { border-right: 0; }
    .app.chat-open .sidebar { display: none; }
    .app:not(.chat-open) .conversation { display: none; }
    .back-btn { display: grid; }
    .bubble { max-width: 82%; }
    .messages { padding: 14px 12px 8px; }
    .conv-head { padding: 10px 12px; min-height: 64px; }
    .stories-head .muted { display: none; }
    .stories-card { padding: 14px; }
  }

  /* ---------- Topluluklar ---------- */
  .community-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 6px;
    border-radius: 14px;
  }
  .community-row:hover { background: var(--surface-2); }
  .community-main { flex: 1; min-width: 0; }
  .community-title { font-weight: 600; font-size: 14px; }
  .community-desc { color: var(--muted); font-size: 12px; margin-top: 2px; }
  .community-meta { color: var(--indigo); font-size: 11px; margin-top: 3px; }
  .community-join {
    border: 0; border-radius: 12px; padding: 8px 14px; font-size: 12.5px;
    font-weight: 600; background: var(--indigo); color: #fff; flex: none;
  }
  .community-join.secondary { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
  .community-code-row { display: flex; gap: 8px; padding: 10px 4px 2px; }
  .community-code-row input {
    flex: 1; padding: 10px 12px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: 12px; outline: none;
  }
  .community-code-row input:focus { border-color: var(--indigo); }
  .community-code-row button {
    border: 0; border-radius: 12px; padding: 0 14px; background: var(--indigo);
    color: #fff; font-weight: 600;
  }

  
/* ---------- Durumlar ---------- */
  .story-shortcut { flex: 0 0 44px; padding: 0; }
  .stories-sheet {
    position: fixed; inset: 0; z-index: 30; display: flex; align-items: center;
    justify-content: center; padding: 18px; background: rgba(5, 5, 10, .66);
    -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  }
  .stories-card {
    width: min(460px, 100%); max-height: min(82dvh, 760px); overflow-y: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
    padding: 16px; box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
  }
  .stories-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px 12px; }
  .stories-head h2 { margin: 0; font-size: 18px; }
  .stories-head .muted { color: var(--muted); font-size: 12px; }
  .stories-head .spacer { flex: 1; }
  .stories-head .icon-btn { margin-left: 0; }
  .story-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 6px;
    border-radius: 14px; cursor: pointer;
  }
  .story-row:hover { background: var(--surface-2); }
  .story-ring {
    width: 56px; height: 56px; flex: none; border-radius: 50%; padding: 3px;
    background: linear-gradient(135deg, var(--indigo), var(--violet));
  }
  .story-ring.viewed { background: var(--line); }
  .story-ring .avatar { width: 100%; height: 100%; flex-basis: auto; font-size: 17px; }
  .story-name { font-weight: 600; font-size: 14px; }
  .story-meta { color: var(--muted); font-size: 12px; }
  .story-me {
    margin-left: auto; font-size: 11px; color: var(--muted);
    border: 1px solid var(--line); padding: 2px 8px; border-radius: 999px;
  }
  .story-viewer { position: fixed; inset: 0; z-index: 40; display: flex; flex-direction: column; color: #fff; }
  .story-top {
    display: flex; align-items: center; gap: 10px; padding: 14px 16px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .35), transparent);
  }
  .story-top .avatar { width: 38px; height: 38px; flex-basis: 38px; font-size: 13px; }
  .story-top strong { display: block; font-size: 14px; }
  .story-top .icon-btn { margin-left: auto; color: #fff; }
  .story-top .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
  .story-content {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 18px; padding: 20px 26px; text-align: center;
    overflow: hidden;
  }
  .story-content img {
    max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  }
  .story-actions {
    display: flex; justify-content: center; gap: 8px; padding: 0 16px 10px;
  }
  .story-action-btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 7px 13px; border-radius: 999px; font-size: 12px;
    color: #fff; border: 1px solid rgba(255, 255, 255, .32);
    background: rgba(0, 0, 0, .28);
  }
  .story-action-btn:hover { background: rgba(0, 0, 0, .46); }
  .story-action-btn.danger { color: #fecaca; border-color: rgba(248, 113, 113, .62); }
  .viewer-row {
    display: flex; align-items: center; gap: 10px; padding: 8px 2px;
    border-bottom: 1px solid var(--line);
  }
  .viewer-row:last-child { border-bottom: 0; }
  .viewer-row .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
  .viewer-name { font-weight: 600; font-size: 13px; }
  .viewer-time { margin-left: auto; font-size: 11px; color: var(--muted); }
  .story-text {
    margin: 0; font-size: clamp(20px, 5vw, 30px); line-height: 1.3;
    font-weight: 600; text-shadow: 0 2px 24px rgba(0, 0, 0, .25);
  }
  .story-audio { width: 100%; max-width: 420px; margin: 0 auto; display: block; }
  .story-progress { text-align: center; padding: 0 16px 24px; font-size: 12px; opacity: .8; }
  .story-colors { display: flex; gap: 9px; padding: 8px 0 14px; flex-wrap: wrap; }
  .story-color {
    width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; cursor: pointer;
  }
  .story-color.selected { border-color: #fff; outline: 2px solid var(--indigo); }
  #story-text { width: 100%; resize: vertical; min-height: 84px; }
  #story-file { width: 100%; padding: 9px; margin-bottom: 4px; }
  .story-hint { color: var(--muted); font-size: 12px; margin: 4px 0 10px; }

  .link-preview {
    display: flex; flex-direction: column; gap: 0; margin-top: 7px;
    max-width: 320px; border-radius: 12px; overflow: hidden;
    background: rgba(255, 255, 255, .08); border: 1px solid var(--line);
    color: inherit; text-decoration: none;
  }
  .link-preview-image { width: 100%; max-height: 170px; object-fit: cover; display: block; }
  .link-preview-main { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; }
  .link-preview-site { font-size: 10.5px; text-transform: uppercase; letter-spacing: .3px; color: var(--indigo); }
  .link-preview-title { font-size: 13px; font-weight: 650; color: var(--ink); }
  .link-preview-desc { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
  .msg.mine .link-preview { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); }
  .msg.mine .link-preview-site { color: #fff; opacity: .8; }
  .msg.mine .link-preview-title { color: #fff; }
  .msg.mine .link-preview-desc { color: rgba(255, 255, 255, .78); }

  .poll-meta { font-size: 10.5px; color: var(--muted); margin: -2px 0 6px; text-transform: uppercase; letter-spacing: .25px; }
  .poll-option.correct { border-color: rgba(34, 197, 94, .75); background: rgba(34, 197, 94, .18); }
  .poll-option.closed { cursor: default; }
  .poll.closed { opacity: .92; }
  .poll-explanation { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
  .msg.mine .poll-meta, .msg.mine .poll-explanation { color: rgba(255, 255, 255, .72); }
  .msg.mine .poll-option.correct { background: rgba(34, 197, 94, .28); border-color: rgba(167, 243, 208, .8); }

  .poll-form-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
  .poll-form-row .search-input { margin-bottom: 0; }
  .poll-check { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); white-space: nowrap; }
  #poll-options { min-height: 90px; }
  #poll-dialog .btn-primary { margin-top: 12px; }

  .option-active { color: var(--indigo) !important; background: rgba(99, 102, 241, .16) !important; }
  .msg-flag { font-size: 10px; }
  .msg-flag.urgent { filter: drop-shadow(0 0 3px rgba(251, 191, 36, .8)); }
  .effect-layer {
    position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden;
  }
  .effect-layer span {
    position: absolute; top: -40px; animation: belgi-fall 2.4s ease-in forwards;
  }
  @keyframes belgi-fall {
    0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(110vh) rotate(320deg); opacity: 0; }
  }
  @media (prefers-reduced-motion: reduce) {
    .effect-layer { display: none; }
  }

  .media-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
  .media-filter {
    border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
    border-radius: 999px; padding: 6px 11px; font-size: 12px; cursor: pointer;
  }
  .media-filter.active { background: rgba(99, 102, 241, .18); color: var(--ink); border-color: rgba(99, 102, 241, .55); }
  .media-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .media-tile {
    aspect-ratio: 1; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
    background: var(--surface-2); color: var(--muted); cursor: pointer; padding: 4px;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  }
  .media-tile img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }
  .media-tile-icon { font-size: 22px; }
  .media-tile-name { font-size: 9.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  @media (max-width: 520px) {
    .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }

  #media-dialog { max-height: 88vh; }
  #media-dialog .dialog-body { max-height: 72vh; overflow-y: auto; }

  .saved-list { display: flex; flex-direction: column; gap: 6px; max-height: 65vh; overflow-y: auto; }
  .saved-row {
    display: flex; align-items: flex-start; gap: 8px; padding: 10px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2);
    cursor: pointer;
  }
  .saved-row:hover { border-color: rgba(99, 102, 241, .5); }
  .saved-main { flex: 1; min-width: 0; }
  .saved-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
  .saved-top b { color: var(--ink); font-size: 12.5px; }
  .saved-body { margin-top: 4px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .saved-remove { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; padding: 0 2px; }
  .account-actions { display: flex; gap: 8px; margin: 4px 0 10px; }
  .account-actions .btn-secondary { flex: 1; }
  .saved-row .btn-danger {
    width: auto; margin: 0; padding: 6px 10px; font-size: 12px; border-radius: 9px;
  }
  .btn-secondary {
    padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface-2); color: var(--ink); font-weight: 600; cursor: pointer;
  }
  .btn-secondary:hover { border-color: rgba(99, 102, 241, .5); }
  .disappear-options { flex-wrap: wrap; }
  .group-selected { display: flex; flex-wrap: wrap; gap: 6px; }
  .group-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
    border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2);
    font-size: 12px;
  }
  .group-chip button {
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
    font-size: 14px; line-height: 1; padding: 0;
  }
  .group-chip-add { margin-left: auto; color: var(--muted); font-weight: 700; }
  .safety-code {
    margin: 10px 0; padding: 14px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface-2); color: var(--ink); text-align: center;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px; line-height: 1.7; letter-spacing: .5px; overflow-wrap: anywhere;
  }
  .icon-btn.recording { color: var(--danger); animation: voice-pulse 1s ease-in-out infinite; }
  @keyframes voice-pulse { 50% { opacity: .45; } }
  .saved-remove:hover { color: #f87171; }

  .folder-bar { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; }
  .folder-chip {
    flex: none; display: inline-flex; align-items: center; gap: 5px;
    border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
    border-radius: 999px; padding: 6px 11px; font-size: 12px; cursor: pointer;
  }
  .folder-chip.active { color: var(--ink); border-color: rgba(99, 102, 241, .55); background: rgba(99, 102, 241, .16); }
  .folder-chip.folder-add { color: var(--muted); font-weight: 700; }
  .folder-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--folder, #6366f1); flex: none; }
  .folder-assign-row { display: flex; align-items: center; gap: 9px; padding: 9px 4px; font-size: 13.5px; }

  .checklist { min-width: 210px; max-width: 300px; }
  .checklist-title { font-weight: 650; margin-bottom: 6px; }
  .checklist-item { display: flex; align-items: flex-start; gap: 7px; padding: 4px 0; font-size: 13px; }
  .checklist-item input { margin-top: 2px; accent-color: var(--indigo); }
  .checklist-item.done span { text-decoration: line-through; opacity: .6; }
  .checklist-meta { margin-top: 5px; font-size: 10.5px; color: var(--muted); }
  .msg.mine .checklist-meta { color: rgba(255, 255, 255, .72); }

  .schedule-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 40vh; overflow-y: auto; }
  .schedule-row {
    display: flex; align-items: flex-start; gap: 8px; padding: 9px 10px;
    border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2);
  }
  .schedule-main { flex: 1; min-width: 0; }
  .schedule-time { font-size: 11px; color: var(--indigo); font-weight: 600; }
  .schedule-text { margin-top: 2px; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .members-list { display: flex; flex-direction: column; gap: 4px; max-height: 55vh; overflow-y: auto; }
  .member-row { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
  .member-main { flex: 1; min-width: 0; }
  .member-name { font-size: 13.5px; font-weight: 600; }
  .member-you { color: var(--muted); font-weight: 400; }
  .member-sub { font-size: 11px; color: var(--muted); }
  .avatar.small { width: 32px; height: 32px; font-size: 12px; }
  .role-badge { font-size: 10px; padding: 3px 7px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
  .role-badge.admin { background: rgba(99, 102, 241, .18); color: var(--indigo); }
  .role-toggle { border: 0; background: transparent; color: var(--indigo); font-size: 11px; cursor: pointer; padding: 4px; }
  .role-toggle.danger { color: var(--danger); }
  .admin-log-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
  .admin-log-row { padding: 9px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
  .admin-log-top { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); }
  .admin-log-top b { color: var(--ink); font-size: 12.5px; }
  .admin-log-detail { margin-top: 3px; font-size: 12.5px; }
  .admin-log-actor { margin-top: 2px; font-size: 10.5px; color: var(--muted); }

  .permissions-title { font-weight: 650; margin-bottom: 8px; }
  .permissions-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
  .permission-row { display: flex; align-items: center; gap: 9px; padding: 7px 2px; font-size: 13px; }
  .permission-row input { accent-color: var(--indigo); }
  .role-toggle + .role-toggle { margin-left: -4px; }

  .folder-chip { cursor: pointer; }
  .folder-menu { margin-left: 2px; padding: 0 2px; color: var(--muted); font-size: 16px; line-height: 1; }
  .folder-menu:hover { color: var(--ink); }

  #me-avatar { cursor: pointer; }
  #me-avatar:hover { filter: brightness(1.15); }

  .gif-search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
  .gif-search-row .search-input { flex: 1; }
  .gif-search-row .btn-primary { margin: 0; white-space: nowrap; }
  .gif-grid {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px; max-height: 52vh; overflow-y: auto; padding: 2px;
  }
  .gif-item {
    padding: 0; border: 0; background: var(--surface-2); border-radius: 8px;
    overflow: hidden; cursor: pointer; aspect-ratio: 1; display: block;
  }
  .gif-item:hover { outline: 2px solid var(--indigo); outline-offset: -2px; }
  .gif-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
  @media (max-width: 560px) {
    .gif-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  }

  .e2ee-lock { font-size: 10px; opacity: .72; margin-right: 3px; }

  .view-once-btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 9px 13px; border-radius: 10px; font-size: 12.5px;
    color: var(--ink); border: 1px solid var(--line); background: var(--surface-2);
  }
  .view-once-btn:hover { border-color: var(--indigo); }
  .view-once-viewer {
    position: fixed; inset: 0; z-index: 70; background: #000;
    display: flex; align-items: center; justify-content: center; padding: 24px;
  }
  .view-once-viewer img, .view-once-viewer video {
    max-width: 100%; max-height: 100%; object-fit: contain;
  }
  .view-once-viewer .icon-btn {
    position: absolute; top: 16px; right: 16px; z-index: 2;
    color: #fff; background: rgba(255,255,255,.14);
  }
  #view-once-media { display: flex; align-items: center; justify-content: center; width: 100%; }

  /* =========================================================
     Belgi · Sıcak Anadolu görsel dili (2026)
     Açık ve koyu tema aynı sıcaklıkta; kilim dokusu ve terrakota aksan.
     ========================================================= */

  html { background: var(--bg); }
  body {
    background:
      radial-gradient(1100px 620px at 8% -8%, var(--glow-a), transparent 62%),
      radial-gradient(900px 560px at 102% 4%, var(--glow-b), transparent 60%),
      var(--bg);
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
    letter-spacing: .005em;
    transition: background-color .32s ease, color .32s ease;
  }
  ::selection { background: rgba(178, 74, 46, .28); }
  [data-theme="dark"] ::selection { background: rgba(224, 138, 91, .30); }

  .brand, .side-brand, .login-title, .empty-conv h3, .dialog-head h3,
  .stories-head h2, .call-name, .conv-title, .community-title {
    font-family: var(--font-display);
    letter-spacing: -.025em;
  }
  .brand { font-size: 29px; font-weight: 700; }
  .side-brand { font-size: 20px; font-weight: 700; }
  .login-title { font-size: 25px; font-weight: 700; }
  .conv-title { font-size: 18px; font-weight: 700; }

  .logo {
    background: linear-gradient(140deg, var(--primary), var(--accent));
    color: var(--on-primary);
    box-shadow: 0 10px 28px rgba(178, 74, 46, .28);
    transition: transform .25s ease, box-shadow .25s ease;
  }
  .logo:hover { transform: translateY(-1px) rotate(-2deg); }

  /* Giriş */
  .login-wrap {
    position: relative;
    overflow: hidden;
    background:
      radial-gradient(900px 600px at 10% 0%, var(--glow-a), transparent 62%),
      radial-gradient(720px 520px at 100% 100%, var(--glow-b), transparent 62%),
      linear-gradient(160deg, var(--bg), var(--surface) 58%, var(--bg));
  }
  .login-wrap::before {
    content: "";
    position: absolute;
    inset: -18%;
    background-image:
      repeating-linear-gradient(135deg, var(--pattern) 0 1px, transparent 1px 30px),
      repeating-linear-gradient(45deg, var(--pattern) 0 1px, transparent 1px 30px);
    transform: rotate(-7deg);
    opacity: .62;
    pointer-events: none;
  }
  .login-wrap::after {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -160px;
    bottom: -190px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-b), transparent 68%);
    pointer-events: none;
  }
  .login-card {
    position: relative;
    z-index: 1;
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 82%, var(--surface-2)));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    animation: belgi-rise .55s cubic-bezier(.2, .8, .2, 1) both;
  }
  .login-theme-toggle {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 2;
    background: var(--surface-2);
    border: 1px solid var(--line);
  }
  .field input {
    background: var(--surface);
    border-radius: 15px;
  }
  .field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--glow-b);
  }
  .btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--on-primary);
    border-radius: 15px;
    box-shadow: 0 8px 22px rgba(178, 74, 46, .22);
    transition: filter .18s, transform .16s, box-shadow .18s;
  }
  .btn-primary:hover {
    filter: brightness(1.04);
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(178, 74, 46, .28);
  }
  .btn-primary:active { transform: translateY(0) scale(.995); }
  .login-error {
    background: color-mix(in srgb, var(--danger) 12%, transparent);
    border-color: color-mix(in srgb, var(--danger) 36%, transparent);
    color: var(--danger);
  }

  /* Kabuk */
  .sidebar {
    position: relative;
    background: linear-gradient(180deg, var(--surface), var(--bg) 72%);
    border-right: 1px solid var(--line);
  }
  .sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
      repeating-linear-gradient(135deg, var(--pattern) 0 1px, transparent 1px 28px),
      repeating-linear-gradient(45deg, var(--pattern) 0 1px, transparent 1px 28px);
    opacity: .52;
    pointer-events: none;
  }
  .side-top, .side-actions, .folder-bar, .chat-list, .side-foot { position: relative; z-index: 1; }
  .side-top { padding-top: 20px; }
  .side-user { gap: 5px; }
  .icon-btn { border-radius: 13px; }
  .icon-btn:hover { background: var(--surface-2); transform: translateY(-1px); }
  .new-chat-btn {
    background: color-mix(in srgb, var(--surface) 74%, var(--surface-2));
    border-color: var(--line);
    border-radius: 14px;
    transition: background .18s, transform .16s, border-color .18s;
  }
  .new-chat-btn:hover {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
    transform: translateY(-1px);
  }
  .new-chat-btn svg { color: var(--primary); }

  .chat-list { padding: 4px 10px 16px; }
  .chat-row {
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid transparent;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
    animation: belgi-rise .42s cubic-bezier(.2, .8, .2, 1) both;
  }
  .chat-row:hover {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--primary) 14%, transparent);
    transform: translateX(2px);
  }
  .chat-row.active {
    background: linear-gradient(135deg,
      color-mix(in srgb, var(--primary) 15%, transparent),
      color-mix(in srgb, var(--accent) 10%, transparent));
    border-color: color-mix(in srgb, var(--primary) 34%, transparent);
  }
  .chat-name { font-weight: 700; }
  .chat-preview { font-size: 13.2px; }
  .badge {
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 3px 10px rgba(178, 74, 46, .22);
  }
  .side-foot {
    background: color-mix(in srgb, var(--surface) 68%, transparent);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .foot-btn {
    background: var(--surface-2);
    border-color: var(--line);
    border-radius: 10px;
    transition: transform .16s, border-color .16s;
  }
  .foot-btn:hover { transform: translateY(-1px); border-color: var(--primary); }

  /* Sohbet */
  .conversation {
    background:
      radial-gradient(900px 600px at 100% 0%, var(--glow-a), transparent 60%),
      linear-gradient(180deg, var(--bg), var(--surface) 150%);
  }
  .conv-head {
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 30px rgba(74, 47, 27, .06);
  }
  [data-theme="dark"] .conv-head { box-shadow: 0 12px 34px rgba(0, 0, 0, .28); }
  .conv-sub.typing { color: var(--primary-ink) !important; }
  .messages {
    background-image:
      radial-gradient(var(--pattern) 1px, transparent 1.4px),
      linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface) 22%, transparent));
    background-size: 24px 24px, 100% 100%;
  }
  .day, .sys {
    background: color-mix(in srgb, var(--surface) 82%, var(--surface-2));
    border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  }
  .bubble {
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 6px 20px rgba(74, 47, 27, .075);
    transition: background-color .3s ease, border-color .3s ease, box-shadow .3s ease;
  }
  [data-theme="dark"] .bubble { box-shadow: 0 8px 22px rgba(0, 0, 0, .22); }
  .msg.mine .bubble {
    background: linear-gradient(135deg, var(--primary), #c97735);
    border-color: transparent;
    color: #fff8f2;
    box-shadow: 0 8px 24px rgba(178, 74, 46, .24);
  }
  [data-theme="dark"] .msg.mine .bubble {
    background: linear-gradient(135deg, #b85a34, #8f4a26);
    color: #fff8f2;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .26);
  }
  .msg.mine .meta { color: rgba(255, 248, 242, .74); }
  .msg.mine .reply-quote { background: rgba(255, 248, 242, .14); border-left-color: rgba(255, 248, 242, .82); }
  .msg.mine .reply-quote b, .msg.mine .reply-quote span { color: rgba(255, 248, 242, .92); }
  .msg.mine .poll-option { background: rgba(255, 248, 242, .14); }
  .msg.mine .poll-total, .msg.mine .pending-label { color: rgba(255, 248, 242, .72); }
  .sender { color: var(--primary-ink); }
  .mention {
    color: var(--primary-ink);
    background: color-mix(in srgb, var(--primary) 13%, transparent);
  }
  .mention-chip {
    border-color: color-mix(in srgb, var(--primary) 35%, transparent);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
  }
  .reply-quote {
    border-left-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 10%, transparent);
  }
  .reply-quote b { color: var(--primary-ink); }
  .reply-bar .reply-label { color: var(--primary-ink); }
  .reaction.mine {
    border-color: color-mix(in srgb, var(--primary) 60%, transparent);
    background: color-mix(in srgb, var(--primary) 17%, transparent);
  }
  .poll-option.mine { border-color: color-mix(in srgb, var(--primary) 58%, transparent); }
  .poll-option .bar { background: color-mix(in srgb, var(--primary) 20%, transparent); }
  .pinned-bar {
    background: color-mix(in srgb, var(--surface-2) 80%, var(--surface));
    border-bottom-color: var(--line);
  }
  .pinned-bar .pin-icon { color: var(--primary); }

  .composer {
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 74%, var(--surface-2)));
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 34px rgba(74, 47, 27, .055);
  }
  [data-theme="dark"] .composer { box-shadow: 0 -12px 34px rgba(0, 0, 0, .24); }
  .composer textarea {
    background: var(--surface);
    border-color: var(--line);
    border-radius: 24px;
    transition: border-color .18s, box-shadow .18s, background .3s;
  }
  .composer textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--glow-b);
  }
  .send-btn {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--on-primary);
    box-shadow: 0 7px 20px rgba(178, 74, 46, .26);
    transition: transform .16s ease, box-shadow .18s ease, filter .18s ease;
  }
  .send-btn:hover { transform: translateY(-1px) scale(1.03); box-shadow: 0 10px 26px rgba(178, 74, 46, .32); }
  .send-btn:active { transform: scale(.97); }

  .empty-conv .big {
    background: radial-gradient(circle at 35% 30%, var(--surface), var(--surface-2));
    border: 1px solid var(--line);
    color: var(--primary);
    box-shadow: 0 18px 44px rgba(74, 47, 27, .10);
  }
  [data-theme="dark"] .empty-conv .big { box-shadow: 0 18px 44px rgba(0, 0, 0, .28); }

  /* Durumlar, topluluklar, diyaloglar */
  .story-row, .community-row {
    border-radius: 18px;
    transition: background .18s ease, transform .18s ease, border-color .18s ease;
  }
  .story-row:hover, .community-row:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
  }
  .community-row {
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 12px;
  }
  .community-title { font-size: 16px; }
  .community-meta { color: var(--primary-ink); }
  .community-join {
    background: var(--primary);
    color: var(--on-primary);
    border-radius: 13px;
    transition: transform .16s, filter .16s;
  }
  .community-join:hover { transform: translateY(-1px); filter: brightness(1.04); }
  .stories-card, .call-card {
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 84%, var(--surface-2)));
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
  .stories-sheet { background: rgba(31, 20, 12, .58); }
  dialog {
    background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 86%, var(--surface-2)));
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
  dialog::backdrop { background: rgba(31, 20, 12, .56); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
  dialog[open] { animation: belgi-pop .24s cubic-bezier(.2, .8, .2, 1) both; }
  .context-menu, .toast {
    background: var(--surface);
    border-color: var(--line);
    box-shadow: var(--shadow);
  }
  .context-menu button.danger { color: var(--danger); }
  .banner {
    background: color-mix(in srgb, var(--danger) 13%, var(--surface));
    border-color: color-mix(in srgb, var(--danger) 38%, transparent);
    color: var(--danger);
  }
  .toast { background: var(--surface-3); }
  .call-avatar {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--on-primary);
  }
  .call-timer { color: var(--teal); }

  /* Hareket */
  @keyframes belgi-rise {
    from { opacity: 0; transform: translateY(10px) scale(.988); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes belgi-pop {
    from { opacity: 0; transform: translateY(8px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
  @keyframes belgi-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(47, 111, 101, .35); }
    55% { box-shadow: 0 0 0 7px rgba(47, 111, 101, 0); }
  }
  .msg:last-child { animation: belgi-rise .24s cubic-bezier(.2, .8, .2, 1) both; }
  .avatar .online-dot { animation: belgi-pulse 2.6s ease-out infinite; }
  .call-card { animation: belgi-pop .3s cubic-bezier(.2, .8, .2, 1) both; }

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

  /* Mobil web: kompakt başlık ve taşmayan besteci */
  .folder-chip.active {
    color: var(--ink);
    border-color: color-mix(in srgb, var(--primary) 48%, transparent);
    background: color-mix(in srgb, var(--primary) 14%, transparent);
  }
  .folder-dot { background: var(--primary); }

  @media (max-width: 820px) {
    .conv-title {
      max-width: 46vw;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .composer {
      flex-wrap: wrap;
      align-items: center;
      gap: 4px;
      padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    }
    .composer .icon-btn {
      width: 34px;
      height: 34px;
      flex: 0 0 34px;
    }
    .composer .icon-btn svg { width: 18px; height: 18px; }
    .composer textarea {
      order: 10;
      flex: 1 1 calc(100% - 50px);
      min-width: 0;
      min-height: 42px;
      padding: 10px 12px;
      border-radius: 20px;
    }
    .send-btn {
      order: 11;
      width: 42px;
      height: 42px;
      flex: 0 0 42px;
    }
    .composer #attach-btn { margin-bottom: 0; }
  }

  /* Anket/liste/bağlantı kartları HTML girintisini metin gibi korumamalı. */
  .poll, .checklist, .link-preview, .location-card, .view-once-btn,
  .poll-option, .checklist-item {
    white-space: normal;
  }

  /* Gelen mesaj meta satırı açık temada okunaklı kalsın. */
  .msg:not(.mine) .meta {
    color: color-mix(in srgb, var(--muted) 90%, transparent);
  }

  /* Hesap, yasal baglantilar ve sifirlama */
  .login-help { margin-top: 12px; text-align: right; font-size: 12.5px; }
  .login-help a, .legal-links a { color: var(--primary-ink); text-decoration: none; font-weight: 600; }
  .login-help a:hover, .legal-links a:hover { text-decoration: underline; }
  .legal-links {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px;
    margin-top: 16px; color: var(--muted); font-size: 11.5px;
  }
  .btn-danger {
    width: 100%; margin-top: 14px; padding: 12px 16px; border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent);
    border-radius: 14px; background: color-mix(in srgb, var(--danger) 12%, var(--surface));
    color: var(--danger); font-weight: 700; transition: background .16s, transform .16s;
  }
  .btn-danger:hover { background: color-mix(in srgb, var(--danger) 20%, var(--surface)); transform: translateY(-1px); }
  .dialog-warning {
    margin: 0 0 14px; padding: 11px 12px; border-radius: 12px; font-size: 12.5px; line-height: 1.5;
    color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  }
  .legal-page {
    min-height: 100vh;
    min-height: 100dvh; padding: 40px 18px; background:
      radial-gradient(900px 520px at 10% 0%, var(--glow-a), transparent 60%), var(--bg);
  }
  .legal-card {
    width: min(780px, 100%); margin: 0 auto; background: var(--surface);
    border: 1px solid var(--line); border-radius: 26px; padding: 30px;
    box-shadow: var(--shadow); color: var(--ink);
  }
  .legal-card h1 { font-family: var(--font-display); font-size: 32px; margin: 0 0 6px; }
  .legal-card h2 { font-family: var(--font-display); font-size: 20px; margin: 26px 0 8px; }
  .legal-card p, .legal-card li { color: var(--muted); font-size: 14px; line-height: 1.65; }
  .legal-card a { color: var(--primary-ink); }
  .legal-meta { color: var(--muted); font-size: 12px; margin-bottom: 18px; }
  .legal-back { display: inline-flex; margin-bottom: 18px; color: var(--primary-ink); font-weight: 600; text-decoration: none; }
  .reset-form { display: flex; flex-direction: column; gap: 12px; }
  .reset-success { color: var(--teal); font-size: 13.5px; line-height: 1.5; }

/* Web sohbet/mesaj çoklu seçim */
.chat-bulk-bar, .bulk-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; margin: 6px 10px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.chat-bulk-bar { margin: 4px 8px 6px; }
.chat-bulk-bar span, .bulk-bar span { font-size: 12.5px; font-weight: 650; margin-right: auto; }
.bulk-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 9px; padding: 6px 10px; font-size: 12px; cursor: pointer;
}
.bulk-btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.bulk-btn:hover { filter: brightness(1.12); }
.chat-select {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%;
  border: 1.5px solid var(--line); margin-right: 8px; display: grid; place-items: center;
  color: transparent; font-size: 12px; background: var(--surface);
}
.chat-select.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.chat-select.on::after { content: '✓'; }
.msg.selectable { cursor: pointer; }
.msg-select { width: 17px; height: 17px; margin: 0 6px; align-self: center; accent-color: var(--primary); }
.chat-row.selecting { background: color-mix(in srgb, var(--primary) 8%, transparent); }

/* ---------- Tamga cikartmalari ---------- */
.sticker-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; }
.sticker-tab {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; white-space: nowrap; cursor: pointer;
}
.sticker-tab.active { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.sticker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.sticker-item {
  border: 0; background: transparent; padding: 4px; cursor: pointer; border-radius: 14px;
}
.sticker-item:hover { background: var(--surface-2); }
.sticker-item img { width: 100%; height: auto; display: block; }
.msg-sticker { width: 128px; height: 128px; display: block; }
.msg.mine .msg-sticker { margin-left: auto; }

/* ---------- Durum yanit/tepki ---------- */
.story-reactions { display: flex; gap: 8px; justify-content: center; padding: 10px 16px; }
.story-reaction {
  border: 1px solid rgba(255,255,255,.45); background: rgba(0,0,0,.28); color: #fff;
  border-radius: 999px; padding: 7px 12px; font-size: 17px; cursor: pointer;
}
.story-reaction.mine { background: rgba(255,255,255,.32); border-color: #fff; }
.story-reaction-count { font-size: 12px; margin-left: 3px; }
.story-reply-bar { display: flex; gap: 8px; padding: 8px 16px 18px; }
.story-reply-bar input {
  flex: 1; border-radius: 22px; border: 1px solid rgba(255,255,255,.45);
  background: rgba(0,0,0,.32); color: #fff; padding: 11px 16px; outline: none;
}
.story-reply-bar button {
  border: 0; border-radius: 22px; padding: 0 18px; background: #fff; color: #2b1a12; font-weight: 700;
}
.story-summary { text-align: center; font-size: 12px; opacity: .85; padding-bottom: 8px; }
.story-reply-row { display: flex; gap: 10px; padding: 8px 0; align-items: flex-start; }
.story-reply-row .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
.story-reply-row .body { font-size: 13px; }
.story-reply-row .meta { font-size: 11px; color: var(--muted); }

/* ---------- Canli konum ---------- */
.live-location-bar { display: flex; flex-direction: column; gap: 6px; padding: 6px 12px; }
.live-location-item {
  display: flex; align-items: center; gap: 10px; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: 13px;
}
.live-location-item .dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--success, #16a34a);
  box-shadow: 0 0 0 4px rgba(22,163,74,.18);
}
.live-location-item a { color: var(--indigo); font-weight: 600; text-decoration: none; }
.live-location-item button {
  margin-left: auto; border: 1px solid var(--line); background: transparent; color: var(--danger, #b91c1c);
  border-radius: 8px; padding: 3px 8px; font-size: 11px; cursor: pointer;
}


/* ---------- Sohbet arka planlari ---------- */
.background-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.background-option {
  border: 2px solid transparent; border-radius: 14px; padding: 0; cursor: pointer;
  overflow: hidden; background: transparent; text-align: left;
}
.background-option.selected { border-color: var(--indigo); }
.background-swatch { height: 72px; border-radius: 10px; border: 1px solid var(--line); }
.background-label { font-size: 11.5px; color: var(--text); padding: 5px 2px 2px; }

.messages[data-background="kilim"] {
  background-image:
    radial-gradient(circle at 25% 25%, rgba(107,58,34,.10) 0 3px, transparent 4px),
    linear-gradient(45deg, rgba(107,58,34,.06) 25%, transparent 25%, transparent 75%, rgba(107,58,34,.06) 75%);
  background-size: 46px 46px, 92px 92px;
}
.messages[data-background="lale"] {
  background-image:
    radial-gradient(ellipse at 50% 20%, rgba(190,24,93,.10) 0 8px, transparent 9px),
    radial-gradient(ellipse at 50% 80%, rgba(15,118,110,.08) 0 6px, transparent 7px);
  background-size: 90px 90px, 70px 70px;
}
.messages[data-background="bozkir"] {
  background-image: linear-gradient(180deg, rgba(180,83,9,.14), rgba(180,83,9,0) 55%),
    radial-gradient(circle at 78% 14%, rgba(180,83,9,.18) 0 26px, transparent 27px);
}
.messages[data-background="cini"] {
  background-image:
    radial-gradient(circle, rgba(15,118,110,.14) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(15,118,110,.08) 0 12px, transparent 13px);
  background-size: 54px 54px, 54px 54px;
  background-position: 0 0, 27px 27px;
}
.messages[data-background="ayyildiz"] {
  background-image:
    radial-gradient(circle at 80% 16%, rgba(199,210,236,.85) 0 22px, transparent 23px),
    radial-gradient(circle at 86% 16%, rgba(232,236,247,1) 0 18px, transparent 19px),
    radial-gradient(1px 1px at 20% 30%, rgba(70,80,120,.35), transparent),
    radial-gradient(1px 1px at 62% 72%, rgba(70,80,120,.28), transparent);
  background-size: auto, auto, 120px 120px, 90px 90px;
}
.messages[data-background="kina"] {
  background-image:
    radial-gradient(circle at 14px 14px, rgba(159,18,57,.14) 0 3px, transparent 4px),
    radial-gradient(circle at 42px 42px, rgba(159,18,57,.08) 0 8px, transparent 9px);
  background-size: 56px 56px, 56px 56px;
}
.messages[data-background="gokturk"] {
  background-image:
    repeating-linear-gradient(90deg, rgba(28,42,46,.06) 0 2px, transparent 2px 24px),
    repeating-linear-gradient(0deg, rgba(28,42,46,.05) 0 1px, transparent 1px 18px);
}
.messages[data-background="selcuklu"] {
  background-image:
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(18,54,65,.07) 0deg 18deg, transparent 18deg 36deg);
  background-size: 120px 120px;
}
.messages[data-background="osmanli"] {
  background-image:
    radial-gradient(ellipse at 30% 70%, rgba(159,18,57,.10) 0 14px, transparent 15px),
    radial-gradient(ellipse at 70% 30%, rgba(180,83,9,.08) 0 10px, transparent 11px);
  background-size: 110px 110px, 90px 90px;
}
.messages[data-background="kurtizi"] {
  background-image:
    radial-gradient(ellipse at 14px 16px, rgba(30,36,44,.16) 0 5px, transparent 6px),
    radial-gradient(circle at 8px 4px, rgba(30,36,44,.12) 0 2px, transparent 3px),
    radial-gradient(circle at 20px 4px, rgba(30,36,44,.12) 0 2px, transparent 3px);
  background-size: 72px 58px;
}
.messages[data-background="kizilelma"] {
  background-image:
    radial-gradient(circle at 50% 96%, rgba(217,86,45,.18) 0 42px, transparent 43px),
    linear-gradient(180deg, rgba(255,201,180,.35), rgba(255,201,180,0) 60%);
}

/* ---------- Profil ---------- */
.profile-hero {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 18px 16px 14px; border-radius: 18px;
  background: linear-gradient(150deg, var(--surface-2), transparent);
  border: 1px solid var(--line); text-align: center;
}
.profile-hero .avatar { width: 82px; height: 82px; flex-basis: 82px; font-size: 28px; }
.profile-name { font-size: 20px; font-weight: 700; }
.profile-handle { color: var(--muted); font-size: 12.5px; }
.profile-title-chip {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 12px;
}
.profile-bio { color: var(--text); font-size: 13.5px; max-width: 420px; }
.profile-link { color: var(--indigo); font-size: 12.5px; word-break: break-all; }
.profile-stats { display: flex; gap: 8px; margin: 12px 0; }
.profile-stat {
  flex: 1; text-align: center; padding: 9px 6px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.profile-stat b { display: block; font-size: 16px; }
.profile-stat span { font-size: 11px; color: var(--muted); }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.profile-actions button {
  flex: 1 1 auto; min-width: 120px; border: 1px solid var(--line); border-radius: 12px;
  padding: 9px 12px; background: var(--surface-2); color: var(--text); font-size: 13px; cursor: pointer;
}
.profile-actions button.primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.profile-section { margin-top: 14px; }
.profile-section h4 { font-size: 12.5px; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.profile-rules {
  white-space: pre-wrap; font-size: 13px; line-height: 1.5; padding: 10px 12px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line);
}
.profile-list { display: flex; flex-direction: column; gap: 4px; }
.profile-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 10px; cursor: pointer;
}
.profile-row:hover { background: var(--surface-2); }
.profile-row .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 12px; }
.profile-row .name { font-size: 13.5px; font-weight: 600; }
.profile-row .sub { font-size: 11.5px; color: var(--muted); }
.profile-row .role { margin-left: auto; font-size: 11px; color: var(--muted); }
.profile-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.profile-form input, .profile-form textarea {
  width: 100%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 13.5px; resize: vertical;
}

/* iOS çentik/çubuk güvenli alanları: env() desteklenmeyen tarayıcılarda
   mevcut dolgu değişmeden kalır. */
@supports (padding: env(safe-area-inset-top)) {
  .side-top { padding-top: max(20px, env(safe-area-inset-top)); }
  .conv-head { padding-top: max(14px, env(safe-area-inset-top)); }
}
