:root {
  --bg-rail: #18191c;
  --bg-side: #222327;
  --bg-main: #2c2d32;
  --bg-elev: #36373d;
  --bg-input: #393a40;
  --bg-hover: rgba(255, 255, 255, 0.05);
  --bg-active: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.07);
  --text: #e6e6e9;
  --text-2: #b4b5bb;
  --text-3: #85868d;
  --accent: #e8743b;
  --accent-2: #f08a55;
  --accent-soft: rgba(232, 116, 59, 0.16);
  --mention: rgba(240, 178, 50, 0.1);
  --mention-bar: #f0b232;
  --green: #3fb96f;
  --red: #e5484d;
  --radius: 10px;
  --font: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  background: var(--bg-main);
  color: var(--text);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: #6cb8ff; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--text-3); }

/* ---------- Butonlar ---------- */
.btn {
  border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 600;
  background: var(--bg-elev); transition: background .15s, transform .05s;
}
.btn:hover { background: #42434a; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.danger { background: var(--red); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center; border: 0; background: transparent;
  color: var(--text-2); border-radius: 6px; width: 34px; height: 34px; padding: 0;
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); }
.icon-btn.small { width: 32px; height: 32px; }
.icon-btn.small svg { width: 18px; height: 18px; }
.icon-btn.tiny { width: 20px; height: 20px; }
.icon-btn.tiny svg { width: 14px; height: 14px; }
.icon-btn.danger { color: var(--red); }
.icon-btn .off { display: none; color: var(--red); }
.icon-btn.toggled .on { display: none; }
.icon-btn.toggled .off { display: block; }
.icon-btn.live { color: var(--green); }

/* ---------- Giriş ---------- */
.auth {
  height: 100%; display: grid; place-items: center; padding: 16px;
  background:
    radial-gradient(800px 500px at 15% 10%, rgba(232, 116, 59, 0.18), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(108, 184, 255, 0.10), transparent 60%),
    var(--bg-rail);
}
.auth-card {
  width: min(420px, 100%); background: var(--bg-side); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.auth-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 22px; }
.auth-brand h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.auth-brand p { margin: 2px 0 0; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-rail); border-radius: 10px; padding: 4px; margin-bottom: 18px; }
.auth-tab { border: 0; background: transparent; padding: 8px; border-radius: 7px; color: var(--text-2); font-weight: 600; }
.auth-tab.active { background: var(--bg-elev); color: var(--text); }
#auth-form label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 14px; }
#auth-form input, .modal input, .modal select {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px; border-radius: 8px;
  border: 1px solid transparent; background: var(--bg-rail); outline: none; font-size: 15px;
  text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text);
}
#auth-form input:focus, .modal input:focus, .modal select:focus { border-color: var(--accent); }
.form-error { color: #ff8a8d; font-size: 14px; min-height: 1.2em; margin: 0 0 12px; }
.logo-mark {
  width: 48px; height: 48px; border-radius: 16px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: none;
}

/* ---------- Yerleşim ---------- */
.app { display: grid; grid-template-columns: 72px 248px 1fr; height: 100%; height: 100dvh; }
.rail {
  background: var(--bg-rail); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 8px;
  overflow-y: auto; scrollbar-width: none; min-height: 0;
}
.rail::-webkit-scrollbar { display: none; }
.rail-item { position: relative; cursor: pointer; flex: none; }
.rail-item .pill {
  position: absolute; left: -12px; top: 50%; width: 4px; height: 0; border-radius: 0 4px 4px 0; background: var(--text);
  transform: translateY(-50%); transition: height .15s ease;
}
.rail-item.unread .pill { height: 8px; }
.rail-item:hover .pill { height: 20px; }
.rail-item.active .pill { height: 40px; }
.rail-sep { width: 32px; height: 2px; background: var(--line); border-radius: 2px; flex: none; }
.g-icon {
  width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--bg-main); color: var(--text); font-weight: 700; font-size: 16px; letter-spacing: -0.02em;
  transition: border-radius .15s ease, background .15s ease, color .15s ease; user-select: none;
}
.g-icon:not(.has-img) { background: color-mix(in srgb, var(--c, var(--bg-main)) 22%, var(--bg-main)); }
.g-icon img { width: 100%; height: 100%; object-fit: cover; }
.rail-item:hover .g-icon, .rail-item.active .g-icon { border-radius: 16px; }
.rail-item:hover .g-icon:not(.has-img):not(.add), .rail-item.active .g-icon:not(.has-img):not(.add) { background: var(--c, var(--accent)); color: #fff; }
.g-icon.home { background: var(--bg-main); color: var(--text-2); }
.g-icon.home svg { width: 24px; height: 24px; }
.rail-item.active .g-icon.home, .rail-item:hover .g-icon.home { background: var(--accent); color: #fff; }
.g-icon.add { background: var(--bg-main); color: var(--green); }
.g-icon.add svg { width: 22px; height: 22px; }
.rail-item:hover .g-icon.add { background: var(--green); color: #fff; }
.g-icon.sm { width: 24px; height: 24px; font-size: 10px; border-radius: 8px; }
.g-icon.lg { width: 72px; height: 72px; font-size: 26px; border-radius: 22px; }
.rail-item .badge {
  position: absolute; right: -4px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--red); color: #fff; font-size: 12px; font-weight: 800; display: grid; place-items: center;
  border: 4px solid var(--bg-rail); box-sizing: content-box;
}
.rail-voice {
  position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--green);
  color: #fff; display: grid; place-items: center; border: 3px solid var(--bg-rail);
}
.rail-voice svg { width: 11px; height: 11px; }
.avatar.rail-av { width: 48px; height: 48px; font-size: 17px; transition: border-radius .15s; }

.sidebar { background: var(--bg-side); display: flex; flex-direction: column; min-height: 0; }
.sidebar-head {
  height: 52px; padding: 0 12px 0 16px; display: flex; align-items: center; justify-content: space-between;
  font-weight: 700; border-bottom: 1px solid var(--line); flex: none;
}
.channel-scroll { flex: 1; overflow-y: auto; padding: 8px 8px 16px; }
.cat {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 6px 4px 8px;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3);
}
.cat:hover { color: var(--text-2); }
.channel-list { list-style: none; margin: 0; padding: 0; }
.channel {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; margin: 1px 0; border-radius: 6px;
  color: var(--text-3); cursor: pointer; position: relative; user-select: none;
}
.channel:hover { background: var(--bg-hover); color: var(--text-2); }
.channel.active { background: var(--bg-active); color: var(--text); }
.channel.unread { color: var(--text); font-weight: 600; }
.channel.unread::before { content: ''; position: absolute; left: -8px; width: 4px; height: 8px; border-radius: 0 4px 4px 0; background: var(--text); }
.channel .ch-icon { color: var(--text-3); font-size: 20px; line-height: 1; width: 20px; text-align: center; font-weight: 500; }
.channel .ch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel .badge { background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 1px 6px; }
.voice-users { list-style: none; margin: 0 0 4px; padding: 0 0 0 30px; }
.voice-user { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; color: var(--text-2); font-size: 14px; cursor: default; }
.voice-user:hover { background: var(--bg-hover); }
.voice-user .vu-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.voice-user svg { width: 14px; height: 14px; color: var(--text-3); }
.voice-user .live-tag { font-size: 10px; font-weight: 800; background: var(--red); color: #fff; border-radius: 4px; padding: 0 4px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; color: #1a1a1a; font-size: 14px; position: relative; text-transform: uppercase;
  background: var(--c, #777);
}
.avatar.has-img { background: var(--bg-elev); }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar.xl { width: 80px; height: 80px; font-size: 30px; }
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }
.avatar.speaking { box-shadow: 0 0 0 2px var(--bg-side), 0 0 0 4px var(--green); }
.avatar .dot {
  position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-3); border: 3px solid var(--bg-side);
}
.avatar .dot.on { background: var(--green); }

.voice-panel { border-top: 1px solid var(--line); padding: 8px 8px 8px 12px; background: #1d1e21; }
.voice-panel-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.voice-status { color: var(--green); font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.voice-status .signal { width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.voice-status.connecting { color: #f0b232; }
.voice-where { font-size: 12px; color: var(--text-3); }
.voice-panel-actions { display: flex; gap: 2px; }

.user-panel { display: flex; align-items: center; gap: 6px; padding: 8px; background: #1d1e21; flex: none; }
.user-chip { flex: 1; display: flex; gap: 8px; align-items: center; min-width: 0; padding: 2px 4px; }
.user-chip .uc-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .uc-sub { font-size: 12px; color: var(--text-3); }
.user-actions { display: flex; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main-head {
  height: 52px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(0, 0, 0, .15); min-width: 0;
}
.main-head .hash { font-size: 24px; color: var(--text-3); font-weight: 500; display: grid; place-items: center; min-width: 24px; }
.main-head .hash svg { width: 22px; height: 22px; }
.main-head .topic.readonly { cursor: default; }
.main-head .topic.readonly:empty::before { content: ''; }
.main-head h2 { margin: 0; font-size: 16px; font-weight: 700; white-space: nowrap; }
.main-head .topic {
  color: var(--text-3); font-size: 14px; border-left: 1px solid var(--line); padding-left: 12px; margin-left: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; cursor: pointer;
}
.main-head .topic:empty::before { content: 'Konu ekle'; opacity: .6; }
.head-actions { margin-left: auto; display: flex; }
.mobile-only { display: none; }

.content { flex: 1; display: flex; min-height: 0; }
.chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ---------- Mesajlar ---------- */
.messages { flex: 1; overflow-y: auto; padding: 16px 0 8px; overflow-anchor: none; }
.welcome { padding: 16px 16px 24px; }
.welcome .big-hash { width: 64px; height: 64px; border-radius: 50%; background: var(--bg-elev); display: grid; place-items: center; font-size: 38px; color: var(--text); }
.welcome h3 { font-size: 28px; margin: 12px 0 4px; font-weight: 800; letter-spacing: -0.02em; }
.welcome p { margin: 0; color: var(--text-3); }
.load-more { display: block; margin: 0 auto 12px; }
.day-sep { display: flex; align-items: center; gap: 8px; margin: 16px 16px 8px; color: var(--text-3); font-size: 12px; font-weight: 600; }
.day-sep::before, .day-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.unread-sep { display: flex; align-items: center; margin: 8px 16px; color: var(--red); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.unread-sep::before { content: ''; flex: 1; height: 1px; background: var(--red); margin-right: 6px; }

.msg { position: relative; padding: 2px 48px 2px 72px; min-height: 22px; }
.msg.head { margin-top: 16px; }
.msg:hover { background: rgba(0, 0, 0, .08); }
.msg.mentioned { background: var(--mention); }
.msg.mentioned::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--mention-bar); }
.msg.pending { opacity: .55; }
.msg .avatar { position: absolute; left: 16px; top: 4px; width: 40px; height: 40px; font-size: 16px; cursor: pointer; }
.msg .meta { display: flex; align-items: baseline; gap: 8px; }
.msg .author { font-weight: 600; cursor: pointer; }
.msg .author:hover { text-decoration: underline; }
.msg .time { font-size: 12px; color: var(--text-3); }
.msg .hover-time { position: absolute; left: 0; width: 64px; text-align: right; font-size: 11px; color: var(--text-3); top: 5px; opacity: 0; }
.msg:hover .hover-time { opacity: 1; }
.msg .body { word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; color: #dcdde1; }
.msg .edited { font-size: 11px; color: var(--text-3); margin-left: 4px; }
.msg .reply-ref {
  display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin: 0 0 2px; position: relative; cursor: pointer;
  white-space: nowrap; overflow: hidden;
}
.msg .reply-ref::before {
  content: ''; position: absolute; left: -36px; top: 9px; width: 30px; height: 10px;
  border-left: 2px solid #4e5058; border-top: 2px solid #4e5058; border-top-left-radius: 6px;
}
.msg .reply-ref .avatar { position: static; width: 16px; height: 16px; font-size: 7px; }
.msg .reply-ref b { color: var(--text-2); font-weight: 600; }
.msg .reply-ref span { overflow: hidden; text-overflow: ellipsis; }
.msg.flash { animation: flash 1.4s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }

.body code { font-family: var(--mono); font-size: 13px; background: #1e1f22; padding: 1px 4px; border-radius: 4px; }
.body pre { font-family: var(--mono); font-size: 13px; background: #1e1f22; border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; overflow-x: auto; margin: 4px 0; white-space: pre; }
.body .mention { background: var(--accent-soft); color: var(--accent-2); border-radius: 4px; padding: 0 2px; font-weight: 600; }
.body .spoiler { background: #1e1f22; color: transparent; border-radius: 4px; cursor: pointer; transition: color .15s; }
.body .spoiler.shown { color: inherit; background: rgba(255, 255, 255, .1); }
.body blockquote { margin: 2px 0; padding-left: 10px; border-left: 4px solid #4e5058; }
.body .emoji-only { font-size: 44px; line-height: 1.15; }

.attachment { margin-top: 6px; max-width: min(420px, 100%); }
.attachment img, .attachment video { max-width: 100%; max-height: 340px; border-radius: 8px; display: block; cursor: zoom-in; background: #1e1f22; }
.attachment video { cursor: default; }
.attachment audio { width: 100%; }
.file-card { display: flex; align-items: center; gap: 12px; background: #24252a; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.file-card svg { width: 30px; height: 30px; color: var(--accent); }
.file-card a { font-weight: 600; text-decoration: none; word-break: break-all; }
.file-card small { display: block; color: var(--text-3); }

.reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.reaction {
  display: inline-flex; gap: 6px; align-items: center; border: 1px solid transparent; background: #24252a;
  border-radius: 8px; padding: 2px 8px; font-size: 14px; color: var(--text-2);
}
.reaction:hover { border-color: #4e5058; }
.reaction.mine { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.reaction b { font-size: 13px; font-weight: 700; }

.msg-tools {
  position: absolute; right: 16px; top: -14px; display: none; background: var(--bg-main); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 4px 14px rgba(0, 0, 0, .3); padding: 2px; z-index: 2;
}
.msg:hover .msg-tools, .msg-tools.open { display: flex; }
.msg-tools .icon-btn { width: 30px; height: 30px; }
.msg-tools .icon-btn svg { width: 17px; height: 17px; }
.msg-tools .quick { font-size: 16px; }

.edit-box textarea { width: 100%; background: var(--bg-input); border: 0; border-radius: 8px; padding: 10px 12px; resize: none; outline: none; color: var(--text); }
.edit-box small { color: var(--text-3); font-size: 12px; }
.edit-box small a { cursor: pointer; }

/* ---------- Yazma alanı ---------- */
.composer-wrap { padding: 0 16px; flex: none; }
.reply-bar, .upload-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; background: #24252a;
  border-radius: 10px 10px 0 0; padding: 8px 12px; font-size: 13px; color: var(--text-2);
}
.reply-bar b { color: var(--text); }
.upload-bar .progress { flex: 1; height: 4px; background: var(--bg-elev); border-radius: 2px; overflow: hidden; }
.upload-bar .progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .1s; }
.composer { display: flex; align-items: flex-end; gap: 4px; background: var(--bg-input); border-radius: 10px; padding: 4px 6px; }
.reply-bar:not([hidden]) + .upload-bar[hidden] + .composer,
.upload-bar:not([hidden]) + .composer { border-top-left-radius: 0; border-top-right-radius: 0; }
.composer textarea {
  flex: 1; border: 0; background: transparent; resize: none; outline: none; padding: 9px 4px; max-height: 40vh;
  line-height: 1.4; font-size: 15px;
}
.composer textarea::placeholder { color: var(--text-3); }
.composer .attach { cursor: pointer; }
.typing { height: 24px; font-size: 13px; color: var(--text-2); display: flex; align-items: center; gap: 6px; padding-left: 4px; }
.typing b { font-weight: 700; color: var(--text); }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--text-2); animation: bounce 1.2s infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
.chat.dragging .messages { outline: 2px dashed var(--accent); outline-offset: -10px; }

/* ---------- Üyeler ---------- */
.members { width: 240px; background: var(--bg-side); overflow-y: auto; padding: 8px 8px 16px; flex: none; }
.members.collapsed { display: none; }
.members h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 16px 8px 6px; }
.member { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.member:hover { background: var(--bg-hover); }
.member.offline { opacity: .4; }
.member .m-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member .m-sub { font-size: 12px; color: var(--text-3); }
.member .crown { color: #f0b232; font-size: 12px; margin-left: 4px; }

/* ---------- Ses sahnesi ---------- */
.stage { flex: 1; background: #141518; display: flex; flex-direction: column; min-width: 0; padding: 16px; gap: 16px; overflow: auto; }
.stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-content: start; }
.stage-grid.has-screen { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.tile {
  position: relative; aspect-ratio: 16 / 10; border-radius: 12px; background: var(--bg-side); display: grid; place-items: center;
  overflow: hidden; border: 2px solid transparent; transition: border-color .12s;
}
.tile.speaking { border-color: var(--green); }
.tile .avatar { width: 72px; height: 72px; font-size: 28px; }
.tile .label {
  position: absolute; left: 10px; bottom: 10px; background: rgba(0, 0, 0, .55); border-radius: 6px; padding: 3px 8px;
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px;
}
.tile .label svg { width: 14px; height: 14px; color: var(--red); }
.tile.screen { grid-column: 1 / -1; aspect-ratio: 16 / 9; background: #000; cursor: zoom-in; }
.tile.screen video { width: 100%; height: 100%; object-fit: contain; }
.tile.screen .label { background: var(--red); }
.stage-empty { margin: auto; text-align: center; color: var(--text-2); }
.stage-empty p { font-size: 18px; font-weight: 600; }

/* ---------- Modal, popover ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .12s; }
.modal { width: min(440px, 100%); background: var(--bg-main); border-radius: 14px; padding: 22px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); max-height: 90vh; overflow: auto; }
.modal h3 { margin: 0 0 14px; font-size: 20px; font-weight: 800; }
.modal label { display: block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); margin-bottom: 14px; }
.modal p { color: var(--text-2); margin: 0 0 12px; }
.modal .radio-row { display: flex; gap: 8px; margin-bottom: 14px; }
.modal .radio-row label { flex: 1; margin: 0; display: flex; gap: 8px; align-items: center; background: var(--bg-side); border-radius: 8px; padding: 12px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); font-weight: 600; border: 1px solid transparent; }
.modal .radio-row label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.modal .radio-row input { width: auto; margin: 0; accent-color: var(--accent); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.code-box { font-family: var(--mono); font-size: 20px; background: var(--bg-rail); border-radius: 8px; padding: 12px; text-align: center; letter-spacing: .1em; user-select: all; }
.meter { height: 8px; background: var(--bg-rail); border-radius: 4px; overflow: hidden; margin-top: 8px; }
.meter i { display: block; height: 100%; width: 0; background: var(--green); transition: width .08s; }
@keyframes fade { from { opacity: 0; } }

.popover {
  position: fixed; z-index: 60; background: var(--bg-rail); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .5); padding: 8px;
}
#emoji-pop { display: grid; grid-template-columns: repeat(8, 36px); gap: 2px; }
#emoji-pop:not([hidden]) { display: grid; }
#emoji-pop button { border: 0; background: transparent; font-size: 22px; width: 36px; height: 36px; border-radius: 6px; }
#emoji-pop button:hover { background: var(--bg-active); }
.ctx { min-width: 200px; padding: 6px; }
.ctx button { display: flex; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; font-size: 14px; gap: 8px; align-items: center; }
.ctx button:hover { background: var(--accent); color: #fff; }
.ctx button.danger { color: #ff8a8d; }
.ctx button.danger:hover { background: var(--red); color: #fff; }
.ctx .ctx-label { font-size: 12px; color: var(--text-3); padding: 6px 10px 2px; }
.ctx input[type=range] { width: calc(100% - 20px); margin: 4px 10px 8px; accent-color: var(--accent); }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .85); display: grid; place-items: center; cursor: zoom-out; padding: 24px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; background: var(--bg-rail);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 14px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #1a1b1e; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
.sidebar ::-webkit-scrollbar-thumb, .members::-webkit-scrollbar-thumb { background: transparent; }
.sidebar :hover::-webkit-scrollbar-thumb { background: #18191c; background-clip: padding-box; }

/* ---------- Sunucular, DM'ler, profil ---------- */
.guild-head {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0; background: transparent; padding: 0; font-weight: 700; font-size: 15px; text-align: left;
}
.sidebar-head:has(.guild-head) { padding: 0 12px 0 16px; cursor: pointer; }
.sidebar-head:has(.guild-head):hover { background: var(--bg-hover); }
.head-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.guild-head svg { width: 18px; height: 18px; color: var(--text-2); }
.side-hint { color: var(--text-3); font-size: 13px; padding: 4px 10px; line-height: 1.45; }
.channel.dm { padding: 6px 8px; gap: 10px; }
.channel.dm .avatar { width: 32px; height: 32px; font-size: 13px; }
.channel .ch-icon svg { width: 18px; height: 18px; }

.role-tag { display: inline-flex; margin-left: 4px; vertical-align: middle; }
.role-ico { width: 14px; height: 14px; }
.role-ico.owner { color: #f0b232; fill: rgba(240, 178, 50, .25); }
.role-ico.admin { color: #6cb8ff; fill: rgba(108, 184, 255, .2); }
.m-sub { display: flex; align-items: center; gap: 4px; }
.m-sub svg { width: 12px; height: 12px; }
.member .m-name { display: flex; align-items: center; }

.empty-view { flex: 1; display: grid; place-items: center; padding: 24px; overflow: auto; }
.empty-inner { max-width: 420px; text-align: center; }
.empty-art { width: 88px; height: 88px; border-radius: 28px; margin: 0 auto 18px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-art svg { width: 42px; height: 42px; }
.empty-inner h3 { font-size: 22px; font-weight: 800; margin: 0 0 8px; letter-spacing: -0.01em; }
.empty-inner p { color: var(--text-2); margin: 0 0 20px; line-height: 1.5; }
.empty-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.welcome .avatar.xl { margin-bottom: 4px; }

.ctx button svg { width: 16px; height: 16px; flex: none; }
.ctx button.accent { color: #ffb48a; }
.ctx button.accent:hover { color: #fff; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.profile-card { width: 300px; padding: 0; overflow: hidden; }
.profile-card .pc-banner, .dm-profile .pc-banner { height: 60px; }
.profile-card > .avatar.xl, .dm-profile > .avatar.xl { margin: -40px 0 0 16px; border: 6px solid var(--bg-rail); box-sizing: content-box; }
.dm-profile > .avatar.xl { border-color: var(--bg-side); }
.profile-card .avatar .dot, .dm-profile .avatar .dot { width: 18px; height: 18px; border-width: 5px; right: 2px; bottom: 2px; border-color: var(--bg-rail); }
.dm-profile .avatar .dot { border-color: var(--bg-side); }
.pc-body { padding: 8px 16px 14px; }
.pc-name { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.pc-sub { color: var(--text-3); font-size: 13px; margin-bottom: 8px; }
.pc-meta { color: var(--text-3); font-size: 12px; margin: 8px 0; }
.pc-roles { display: flex; gap: 6px; flex-wrap: wrap; }
.role-chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; font-weight: 600; background: var(--bg-main); border-radius: 6px; padding: 3px 8px; }
.pc-actions { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 6px; }
.pc-actions button { padding: 8px 6px; }
.profile-card .ctx-label { padding: 6px 0 2px; }
.profile-card input[type=range] { width: 100%; margin: 4px 0 6px; }
.dm-profile { margin: -8px -8px 0; }
.dm-profile .pc-name, .dm-profile .pc-sub { padding: 0 16px; }
.dm-profile .pc-name { margin-top: 6px; }
.dm-profile h4 { margin: 18px 16px 6px; }
.mutual { display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 8px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.mutual:hover { background: var(--bg-hover); }

.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.modal.wide { width: min(560px, 100%); }
.set-h { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 22px 0 12px; font-weight: 800; }
.set-h:first-child { margin-top: 0; }
.check-row { display: flex !important; gap: 8px; align-items: center; text-transform: none !important; letter-spacing: 0 !important; font-size: 15px !important; color: var(--text) !important; font-weight: 500 !important; }
.check-row input { width: auto !important; margin: 0 !important; accent-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-list { display: grid; gap: 8px; margin-top: 8px; }
.choice {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-side); text-align: left;
}
.choice:hover { background: var(--bg-elev); }
.choice > span:nth-child(2) { flex: 1; }
.choice b { display: block; font-size: 15px; }
.choice small { color: var(--text-3); font-size: 13px; }
.choice > svg { transform: rotate(-90deg); color: var(--text-3); }
.choice-ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.icon-picker { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.icon-picker:has(> .icon-drop:only-child) { justify-content: center; }
.icon-drop {
  width: 80px; height: 80px; border-radius: 50%; border: 2px dashed var(--text-3); background: transparent; color: var(--text-2);
  display: grid; place-items: center; align-content: center; gap: 2px; font-size: 11px; font-weight: 700; text-transform: uppercase; overflow: hidden; padding: 0;
}
.icon-drop:hover { border-color: var(--accent); color: var(--accent); }
.icon-drop:has(img) { border: 0; }
.icon-drop img { width: 100%; height: 100%; object-fit: cover; }
.icon-picker .btn + .btn { margin-left: 6px; }
.invite-box { display: flex; gap: 8px; align-items: center; background: var(--bg-rail); border-radius: 8px; padding: 6px 6px 6px 14px; }
.invite-box code { flex: 1; font-family: var(--mono); font-size: 18px; letter-spacing: .06em; user-select: all; overflow: hidden; text-overflow: ellipsis; }
#inv-link { word-break: break-all; }
.invite-preview { text-align: center; padding: 6px 0; }
.invite-preview .g-icon { margin: 0 auto 12px; }
.ip-name { font-size: 22px; font-weight: 800; }
.ip-counts { display: flex; gap: 16px; justify-content: center; color: var(--text-2); font-size: 14px; margin-top: 6px; }
.ip-counts span { display: inline-flex; align-items: center; gap: 6px; }
.ip-counts .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; }
.ip-counts .dot.on { background: var(--green); }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid rgba(229, 72, 77, .4); border-radius: 10px; padding: 12px 14px; margin-top: 8px; }
.danger-zone b { display: block; }
.danger-zone small { color: var(--text-3); }
.profile-edit { display: flex; gap: 18px; align-items: center; }
.pe-buttons { display: flex; gap: 6px; margin: 6px 0 10px; }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--bg-main); }

/* ---------- Masaüstü uygulaması (Electron) ---------- */
.desktop .sidebar-head, .desktop .main-head, .desktop .rail, .desktop .auth { -webkit-app-region: drag; }
.desktop button, .desktop input, .desktop textarea, .desktop select, .desktop label, .desktop a,
.desktop .rail-item, .desktop .topic, .desktop .auth-card { -webkit-app-region: no-drag; }
.platform-darwin .rail { padding-top: 46px; }

/* ---------- Mobil ---------- */
@media (max-width: 1100px) {
  .members { position: absolute; right: 0; top: 52px; bottom: 0; z-index: 20; box-shadow: -10px 0 30px rgba(0, 0, 0, .4); }
  .main { position: relative; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; inset: 0 auto 0 0; width: 72px; z-index: 31; transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar {
    position: fixed; inset: 0 auto 0 72px; width: min(260px, calc(86vw - 72px)); z-index: 30; transform: translateX(calc(-100% - 72px));
    transition: transform .2s ease; box-shadow: 10px 0 40px rgba(0, 0, 0, .5);
  }
  .app.nav-open .sidebar, .app.nav-open .rail { transform: none; }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 25; }
  .mobile-only { display: inline-grid; }
  .main-head { padding-left: 8px; }
  .main-head .topic { display: none; }
  .msg { padding-left: 64px; padding-right: 16px; }
  .msg .avatar { left: 12px; }
  .msg-tools { right: 8px; }
  .composer-wrap { padding: 0 8px; padding-bottom: env(safe-area-inset-bottom); }
}

/* ---------- Yasal bağlantılar, hesap silme ---------- */
.legal-note { font-size: 12px; color: var(--text-3); margin: 14px 0 0; line-height: 1.5; }
.legal-note a { color: var(--text-2); }
.auth .legal-note { text-align: center; }
.settings-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Uygulama güncelleme şeridi (masaüstü) ---------- */
.update-bar {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px;
  background: var(--bg-rail); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45); font-size: 14px; max-width: calc(100vw - 32px);
}
.update-bar b { color: var(--text); }
.desktop .update-bar { -webkit-app-region: no-drag; }
