:root {
  --bg: #e9eef5;
  --bg-grad-a: #eef3f8;
  --bg-grad-b: #e4ebf3;
  --ink: #1c2733;
  --muted: #6b7a8c;
  --line: #dde5ee;
  --panel: #ffffff;
  --panel-2: #f3f6fa;
  --hover: #f7fafc;
  --topbar-a: #f4f7fb;
  --topbar-b: #eef3f8;
  --topbar-line: #d7e0ea;
  --input-bg: #ffffff;
  --tool-bg: #f7f9fb;
  --tool-hover: #eef4fa;
  --msg-hover: rgba(47, 127, 209, .04);
  --brand: #2f7fd1;
  --brand-deep: #1f63ad;
  --brand-soft: #e8f2fc;
  --rail: #1e2a3a;
  --chat-bg: #f7f8fa;
  --danger: #c62828;
  --ok: #2e9e62;
  --rank-owner: #29b6f6;
  --rank-admin: #e53935;
  --rank-op: #fb8c00;
  --rank-hop: #9e9d24;
  --rank-voice: #43a047;
  --font: "Nunito Sans", "Segoe UI", sans-serif;
  --font-brand: "Outfit", "Nunito Sans", sans-serif;
  --font-chat: Tahoma, "Segoe UI", sans-serif;
  --shadow: 0 10px 28px rgba(28, 52, 84, .08);
  --pm-bg: #f2ebe3;
  --pm-glow: rgba(255,255,255,.35);
  --pm-bubble: #ffffff;
  --pm-bubble-mine: #d8f5c8;
}

html.theme-dark {
  --bg: #0f141c;
  --bg-grad-a: #121820;
  --bg-grad-b: #0c1016;
  --ink: #e8eef6;
  --muted: #8b9bb0;
  --line: #2a3545;
  --panel: #161d28;
  --panel-2: #121820;
  --hover: #1c2634;
  --topbar-a: #151c26;
  --topbar-b: #121820;
  --topbar-line: #2a3545;
  --input-bg: #1a2330;
  --tool-bg: #1a2330;
  --tool-hover: #243041;
  --msg-hover: rgba(126, 184, 239, .06);
  --brand: #5ba3e8;
  --brand-deep: #7eb8ef;
  --brand-soft: #1a2d42;
  --chat-bg: #121820;
  --shadow: 0 10px 28px rgba(0, 0, 0, .35);
  --pm-bg: #0e131a;
  --pm-glow: rgba(255,255,255,.04);
  --pm-bubble: #1c2634;
  --pm-bubble-mine: #1a3d2a;
}

* { box-sizing: border-box; }
html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
}
body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-grad-a), var(--bg-grad-b));
  overflow: hidden;
}
[hidden] { display: none !important; }

/* LOGIN */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background:
    radial-gradient(900px 500px at 20% 0%, #cfe3f8 0%, transparent 55%),
    linear-gradient(160deg, #edf3f9, #dbe6f1);
}
.login-card {
  width: min(400px, 100%);
  background: #1b2433;
  color: #fff;
  border-radius: 18px;
  padding: 36px 32px 28px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(16, 28, 48, .28);
}
.login-brand {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: .04em;
  color: #7eb8ef;
  margin-bottom: 4px;
}
.login-client {
  margin: 0 auto 12px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px 5px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1f63ad, #5ba3e8);
  color: #fff;
  font-family: var(--font-brand);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .04em;
  box-shadow: 0 6px 16px rgba(31, 99, 173, .28);
}
.login-client-ico {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.2);
}
.login-client-ico svg { display: block; }
.login-card h1 {
  margin: 0 0 6px;
  font-family: var(--font-brand);
  font-size: 1.9rem;
  font-weight: 800;
}
.login-sub { margin: 0 0 26px; color: #b7c3d4; }
.field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 10px;
  padding: 0 12px;
  margin-bottom: 12px;
  height: 48px;
}
.field-icon { color: #9aa3b2; display: grid; place-items: center; }
.field input {
  border: 0; outline: 0; flex: 1; min-width: 0; height: 46px;
  font: inherit; font-size: 1rem; background: #fff; color: #222;
}
.login-hint { margin: 2px 0 18px; color: #8fa0b5; font-size: .85rem; }
.btn {
  display: block; width: 100%; border: 0; border-radius: 10px; height: 48px;
  font: inherit; font-weight: 800; color: #fff; cursor: pointer; margin-bottom: 10px;
}
.btn-primary { background: var(--brand); }
.btn-primary:hover { background: var(--brand-deep); }
.btn-secondary { background: #5d6b7c; }
.login-error { margin: 10px 0 0; color: #ffb4b4; font-size: .9rem; }

/* APP SHELL — askcafem: sol | (üst bar tam geniş + altta sohbet|nick|odalar) */
.app {
  height: 100%;
  height: 100dvh;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  transition: grid-template-columns .2s ease;
}
.app.rail-open {
  grid-template-columns: 220px minmax(0, 1fr);
}
body.is-logged-in .login-screen { display: none !important; }

.app-shell {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  background: var(--panel);
  position: relative;
  z-index: 1;
}

.app-body {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  overflow: hidden;
  transition: grid-template-columns .32s cubic-bezier(.4, 0, .2, 1);
}
.app.buffers-hidden .app-body {
  grid-template-columns: minmax(0, 1fr) 210px;
}
.app.pm-mode .app-body,
.app.status-mode .app-body,
.app.pm-mode.buffers-hidden .app-body,
.app.status-mode.buffers-hidden .app-body {
  grid-template-columns: minmax(0, 1fr) 190px;
}

.app-center {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.left-rail {
  background: #0c1524;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 14px;
  z-index: 100;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,.04);
  pointer-events: auto;
  isolation: isolate;
}
.rail-brand {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  width: 100%;
}
.app.rail-open .rail-brand { display: flex; }
.rail-brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.25), 0 0 12px rgba(34,197,94,.55);
  flex: 0 0 auto;
}
.rail-brand-text {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: .92rem;
  color: #e8eef6;
  letter-spacing: .02em;
}
.rail-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  width: 100%;
}
.app.rail-open .rail-section {
  align-items: stretch;
}
.rail-sec-title {
  display: none;
  padding: 8px 12px 4px;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #6d7f96;
}
.app.rail-open .rail-sec-title { display: block; }

/* AskCafeM: dolgun squircle butonlar */
.rail-btn {
  width: 46px;
  height: 46px;
  min-height: 46px;
  border: 1px solid rgba(148, 168, 196, .38);
  border-radius: 14px;
  background: #182538;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
  font: inherit;
  font-weight: 800;
  font-size: .86rem;
  white-space: nowrap;
  position: relative;
  z-index: 1;
  pointer-events: auto;
  flex: 0 0 auto;
  transition: background .15s, border-color .15s, color .15s, transform .12s;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.app.rail-open .rail-btn {
  width: 100%;
  height: auto;
  min-height: 46px;
  justify-content: flex-start;
  padding: 0 10px 0 8px;
}
.rail-ico {
  width: 100%;
  height: 100%;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #f1f5f9;
  flex: 0 0 auto;
  transition: color .15s;
}
.app.rail-open .rail-ico {
  width: 34px;
  height: 34px;
}
.rail-btn svg {
  display: block;
  width: 20px;
  height: 20px;
}
.rail-label {
  display: none;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 auto;
  text-align: left;
  color: #e2e8f0;
}
.rail-badge {
  display: none;
  font-size: .65rem;
  font-weight: 800;
  color: #7eb8ef;
  background: rgba(47,127,209,.18);
  border: 1px solid rgba(47,127,209,.28);
  border-radius: 999px;
  padding: 2px 7px;
}
.app.rail-open .rail-label { display: inline; }
.app.rail-open .rail-badge { display: inline-flex; }
.rail-btn:hover {
  background: #22324a;
  border-color: rgba(180, 200, 230, .55);
  color: #fff;
}
.rail-btn:hover .rail-ico {
  background: transparent;
  color: #fff;
  box-shadow: none;
}
.rail-btn:active {
  transform: scale(.97);
}
.rail-toggle .rail-ico {
  background: transparent;
  color: #fff;
}
#rail-radio {
  background: #1f6b45;
  border-color: #2f8f5c;
}
#rail-radio:hover {
  background: #258254;
  border-color: #3aa56c;
}
#rail-radio .rail-ico {
  color: #fff;
}
.rail-soon {
  opacity: 1;
}
.rail-soon .rail-ico {
  opacity: .92;
}
.rail-spacer { flex: 1; min-height: 12px; }

.app-main {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  align-items: stretch;
  gap: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--topbar-a) 0%, var(--topbar-b) 100%);
  border-bottom: 1px solid var(--topbar-line);
  flex: 0 0 auto;
  width: 100%;
  z-index: 60;
  min-height: 64px;
  overflow: visible;
  transition: grid-template-columns .32s cubic-bezier(.4, 0, .2, 1);
}
.app.buffers-hidden .topbar {
  grid-template-columns: minmax(0, 1fr) 210px;
}
.app.pm-mode .topbar,
.app.status-mode .topbar,
.app.pm-mode.buffers-hidden .topbar,
.app.status-mode.buffers-hidden .topbar {
  grid-template-columns: minmax(0, 1fr) 190px;
}

.topbar-main {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  min-width: 0;
  height: 100%;
  overflow: visible;
  position: relative;
  z-index: 2;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
}
.brand-mark { display: none; }
.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  line-height: 1.15;
  min-width: 0;
}
.brand-name {
  font-family: var(--font-brand);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}
.conn-status { font-size: .78rem; font-weight: 700; color: var(--brand); line-height: 1.2; }
.conn-status.is-off { color: #c0392b; }
.conn-status.is-wait { color: #d68910; }

.topbar-channel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  flex: 0 1 auto;
  padding-left: 14px;
  border-left: 1px solid #d5dee8;
  max-width: min(280px, 36%);
}
.channel-title {
  font-family: var(--font-brand);
  font-weight: 800;
  font-size: 1.05rem;
  color: #1e293b;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.user-count {
  color: #8a97a8;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  min-height: 1.2em;
}
.user-count:empty { visibility: hidden; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  position: relative;
  flex: 0 1 auto;
  min-width: 0;
  overflow: visible;
  z-index: 3;
}
.tb-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
  white-space: nowrap;
}
.tb-chip:hover { background: var(--hover); border-color: var(--muted); }
.tb-oper {
  border-color: #c62828;
  color: #b71c1c;
  background: linear-gradient(180deg, #fff5f5, #ffe8e8);
}
.tb-oper:hover {
  background: #ffe0e0;
  border-color: #b71c1c;
}
.tb-oper .oper-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e53935;
  box-shadow: 0 0 0 2px rgba(229, 57, 53, .25);
  flex-shrink: 0;
}
.rail-oper {
  color: #c62828;
}
.rail-oper .rail-ico {
  color: #c62828;
}
.nick-ctx {
  position: fixed;
  z-index: 500;
  min-width: 168px;
  max-width: 240px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nick-ctx[hidden] { display: none !important; }
.nick-ctx button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: .88rem;
  font-weight: 650;
  color: var(--ink);
  cursor: pointer;
}
.nick-ctx button:hover {
  background: var(--hover);
  color: var(--brand-deep);
}
.nick-ctx hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 2px;
}
.modal.modal-oper {
  width: min(520px, 100%);
}
.oper-center { display: flex; flex-direction: column; gap: 12px; }
.oper-tabs {
  display: flex;
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.oper-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 750;
  font-size: .88rem;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.oper-tab.is-active {
  color: #b71c1c;
  background: rgba(198, 40, 40, .1);
  border-color: rgba(198, 40, 40, .28);
}
.oper-hint {
  margin: 0 0 4px !important;
  font-size: .86rem !important;
}
.oper-sub {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--panel-2, var(--hover));
}
.oper-sub strong {
  display: block;
  margin-bottom: 8px;
  font-size: .9rem;
}
.oper-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.oper-act {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  font-size: .82rem;
  font-weight: 750;
  cursor: pointer;
  min-height: 42px;
}
.oper-act:hover {
  border-color: #c62828;
  color: #b71c1c;
  background: rgba(198, 40, 40, .08);
}
.oper-act-wide { grid-column: 1 / -1; }
.tb-theme .ico-sun { display: none; }
.tb-theme.is-dark .ico-moon { display: none; }
.tb-theme.is-dark .ico-sun { display: inline; }
.tb-theme-ico { display: inline-flex; align-items: center; }
.mh-ico .ico-sun { display: none; }
.mh-ico.is-dark .ico-moon { display: none; }
.mh-ico.is-dark .ico-sun { display: block; }
.mh-ico.is-dark {
  background: rgba(126, 184, 239, .18);
  color: #7eb8ef;
}
.tb-status-wrap {
  position: relative;
  flex: 0 0 auto;
  z-index: 5;
}
.tb-status .status-dot,
#my-status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.2);
  flex: 0 0 auto;
}
#my-status-dot.is-away { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245,158,11,.22); }
#my-status-dot.is-brb { background: #38bdf8; box-shadow: 0 0 0 2px rgba(56,189,248,.22); }
#my-status-dot.is-busy { background: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,.22); }
#my-status-dot.is-available { background: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,.2); }

.status-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  background: #fff;
  border: 1px solid #d7e0ea;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15,23,42,.18);
  padding: 6px;
  display: grid;
  gap: 2px;
  z-index: 9999;
}
.status-menu[hidden] { display: none !important; }
.status-menu hr {
  border: 0;
  border-top: 1px solid #e8eef4;
  margin: 4px 2px;
}
.status-opt {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: .84rem;
  cursor: pointer;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}
.status-opt:hover { background: #f1f5f9; }
.status-opt.is-active { background: #e8f2fc; color: #1e4f8c; }
.status-opt.status-link { color: #475569; font-weight: 600; }
.status-opt .sd {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.status-opt .sd.available { background: #22c55e; }
.status-opt .sd.away { background: #f59e0b; }
.status-opt .sd.brb { background: #38bdf8; }
.status-opt .sd.busy { background: #ef4444; }

.nick-av-wrap {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.nick-av-wrap .nick-avatar {
  width: 32px;
  height: 32px;
}
.nick-presence {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #22c55e;
  border: 2px solid #fff;
  box-sizing: border-box;
  z-index: 2;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .06);
}
.nick-presence.is-away { background: #f59e0b; }
.nick-presence.is-brb { background: #38bdf8; }
.nick-presence.is-busy { background: #ef4444; }
.nick-presence.is-available { background: #22c55e; }
.tb-caret { font-size: .7rem; opacity: .55; }
.tb-more { min-width: 38px; justify-content: center; padding-left: 10px; padding-right: 10px; font-size: 1.1rem; }
.tb-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(15,23,42,.14);
  padding: 6px;
  display: grid;
  gap: 2px;
  z-index: 30;
  min-width: 140px;
}
.tb-more-menu[hidden] { display: none !important; }
.tb-more-menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  color: #334155;
}
.tb-more-menu button:hover { background: #f1f5f9; }
.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;
}

/* Mobil koyu şerit — masaüstünde gizli */
.mh-dark {
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  padding: 0 8px;
  min-height: 40px;
  background: #0f1a2a;
  color: #fff;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.mh-dark-spacer { flex: 1 1 auto; }
.mh-dark-icons {
  display: flex;
  align-items: center;
  gap: 2px;
}
.mh-ico {
  border: 0;
  background: transparent;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
  opacity: .92;
}
.mh-ico:hover { background: rgba(255,255,255,.1); opacity: 1; }
.mh-pm-wrap {
  position: relative;
  flex: 0 0 auto;
  margin: 4px 0 4px 6px;
  max-width: min(200px, 54vw);
}
.mh-pm-wrap[hidden] { display: none !important; }
.mh-pm-wrap.is-empty .mh-pm {
  background: #3a4556;
  opacity: .55;
  box-shadow: none;
  animation: none;
  filter: none;
}
.mh-pm-wrap.is-empty .mh-pm:hover {
  opacity: .72;
}
.mh-pm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 4px 8px 4px 10px;
  border: 0;
  border-radius: 6px;
  background: #7f1d1d;
  color: #fff;
  cursor: pointer;
  text-align: left;
  font: inherit;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: opacity .2s ease, background .2s ease, filter .2s ease;
}
.mh-pm-text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.15;
  min-width: 0;
  flex: 1 1 auto;
}
.mh-pm-text strong {
  font-size: .72rem;
  font-weight: 800;
  white-space: nowrap;
}
.mh-pm-text small {
  font-size: .62rem;
  font-weight: 700;
  opacity: .9;
  white-space: nowrap;
}
.mh-pm-count {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.mh-pm-count[hidden] { display: none !important; }
.mh-pm.is-alert {
  background: #b91c1c;
  animation: mh-pm-pulse 1.1s ease-in-out infinite;
}
@keyframes mh-pm-pulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.25); }
}
.mh-pm-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 120;
  min-width: min(260px, 86vw);
  max-width: min(320px, 92vw);
  max-height: min(52vh, 360px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .2);
  padding: 6px;
  display: grid;
  gap: 2px;
}
.mh-pm-menu[hidden] { display: none !important; }
.mh-pm-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  border-radius: 9px;
  padding: 8px 8px;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: #1f2a38;
}
.mh-pm-item:hover,
.mh-pm-item.is-active { background: #f1f5f9; }
.mh-pm-item.is-unread .mh-pm-nick { font-weight: 800; }
.mh-pm-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  overflow: hidden;
  box-shadow: 0 0 0 2px #22c55e;
}
.mh-pm-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.mh-pm-nick {
  font-size: .86rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mh-pm-preview {
  font-size: .68rem;
  color: #6b7a8c;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mh-pm-badge {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .65rem;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.mh-pm-empty {
  padding: 12px 10px;
  font-size: .82rem;
  color: #6b7a8c;
  text-align: center;
}
.tb-chip-ico { display: none; }
#btn-friends { display: none; }
.nicklist-mobile-head { display: none; }
.channel-tab .ct-pin { display: none; }

.topbar-side {
  display: grid;
  grid-template-columns: 210px 190px;
  border-left: 1px solid #d7e0ea;
  min-width: 0;
  overflow: hidden;
  transition: grid-template-columns .32s cubic-bezier(.4, 0, .2, 1);
}
.app.buffers-hidden .topbar-side { grid-template-columns: 210px; }
.app.pm-mode .topbar-side,
.app.status-mode .topbar-side { grid-template-columns: 0px 190px; }
.app.buffers-hidden .tb-rooms-head { display: none; }

.tb-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  font-family: var(--font-brand);
  border-right: 1px solid #d7e0ea;
  min-width: 0;
  overflow: hidden;
  height: 100%;
}
.tb-nick-head {
  transition: opacity .22s ease, padding .32s cubic-bezier(.4, 0, .2, 1);
}
.app.pm-mode .tb-nick-head,
.app.status-mode .tb-nick-head {
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  border-right-width: 0;
  pointer-events: none;
}
.app.pm-mode .topbar-channel {
  display: none;
}
.tb-side-head:last-child { border-right: 0; }
.tb-side-head strong {
  font-size: .95rem;
  font-weight: 800;
  color: var(--ink);
}
.tb-side-head .pane-meta {
  font-size: .82rem;
  font-weight: 800;
  color: var(--muted);
}

.hello { margin-right: 4px; color: var(--muted); font-size: .88rem; font-weight: 700; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 4px; border: 0;
  background: var(--brand-soft); color: var(--brand-deep);
  border-radius: 999px; padding: 4px 9px;
  font: inherit; font-size: .72rem; font-weight: 800; cursor: pointer;
}
.tb-btn:hover { background: #d7e9fb; }
.tb-btn.tb-ghost { background: #eef2f6; color: #425466; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef7f1; color: #1f7a45;
  border-radius: 999px; padding: 6px 10px;
  font-size: .78rem; font-weight: 800;
}
.status-pill i {
  width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; display: inline-block;
}

.pm-actions {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
  padding: 0;
  background: transparent;
  border: 0;
}
.pm-actions .tb-btn {
  padding: 4px 9px;
  font-size: .74rem;
}
.announce {
  display: none !important;
}

/* Yatay kanal sekmeleri */
.channel-tabs {
  display: none;
  flex: 0 0 auto;
  gap: 8px;
  padding: 8px 10px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.channel-tabs::-webkit-scrollbar { height: 4px; }
.channel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  max-width: 160px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #334;
  font: inherit;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}
.channel-tab .ct-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-tab .ct-close {
  border: 0;
  background: transparent;
  color: #889;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0 0 2px;
  cursor: pointer;
}
.channel-tab.is-active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.channel-tab.is-active .ct-close { color: rgba(255,255,255,.9); }
.channel-tab.is-unread:not(.is-active)::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e74c3c;
  flex: 0 0 auto;
}

.main-row {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-pane {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--panel);
}

.topic-bar {
  flex: 0 0 auto;
  order: 0;
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 8px 16px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  min-height: 0;
  max-height: 48px;
  z-index: 2;
  overflow: hidden;
  transition:
    max-height .28s cubic-bezier(.4, 0, .2, 1),
    opacity .22s ease,
    padding .28s cubic-bezier(.4, 0, .2, 1),
    border-color .22s ease;
}
.app.status-mode .topic-bar {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-top-color: transparent;
  border-bottom-color: transparent;
  pointer-events: none;
}
.topic-label {
  font-size: .92rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  flex: 0 0 auto;
}
.topic-label::after { content: ":"; }
.topic-text {
  color: var(--ink);
  font-size: .92rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  flex: 1 1 auto;
  font-family: var(--font-chat);
  line-height: 1.4;
}
.topic-text span[style*="background"] {
  padding: 0 1px;
  border-radius: 0;
}
.client-badge {
  flex: 0 0 auto;
  margin-left: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  padding: 2px 10px 2px 2px;
  border-radius: 999px;
  background: rgba(31, 99, 173, .08);
  color: var(--brand-deep);
  box-shadow: inset 0 0 0 1px rgba(31, 99, 173, .14);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.client-badge:hover {
  transform: translateY(-1px);
  background: rgba(31, 99, 173, .14);
  box-shadow: inset 0 0 0 1px rgba(31, 99, 173, .28), 0 6px 14px rgba(31, 99, 173, .12);
}
.client-badge-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  background: linear-gradient(160deg, #1a6bc4 0%, #2a7fd6 55%, #4f9ae4 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    0 2px 6px rgba(31, 99, 173, .28);
}
.client-badge-mark svg {
  display: block;
}
.client-badge-text {
  display: flex;
  align-items: baseline;
  gap: 5px;
  line-height: 1;
  padding-right: 2px;
}
.client-badge-text strong {
  font-family: var(--font-brand);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .005em;
}
.client-badge-text em {
  font-style: normal;
  font-size: .66rem;
  font-weight: 800;
  opacity: .7;
  letter-spacing: .08em;
}
html.theme-dark .client-badge {
  background: rgba(126, 184, 239, .1);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px rgba(126, 184, 239, .2);
}
html.theme-dark .client-badge:hover {
  background: rgba(126, 184, 239, .16);
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 8px 14px 12px;
  position: relative;
  z-index: 1;
  order: 1;
  font-family: var(--font-chat);
  font-size: 15px;
  line-height: 1.42;
  color: var(--ink);
  background: var(--panel);
}
.msg-line {
  word-wrap: break-word;
  overflow-wrap: anywhere;
  margin: 0;
  padding: 1px 2px;
  border-radius: 0;
}
.msg-line.msg-chat {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 1px 0;
  margin: 0;
}
.msg-line.msg-chat:hover {
  background: transparent;
}
/* Sohbet avatarı — nick listesi gibi yeşil halka */
.msg-av-ring {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  margin-top: 1px;
  border-radius: 50%;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  cursor: default;
}
.msg-av-ring.has-story {
  cursor: pointer;
  padding: 0;
  background: transparent;
}
.msg-av-ring .nick-avatar {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center;
  overflow: hidden !important;
  border: 2px solid #fff !important;
  box-shadow: 0 0 0 2px #22c55e !important;
  box-sizing: border-box;
  font-size: 11px;
  font-weight: 800;
  color: #fff !important;
  line-height: 1;
  margin: 0 !important;
  opacity: 1 !important;
  filter: none !important;
}
.msg-av-ring.has-story .nick-avatar {
  box-shadow:
    0 0 0 2px #f59e0b,
    0 0 0 3.5px #ec4899 !important;
}
.msg-av-ring .nick-avatar.has-img {
  background: #cbd5e1 !important;
}
.msg-av-ring .nick-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.msg-av { display: none !important; }
.nick-avatar.has-img {
  background: #dbe7f5 !important;
}
.nick-avatar img,
.avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.msg-main {
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.42;
}
.msg-line.has-irc-bg {
  padding: 0;
  margin: 0;
}
.msg-line span[style*="background"]:not(.nick-avatar):not(.msg-av) {
  padding: 0;
  border-radius: 0;
  display: inline;
}
.msg-time {
  color: #b0bac6;
  margin-right: 4px;
  font-weight: 600;
  font-size: .85em;
  font-variant-numeric: tabular-nums;
}
.msg-nick-wrap {
  font-weight: 800;
  margin-right: 4px;
  font-size: 1em;
}
.msg-nick {
  font-weight: 800;
  letter-spacing: 0;
}
.msg-chat .msg-nick-wrap::before { content: "<"; opacity: .7; font-weight: 800; }
.msg-chat .msg-nick-wrap::after { content: ">"; opacity: .7; font-weight: 800; margin-right: 3px; }
.msg-body {
  color: var(--ink);
  font-weight: 700;
  font-size: 1em;
}
.msg-chat .msg-body {
  font-weight: 700;
}
.msg-body b, .msg-body strong, .msg-body [style*="font-weight"] {
  font-weight: 800 !important;
}
.msg-body i, .msg-body em, .msg-body [style*="font-style:italic"] {
  font-style: italic !important;
}
.msg-body u, .msg-body [style*="text-decoration:underline"] {
  text-decoration: underline !important;
}
.msg-sys .msg-body { font-weight: 600; }

/* —— Özel mesaj (PM): üst kullanıcı paneli + baloncuk —— */
.app.pm-mode .story-bar {
  display: none !important;
}
.app.pm-mode .topic-bar {
  display: none !important;
}
.pm-header {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  min-height: 56px;
  z-index: 3;
}
.app.pm-mode .pm-header {
  display: flex;
}
.pm-peer {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.pm-peer-av-wrap {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}
.pm-peer-av-wrap .nick-avatar {
  width: 38px;
  height: 38px;
  font-size: .85rem;
}
.pm-peer-av-wrap .nick-presence {
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
}
.pm-peer-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.pm-peer-name {
  font-family: var(--font-brand);
  font-size: 1.05rem;
  font-weight: 800;
  color: #c026a3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pm-peer-status {
  font-size: .72rem;
  font-weight: 700;
  color: #94a3b8;
}
.pm-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.pm-header-actions .tb-btn {
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--tool-bg);
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}
.pm-header-actions .tb-btn:hover {
  background: var(--tool-hover);
  border-color: var(--muted);
}
.pm-close-btn {
  width: 36px;
  min-width: 36px;
  padding: 0 !important;
  font-size: 1.25rem !important;
  line-height: 1;
  color: #c0392b !important;
  background: #fff5f5 !important;
  border-color: #f0c4c0 !important;
}
.pm-close-btn:hover {
  background: #ffe8e8 !important;
}

.app.pm-mode .chat-pane {
  background: var(--pm-bg);
}
.app.pm-mode .messages {
  background:
    radial-gradient(ellipse 80% 50% at 70% 30%, var(--pm-glow), transparent 55%),
    var(--pm-bg);
  padding: 16px 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
/* Az mesaj varken yazışmayı alta yasla */
.app.pm-mode .messages::before {
  content: "";
  flex: 1 1 auto;
  min-height: 0;
  pointer-events: none;
}
.app.pm-mode .composer {
  background: var(--panel);
  border-top: 1px solid var(--line);
}
.app.pm-mode .msg-line.msg-sys {
  opacity: .75;
  font-size: .9em;
  margin: 4px 0 8px;
  text-align: center;
}
.app.pm-mode .msg-line.msg-chat {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: min(72%, 520px);
  margin: 0 0 12px;
  padding: 0;
}
.app.pm-mode .msg-line.msg-chat.msg-mine {
  margin-left: auto;
  flex-direction: row-reverse;
}
.app.pm-mode .msg-chat .msg-av-ring {
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  margin-top: 0;
  margin-bottom: 2px;
}
.app.pm-mode .msg-main {
  flex: 0 1 auto;
  background: var(--pm-bubble);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 12px 9px;
  line-height: 1.4;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
  color: var(--ink);
}
.app.pm-mode .msg-mine .msg-main {
  background: var(--pm-bubble-mine);
  border-color: rgba(74, 155, 60, .28);
}
.app.pm-mode .msg-chat .msg-time {
  display: block;
  margin: 0 0 2px;
  font-size: .68rem;
  color: var(--muted);
  font-weight: 600;
}
.app.pm-mode .msg-chat .msg-nick-wrap {
  display: none;
}
.app.pm-mode .msg-chat .msg-body {
  display: block;
  font-weight: 600;
  color: var(--ink);
}
.app.pm-mode .watermark {
  opacity: .08;
}
.msg-status { color: #5a6a7c; font-weight: 600; }
.msg-topic { font-weight: 700; }
.msg-topic-prefix { color: var(--brand-deep); font-weight: 800; }
.msg-topic-meta { color: #607d8b; font-weight: 700; font-style: italic; }
.msg-notice-nick { color: #6a1b9a; font-weight: 800; }
.msg-error { color: var(--danger); font-weight: 700; }
.msg-join { color: #1e8449; font-weight: 700; }
.msg-part { color: #922b21; font-weight: 700; }
.msg-pm-ping {
  background: #fff6d5;
  border: 1px solid #f0e0a0;
  padding: 6px 10px !important;
  margin: 6px 0 !important;
  font-weight: 700;
}

.watermark {
  position: absolute;
  right: 10%;
  top: 16%;
  display: grid;
  justify-items: center;
  gap: 6px;
  pointer-events: none;
  opacity: .05;
  z-index: 0;
  color: #2f7fd1;
  order: 1;
}
.wm-title {
  font-family: var(--font-brand);
  font-size: clamp(1.4rem, 2.8vw, 2.2rem);
  font-weight: 800;
  letter-spacing: .08em;
}

.composer {
  position: relative;
  z-index: 2;
  order: 2;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 8px 14px 12px;
  flex: 0 0 auto;
  margin-top: auto;
}
.composer-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.tool {
  border: 1px solid var(--line);
  background: var(--tool-bg);
  border-radius: 8px;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  color: var(--ink);
  user-select: none;
}
.tool:hover { background: var(--tool-hover); }
.tool.is-on {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand-deep);
  box-shadow: inset 0 0 0 1px rgba(47, 127, 209, .28);
}
.tool-smile {
  min-width: 34px;
  padding: 0 6px;
  background: linear-gradient(180deg, #fff8e1 0%, #ffe082 100%);
  border-color: #f0c040;
}
.tool-smile:hover {
  background: linear-gradient(180deg, #fffde7 0%, #ffd54f 100%);
  border-color: #f5a623;
}
.tool-smile .smile-ico {
  display: block;
}
.tool-select {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  padding: 0 6px;
  font: inherit;
  font-size: .82rem;
  font-weight: 700;
  color: var(--ink);
  max-width: 130px;
}
.tool-font-label {
  display: none;
}
.tool-spacer { flex: 1; min-width: 8px; }
.color-palette {
  display: grid;
  grid-template-columns: repeat(8, 24px);
  gap: 4px;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  position: absolute;
  bottom: 100%;
  left: 12px;
  margin-bottom: 6px;
  z-index: 20;
}
.color-palette .cp-label {
  grid-column: 1 / -1;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
}
.color-palette button {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,.15);
  cursor: pointer;
  padding: 0;
}
.color-palette button.is-fg {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.radio-widget {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #eef6ff;
  border: 1px solid #d5e6f8;
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  color: #3d5670;
  user-select: none;
  max-width: 100%;
}
.radio-play {
  width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center; font-size: .7rem; font-weight: 800;
}
.radio-meta {
  display: flex; flex-direction: column; line-height: 1.1; min-width: 0;
}
.radio-meta strong { font-size: .75rem; font-weight: 800; }
.radio-meta span { font-size: .68rem; color: var(--muted); font-weight: 700; }
#radio-vol {
  width: 72px;
  accent-color: var(--brand);
}
.radio-live {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .7rem; font-weight: 800; color: #c62828;
}
.radio-live i {
  width: 7px; height: 7px; border-radius: 50%; background: #e53935;
  box-shadow: 0 0 0 0 rgba(229,57,53,.45);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(229,57,53,.45); }
  70% { box-shadow: 0 0 0 8px rgba(229,57,53,0); }
  100% { box-shadow: 0 0 0 0 rgba(229,57,53,0); }
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}
#msg-input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;
  background: var(--input-bg);
  color: var(--ink);
  outline: none;
}
#msg-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47,127,209,.12);
  background: var(--input-bg);
}
.btn-send {
  height: 44px; width: 46px; border: 0; border-radius: 12px;
  background: var(--brand); color: #fff; cursor: pointer;
  display: grid; place-items: center;
}
.btn-send:hover { background: var(--brand-deep); }

.emoji-panel {
  position: absolute; bottom: 100%; left: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px; box-shadow: var(--shadow); z-index: 25;
  width: min(380px, calc(100vw - 36px));
  margin-bottom: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.emoji-tabs {
  display: flex;
  gap: 4px;
}
.emoji-tab {
  flex: 1;
  border: 1px solid #d7e0ea;
  background: #f4f6f8;
  border-radius: 8px;
  padding: 6px 8px;
  font: inherit;
  font-size: .78rem;
  font-weight: 800;
  cursor: pointer;
  color: #475569;
}
.emoji-tab.is-active {
  background: #fff3cd;
  border-color: #f0c040;
  color: #8a5a00;
}
.emoji-grid {
  display: grid;
  gap: 3px;
  grid-template-columns: repeat(9, 1fr);
  max-height: 240px;
  overflow: auto;
  padding: 2px;
}
.emoji-grid button {
  border: 0; background: transparent; font-size: 1.15rem; cursor: pointer; padding: 3px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  min-height: 38px;
}
.emoji-grid button:hover { background: #f1f5f9; }
.emoji-grid .smile-pick img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}
.irc-smile {
  width: 24px;
  height: 24px;
  vertical-align: -6px;
  display: inline-block;
  margin: 0 1px;
  object-fit: contain;
}

/* RIGHT: nick | odalar — üst barın altında */
.right-rail {
  display: grid;
  grid-template-columns: 210px 190px;
  min-height: 0;
  height: 100%;
  align-self: stretch;
  background: #fff;
  width: 400px;
  max-width: 400px;
  overflow: hidden;
  z-index: 4;
  transition:
    grid-template-columns .32s cubic-bezier(.4, 0, .2, 1),
    width .32s cubic-bezier(.4, 0, .2, 1),
    max-width .32s cubic-bezier(.4, 0, .2, 1);
}
.pane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 12px 6px;
  font-family: var(--font-brand);
  font-size: .95rem; font-weight: 800;
  color: var(--ink);
}
.pane-meta { font-size: .82rem; font-weight: 800; color: var(--muted); }

.nicklist-pane, .buffers-pane {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.nicklist-pane {
  width: auto;
  min-width: 0;
  max-width: none;
  border-right: 1px solid var(--line);
  opacity: 1;
  overflow: hidden;
  transition:
    opacity .22s ease,
    border-color .22s ease;
}
.buffers-pane {
  width: 190px;
  min-width: 190px;
  max-width: 190px;
  background: var(--panel-2);
}

.nick-search, .room-search { padding: 10px 10px 8px; flex: 0 0 auto; }
.nick-search input, .room-search input {
  width: 100%; height: 36px; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px; font: inherit; font-size: .86rem; background: var(--input-bg); color: var(--ink); outline: none;
}
.nick-search input:focus, .room-search input:focus {
  border-color: var(--brand); background: var(--input-bg);
}

.nicklist {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; flex: 1 1 auto; min-height: 0;
  background: var(--panel);
}
.nicklist li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 9px; align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
}
.nicklist li:hover, .nicklist li.is-selected { background: var(--hover); }
.nick-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
  border: 2px solid #fff;
  box-sizing: border-box;
  box-shadow:
    0 0 0 2px #22c55e;
}
.nick-avatar::after {
  content: none;
}
.nick-meta { min-width: 0; display: flex; flex-direction: column; gap: 0; }
.nick-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.nick-story-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 2px;
  border-radius: 4px;
  font-size: .85rem;
  line-height: 1;
  font-weight: 900;
  color: #fff;
  background: linear-gradient(135deg, #f59e0b, #ec4899 55%, #8b5cf6);
  box-shadow: 0 0 0 1px rgba(255,255,255,.9), 0 0 8px rgba(236, 72, 153, .4);
  cursor: pointer;
}
.nicklist li.has-story .nick-name {
  font-weight: 900;
}
.nicklist li.has-story .nick-avatar,
.nick-avatar.has-story {
  box-shadow:
    0 0 0 2px #f59e0b,
    0 0 0 3.5px #ec4899;
}
.nick-name {
  font-weight: 700; font-size: .88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
  line-height: 1.25;
}
.nick-rank {
  font-size: .7rem; font-weight: 500; color: #9aa7b5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.2;
  margin-top: 1px;
}
.nicklist li.rank-owner .nick-name { color: var(--rank-owner); }
.nicklist li.rank-admin .nick-name { color: var(--rank-admin); }
.nicklist li.rank-op .nick-name { color: var(--rank-op); }
.nicklist li.rank-hop .nick-name { color: var(--rank-hop); }
.nicklist li.rank-voice .nick-name { color: var(--rank-voice); }
.nicklist li.rank-user .nick-name { color: var(--ink); }
.nicklist li.rank-owner .nick-rank { color: var(--rank-owner); }
.nicklist li.rank-admin .nick-rank { color: var(--rank-admin); }
.nicklist li.rank-op .nick-rank { color: var(--rank-op); }
.nicklist li.rank-hop .nick-rank { color: var(--rank-hop); }
.nicklist li.rank-voice .nick-rank { color: var(--rank-voice); }
.nicklist li.rank-user .nick-rank { color: #9aa7b5; }
.nick-badge, .nick-dot, .nick-prefix { display: none; }

.buffer-list {
  list-style: none; margin: 0; padding: 6px 8px 10px;
  overflow-y: auto; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.buffer-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 10px 10px 10px 12px; cursor: pointer; font-size: .9rem; font-weight: 800;
  color: var(--ink); border-radius: 12px; line-height: 1.25;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: inset 3px 0 0 #e74c3c;
  position: relative;
}
.buffer-list li::before {
  content: "#";
  color: var(--brand);
  margin-right: 4px;
  font-weight: 800;
}
.buffer-list li.is-status::before {
  content: "•";
  color: #94a3b8;
}
.buffer-list li.is-query::before {
  content: "@";
  color: #7c3aed;
}
.buffer-list li .buf-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.buffer-list li:hover { background: var(--hover); }
.buffer-list li.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  box-shadow: inset 3px 0 0 rgba(255,255,255,.85);
}
.buffer-list li.active::before { color: #fff; }
.buffer-list li.unread:not(.active) { box-shadow: inset 3px 0 0 var(--brand); }
.buffer-list .buf-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}
.buffer-list .pin-buf,
.buffer-list .close-buf {
  border: 0; background: transparent; color: inherit; opacity: .4;
  cursor: pointer; font-size: .88rem; font-weight: 700;
  width: 20px; height: 20px; border-radius: 5px;
  display: grid; place-items: center;
  padding: 0;
}
.buffer-list .pin-buf svg {
  display: block;
  width: 11px;
  height: 11px;
  opacity: .85;
}
.buffer-list li:hover .pin-buf,
.buffer-list li:hover .close-buf,
.buffer-list li.active .pin-buf,
.buffer-list li.active .close-buf { opacity: .95; }
.buffer-list .pin-buf:hover,
.buffer-list .close-buf:hover { background: rgba(0,0,0,.06); }
.buffer-list li.active .pin-buf:hover,
.buffer-list li.active .close-buf:hover { background: rgba(255,255,255,.15); }
.hide-buffers,
.show-buffers {
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 12px 12px; cursor: pointer; font: inherit;
  font-weight: 800; font-size: .78rem; text-align: right;
  width: 100%;
}
.show-buffers {
  display: none;
  text-align: left;
  padding: 6px 12px 8px;
  color: var(--brand-deep);
  border-bottom: 1px solid var(--line);
}
.app.buffers-hidden .show-buffers {
  display: block;
}

.modal-root {
  position: fixed; inset: 0; background: rgba(20, 32, 48, .42);
  display: grid; place-items: center; z-index: 400; padding: 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.modal-root[hidden] { display: none !important; }
.modal {
  width: min(420px, 100%); background: var(--panel); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22); overflow: hidden; color: var(--ink);
  margin: auto;
}
.modal-title {
  background: var(--brand-deep); color: #fff; padding: 14px 16px;
  font-weight: 800; font-family: var(--font-brand);
}
.modal-body { padding: 16px; }
.modal-body p { margin: 0 0 12px; color: var(--muted); font-size: .92rem; }
.modal-body label.chk {
  display: flex; align-items: center; gap: 8px; margin: 8px 0;
  font-size: .92rem; cursor: pointer; color: var(--ink);
}
.modal-body .field-plain { display: block; margin-bottom: 12px; }
.modal-body .field-plain span {
  display: block; font-size: .85rem; font-weight: 700; margin-bottom: 4px; color: var(--ink);
}
.modal-body .field-plain input {
  width: 100%; height: 44px; border: 1px solid var(--line);
  border-radius: 8px; padding: 0 12px; font: inherit; font-size: 16px;
  background: var(--input-bg); color: var(--ink);
  box-sizing: border-box;
}
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end; padding: 0 16px 16px;
  flex-wrap: wrap;
}
.modal-actions button {
  border: 0; border-radius: 8px; padding: 12px 18px;
  font: inherit; font-weight: 800; cursor: pointer; color: #fff;
  min-height: 44px;
}
.modal-ok { background: var(--brand); }
.modal-cancel { background: #5f6b7a; }
.identify-error {
  color: #c0392b !important;
  font-weight: 700;
  margin: 0 0 10px !important;
}
.about-qs { text-align: left; }
.about-qs-hero {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
}
.about-qs-mark {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1a6bc4 0%, #2a7fd6 55%, #4f9ae4 100%) !important;
  color: #fff !important;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    0 8px 18px rgba(31, 99, 173, .28);
}
.about-qs-mark svg {
  display: block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}
.about-qs-hero > div {
  min-width: 0;
}
.about-qs-hero strong {
  display: block;
  font-family: var(--font-brand);
  font-size: 1.15rem;
  color: var(--ink);
  line-height: 1.2;
}
.about-qs-hero .about-qs-sub {
  display: block;
  font-size: .82rem;
  color: var(--muted);
  margin-top: 3px;
}
.about-qs-list {
  margin: 0 0 14px;
  padding-left: 18px;
  color: var(--ink);
  font-size: .92rem;
}
.about-qs-list li { margin: 4px 0; }
.about-qs-meta {
  font-size: .86rem !important;
  color: var(--muted) !important;
}
.about-qs-foot {
  margin-top: 8px !important;
  font-weight: 800;
  color: var(--brand-deep) !important;
}

.avatar-editor {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2rem;
  font-weight: 800;
  overflow: hidden;
  box-shadow:
    0 0 0 3px #fff,
    0 0 0 6px #22c55e,
    0 10px 24px rgba(15, 40, 80, .18);
}
.avatar-nick {
  margin: 0;
  font-weight: 800;
  font-size: 1.05rem;
}
.avatar-hint {
  margin: 0;
  color: #667;
  font-size: .85rem;
  max-width: 320px;
}
.avatar-editor .field-plain {
  width: 100%;
  text-align: left;
}
.btn-avatar-remove {
  border: 0;
  background: #eceff3;
  color: #334;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-avatar-remove:hover { background: #e0e5eb; }
.avatar-status {
  margin: 0;
  font-size: .86rem;
  color: #1b6b3a;
  font-weight: 700;
}
.avatar-status.is-error { color: #b00020; }

.app.buffers-hidden .buffers-pane { display: none; }
.app.buffers-hidden .right-rail {
  grid-template-columns: 210px;
  width: 210px;
  max-width: 210px;
}
.app.buffers-hidden .nicklist-pane {
  border-left: 0;
}

/* Özel mesaj / Status: nick kayarak kapanır, oda listesi kalır */
.app.pm-mode .nicklist-pane,
.app.status-mode .nicklist-pane {
  opacity: 0;
  border-right-color: transparent;
  pointer-events: none;
}
.app.pm-mode .right-rail,
.app.status-mode .right-rail {
  grid-template-columns: 0px 190px;
  width: 190px;
  max-width: 190px;
}
.app.pm-mode .buffers-pane,
.app.status-mode .buffers-pane {
  background: var(--panel);
}

/* —— Stories — kibar, mavi halkalı Sen —— */
.story-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  overflow: visible;
  flex: 0 0 auto;
  min-height: 0;
  position: relative;
  z-index: 8;
}
.story-add-wrap {
  position: relative;
  flex: 0 0 auto;
  z-index: 6;
}
.story-add-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  max-width: min(280px, 80vw);
  background: #fff;
  border: 1px solid #d7e0ea;
  border-radius: 12px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .16);
  padding: 8px;
  display: grid;
  gap: 4px;
  z-index: 80;
}
.story-add-menu[hidden] { display: none !important; }
.story-add-menu hr {
  border: 0;
  border-top: 1px solid #e8eef4;
  margin: 4px 2px;
}
.sam-opt {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  font: inherit;
  font-weight: 700;
  font-size: .84rem;
  cursor: pointer;
  color: #1e293b;
}
.sam-opt:hover { background: #f1f5f9; }
.sam-opt:disabled {
  opacity: .45;
  cursor: not-allowed;
}
.sam-opt.sam-link {
  color: var(--brand);
  font-weight: 700;
  font-size: .8rem;
}
.sam-hint {
  margin: 0;
  padding: 6px 10px 8px;
  font-size: .75rem;
  line-height: 1.4;
  font-weight: 600;
  color: #64748b;
}
.sam-hint strong { color: #334155; }
.story-add-wrap.is-identified .sam-hint { display: none; }
.story-add-wrap:not(.is-identified) #sam-story,
.story-add-wrap:not(.is-identified) #sam-avatar {
  display: none;
}
.story-add-wrap.is-identified #sam-identify {
  display: none;
}
.story-add {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  color: var(--ink);
  font: inherit;
  width: 44px;
  border-radius: 0;
}
.story-add:hover {
  background: transparent;
  opacity: .88;
}
.story-add-plus {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0;
  font-weight: 800;
  line-height: 1;
  color: transparent;
  background: linear-gradient(180deg, #f1f4f8 0%, #e4eaf1 100%);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #3b82f6;
  position: relative;
}
.story-add-plus::before {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c5d0dc;
  box-shadow: 0 7px 0 -2px #c5d0dc;
  opacity: .85;
}
.story-add-plus::after {
  content: "+";
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  font-size: .72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 1.5px solid #fff;
  line-height: 1;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .12);
}
.story-add-label {
  font-size: .7rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  letter-spacing: .01em;
}
.story-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1 1 auto;
  padding: 0;
  min-width: 0;
  align-items: center;
  scrollbar-width: thin;
}
.story-rail:empty {
  display: none;
}
.story-rail:empty::after {
  content: none;
}
.story-item {
  flex: 0 0 auto;
  width: 44px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 0;
  font: inherit;
  color: var(--ink);
}
.story-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  padding: 2px;
  background: linear-gradient(135deg, #a855f7, #ec4899 45%, #f59e0b);
}
.story-item.is-seen .story-ring {
  background: #d5dde6;
}
.story-ring img, .story-ring span {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: #e8eef4;
  color: #64748b;
  font-weight: 700;
  font-size: .72rem;
  border: 1.5px solid #fff;
}
.story-item-nick {
  font-size: .62rem;
  font-weight: 600;
  color: #94a3b8;
  max-width: 44px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.story-viewer {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: #0b1220;
  color: #fff;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.sv-progress {
  display: flex;
  gap: 4px;
  padding: 10px 12px 0;
}
.sv-progress i {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: rgba(255,255,255,.25);
  overflow: hidden;
}
.sv-progress i em {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
}
.sv-progress i.is-done em { width: 100%; }
.sv-progress i.is-active em { animation: svFill linear forwards; }
@keyframes svFill { from { width: 0; } to { width: 100%; } }
.sv-close {
  position: absolute;
  top: calc(18px + env(safe-area-inset-top));
  right: 14px;
  z-index: 30;
  border: 0;
  background: rgba(0,0,0,.35);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
}
.sv-head {
  position: relative;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 52px 8px 14px;
  pointer-events: auto;
}
.sv-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #334;
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
}
.sv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.sv-meta { display: flex; flex-direction: column; min-width: 0; }
.sv-meta strong { font-size: .95rem; }
.sv-meta span { font-size: .72rem; opacity: .75; }
.sv-del {
  margin-left: auto;
  position: relative;
  z-index: 30;
  border: 0;
  background: rgba(255,80,80,.35);
  color: #fff;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 800;
  cursor: pointer;
  pointer-events: auto;
}
.sv-del:disabled {
  opacity: .5;
  cursor: wait;
}
.sv-image {
  width: min(100%, 520px);
  max-height: 70dvh;
  object-fit: contain;
  justify-self: center;
  align-self: center;
  border-radius: 12px;
}
.sv-caption {
  text-align: center;
  padding: 12px 18px 28px;
  margin: 0;
  font-weight: 700;
  font-size: .95rem;
}
.sv-hit {
  position: absolute;
  top: 110px;
  bottom: 80px;
  width: 40%;
  border: 0;
  background: transparent;
  cursor: pointer;
  z-index: 5;
}
.sv-hit-left { left: 0; }
.sv-hit-right { right: 0; }

.story-compose-preview {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 12px;
  background: #0f1724;
  margin-bottom: 10px;
}

/* —— Mobile shell —— */
.tb-menu {
  display: none;
  border: 0;
  background: transparent;
  color: var(--brand-deep);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  place-items: center;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; }
.mobile-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
}
.mn-btn {
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 6px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: #6b7a8c;
  font: inherit;
}
.mn-btn span { font-size: 1.05rem; line-height: 1; }
.mn-btn small { font-size: .68rem; font-weight: 800; }
.mn-btn.is-active { color: var(--brand-deep); background: var(--brand-soft); }
.mobile-scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(10, 18, 30, .45);
}

.call-toast {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 130;
  display: flex;
  align-items: stretch;
  max-width: min(440px, calc(100vw - 24px));
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
  overflow: hidden;
}
.call-toast[hidden] { display: none !important; }
.call-toast-main {
  flex: 1 1 auto;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: #9a3412;
  font-weight: 700;
  font-size: .86rem;
  line-height: 1.3;
}
.call-toast-text { display: block; }
.call-toast-close {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: #c2410c;
  font-size: 1.2rem;
  padding: 0 12px;
  cursor: pointer;
}
.call-toast.is-flash {
  animation: call-toast-flash .9s ease-in-out 2;
}
@keyframes call-toast-flash {
  0%, 100% { background: #fff7ed; }
  50% { background: #ffedd5; }
}

@media (min-width: 861px) {
  .mobile-scrim { display: none !important; }
}

@media (max-width: 1100px) {
  #radio-vol { width: 56px; }
  .topbar,
  .app-body {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
  .app.buffers-hidden .topbar,
  .app.buffers-hidden .app-body {
    grid-template-columns: minmax(0, 1fr) 170px;
  }
  .topbar-side {
    grid-template-columns: 170px 150px;
  }
  .right-rail {
    width: 320px;
    max-width: 320px;
    grid-template-columns: 170px 150px;
  }
  .nicklist-pane {
    width: 170px; min-width: 170px; max-width: 170px;
  }
  .buffers-pane {
    width: 150px; min-width: 150px; max-width: 150px;
  }
  .tb-chip#btn-nick-save, .tb-chip#btn-nick-change { display: none; }
}
@media (max-width: 820px) {
  .hello, .status-pill { display: none; }
  .tb-btn { display: none; }
  .tb-btn#btn-join, .tb-btn#btn-avatar { display: inline-flex; }
}
@media (max-width: 860px) {
  .mobile-nav { display: grid; }
  .mobile-nav[hidden] { display: none !important; }
  .tb-menu { display: none !important; }
  .app {
    grid-template-columns: minmax(0, 1fr) !important;
    padding-bottom: calc(62px + env(safe-area-inset-bottom));
  }
  .app.rail-open {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .left-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 86vw);
    z-index: 90;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 12px 0 40px rgba(0,0,0,.25);
  }
  .app.rail-open .left-rail,
  .app.mobile-menu-open .left-rail {
    transform: translateX(0);
  }
  .app.rail-open .rail-brand,
  .app.rail-open .rail-sec-title,
  .app.rail-open .rail-label,
  .app.rail-open .rail-badge { display: flex; }
  .app.rail-open .rail-label { display: inline; }
  .app.rail-open .rail-badge { display: inline-flex; }

  /* AskCafem mobil header */
  .topbar {
    display: flex !important;
    flex-direction: column;
    grid-template-columns: none !important;
    min-height: 0;
    height: auto;
    overflow: visible;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .mh-dark { display: flex; }
  .topbar-side { display: none; }
  .topbar-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    height: auto;
    min-height: 48px;
    overflow: visible;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .topbar-channel { display: none; }
  .topbar-brand { flex: 0 1 auto; min-width: 0; }
  .brand-name { font-size: .95rem; }
  .conn-status { font-size: .72rem; }
  .topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 4px;
    flex: 0 1 auto;
    min-width: 0;
  }
  .tb-chip#btn-avatar,
  .tb-chip#btn-join,
  .tb-chip#btn-nick-change,
  .tb-chip#btn-oper { display: none !important; }
  .tb-chip#btn-theme {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    width: 32px;
    height: 30px;
    padding: 0;
  }
  .tb-chip#btn-theme .tb-theme-text { display: none; }
  .tb-chip#btn-nick-save {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    width: 32px;
    height: 30px;
    padding: 0;
  }
  .tb-chip#btn-nick-save .tb-chip-text { display: none; }
  .tb-chip#btn-nick-save .tb-chip-ico { display: inline-flex; }
  .tb-chip#btn-more {
    display: inline-flex !important;
    min-width: 32px;
    width: 32px;
    height: 30px;
    padding: 0;
    font-size: 1rem;
  }
  .tb-chip#btn-status {
    display: inline-flex !important;
    height: 30px;
    padding: 0 8px;
    font-size: .72rem;
    gap: 4px;
  }
  .tb-chip#btn-status .tb-caret { display: none; }
  .tb-chip#btn-friends {
    display: inline-flex !important;
    height: 30px;
    padding: 0 8px;
    font-size: .7rem;
    white-space: nowrap;
  }
  .tb-status-wrap { position: relative; }

  .app-center {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .story-bar {
    order: 1;
    padding: 6px 8px 4px;
    gap: 8px;
    border-bottom: 0;
    background: #f7f9fc;
  }
  .channel-tabs {
    order: 2;
    display: flex;
    gap: 0;
    padding: 0 4px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
  }
  .channel-tab {
    height: 34px;
    padding: 0 8px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: #c0392b;
    font-size: .78rem;
    font-weight: 700;
    max-width: none;
    border-bottom: 2px solid transparent;
  }
  .channel-tab .ct-label { max-width: 120px; }
  .channel-tab .ct-pin {
    display: inline-flex;
    opacity: .55;
    margin-right: 2px;
  }
  .channel-tab .ct-close {
    font-size: .9rem;
    color: #99a;
    padding-left: 4px;
  }
  .channel-tab.is-active {
    background: transparent;
    color: #1a2330;
    font-weight: 800;
    border-bottom-color: #22c55e;
  }
  .channel-tab.is-active .ct-close { color: #667; }
  .channel-tab.is-unread:not(.is-active)::after {
    background: #e74c3c;
  }
  .chat-pane { order: 3; }
  .announce { order: 0; font-size: .78rem; padding: 6px 10px; }

  /* AskCafem tarzı: sohbet + nick listesi yan yana */
  .app-body {
    grid-template-columns: minmax(0, 1fr) 118px !important;
  }
  .app.buffers-hidden .app-body {
    grid-template-columns: minmax(0, 1fr) 118px !important;
  }
  /* PM / Status: nick sütunu yok */
  .app.pm-mode .app-body,
  .app.status-mode .app-body {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  .app-center { border-right: 1px solid var(--line); min-width: 0; }

  .right-rail {
    position: relative !important;
    width: 118px !important;
    max-width: 118px !important;
    min-width: 118px !important;
    z-index: 1;
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    transform: none !important;
    box-shadow: none;
    background: var(--panel);
    align-self: stretch;
    height: auto;
    min-height: 0;
    border-left: 1px solid var(--line);
    border-right: 0;
  }
  .app.pm-mode .right-rail,
  .app.status-mode .right-rail {
    display: none !important;
  }
  .buffers-pane { display: none !important; }
  .nicklist-pane {
    display: flex !important;
    flex-direction: column;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border-right: 0;
    flex: 1 1 auto;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  .show-buffers { display: none !important; }

  .nicklist-mobile-head {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 4px 6px;
    border-bottom: 1px solid var(--line);
    flex: 0 0 auto;
    cursor: pointer;
    user-select: none;
  }
  .nicklist-mobile-head strong {
    font-size: .62rem;
    font-weight: 800;
    letter-spacing: .02em;
    color: var(--muted);
    text-transform: uppercase;
  }
  .nicklist-mobile-head .pane-meta {
    display: inline !important;
    font-size: .78rem;
    font-weight: 800;
    color: var(--ink);
  }

  .nick-search { display: none; }
  .nicklist { padding: 2px 3px 10px; }
  .nicklist li {
    display: grid !important;
    grid-template-columns: 22px minmax(0, 1fr) !important;
    justify-items: stretch;
    align-items: center;
    text-align: left;
    padding: 4px 3px;
    gap: 5px;
    border-bottom: 1px solid #f0f3f7;
  }
  .nick-av-wrap {
    margin: 0;
    width: 20px !important;
    height: 20px !important;
  }
  .nick-av-wrap .nick-avatar,
  .nicklist .nick-avatar {
    width: 18px !important;
    height: 18px !important;
    font-size: .55rem !important;
    border-width: 1px;
    box-shadow: 0 0 0 1.5px #22c55e;
  }
  .nicklist li.has-story .nick-avatar,
  .nicklist .nick-avatar.has-story {
    box-shadow: 0 0 0 1.5px #f59e0b, 0 0 0 2.5px #ec4899;
  }
  .nick-presence {
    width: 7px;
    height: 7px;
    right: -2px;
    bottom: -2px;
    border-width: 1px;
  }
  .nick-meta {
    width: auto;
    min-width: 0;
    overflow: hidden;
  }
  .nick-name-row { justify-content: flex-start; min-width: 0; }
  .nick-name {
    font-size: .66rem;
    font-weight: 700;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nick-rank { display: none; }
  .nick-story-mark {
    font-size: .55rem;
    min-width: .85rem;
    height: .85rem;
  }

  /* Nickler: sağdan geniş panel (sohbet kalır, scrim ile) */
  .app.mobile-nicks-open .right-rail {
    position: fixed !important;
    top: 0;
    right: 0;
    left: auto;
    bottom: calc(62px + env(safe-area-inset-bottom));
    width: min(300px, 88vw) !important;
    max-width: none !important;
    min-width: 0 !important;
    z-index: 90;
    box-shadow: -12px 0 40px rgba(0,0,0,.22);
  }
  .app.mobile-nicks-open .nicklist-mobile-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px 8px;
  }
  .app.mobile-nicks-open .nicklist-mobile-head strong {
    font-size: .9rem;
    text-transform: none;
    color: #1f2a38;
  }
  .app.mobile-nicks-open .nick-search {
    display: block;
    padding: 6px 10px 8px;
  }
  .app.mobile-nicks-open .nicklist li {
    grid-template-columns: 36px minmax(0, 1fr) !important;
    padding: 8px 10px;
    gap: 9px;
  }
  .app.mobile-nicks-open .nick-av-wrap {
    width: 34px !important;
    height: 34px !important;
  }
  .app.mobile-nicks-open .nick-av-wrap .nick-avatar,
  .app.mobile-nicks-open .nicklist .nick-avatar {
    width: 32px !important;
    height: 32px !important;
    font-size: .72rem !important;
    border-width: 2px;
    box-shadow: 0 0 0 2px #22c55e;
  }
  .app.mobile-nicks-open .nick-presence {
    width: 11px;
    height: 11px;
    right: -1px;
    bottom: -1px;
    border-width: 2px;
  }
  .app.mobile-nicks-open .nick-name-row { justify-content: flex-start; }
  .app.mobile-nicks-open .nick-name { max-width: none; font-size: .86rem; }
  .app.mobile-nicks-open .nick-rank { display: inline; }

  .mobile-nav { grid-template-columns: repeat(4, 1fr); }
  .composer-tools { gap: 4px; }
  .tool-select { max-width: 96px; }
  .radio-widget { display: none; }
  .watermark { opacity: .04; }
  .login-card { padding: 28px 20px 22px; }
  #msg-input { height: 42px; font-size: 16px; }
  .client-badge-text strong { font-size: .72rem; }
  .client-badge-text em { font-size: .62rem; }

  /* Şifre / modal — mobil: üstte, klavye altında kalmasın; alt menünün üstünde */
  .modal-root {
    place-items: start center;
    padding: max(12px, env(safe-area-inset-top)) 12px calc(72px + env(safe-area-inset-bottom));
  }
  .modal {
    width: 100%;
    max-width: 420px;
    margin-top: 8vh;
  }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions button {
    width: 100%;
  }
}
@media (max-width: 480px) {
  .brand-name { font-size: .92rem; }
  .channel-title { font-size: 1rem; }
  .tb-btn { padding: 0 8px; height: 30px; font-size: .72rem; }
  .app-body,
  .app.buffers-hidden .app-body {
    grid-template-columns: minmax(0, 1fr) 104px !important;
  }
  .right-rail {
    width: 104px !important;
    max-width: 104px !important;
    min-width: 104px !important;
  }
  .nicklist li {
    grid-template-columns: 20px minmax(0, 1fr) !important;
    gap: 4px;
    padding: 3px 2px;
  }
  .nick-av-wrap {
    width: 18px !important;
    height: 18px !important;
  }
  .nick-av-wrap .nick-avatar,
  .nicklist .nick-avatar {
    width: 16px !important;
    height: 16px !important;
    font-size: .5rem !important;
  }
  .nick-name { font-size: .62rem; }
}

/* —— Karanlık mod ek yüzeyler —— */
html.theme-dark .login-screen {
  background:
    radial-gradient(900px 500px at 20% 0%, #1a2d42 0%, transparent 55%),
    linear-gradient(160deg, #0f141c, #0c1016);
}
html.theme-dark .topbar-channel { border-left-color: var(--line); }
html.theme-dark .channel-title { color: var(--ink); }
html.theme-dark .status-menu,
html.theme-dark .tb-more-menu,
html.theme-dark .mh-pm-menu,
html.theme-dark .story-add-menu {
  background: var(--panel) !important;
  border-color: var(--line) !important;
  color: var(--ink);
}
html.theme-dark .story-add-menu hr {
  border-top-color: var(--line);
}
html.theme-dark .sam-opt {
  color: var(--ink) !important;
}
html.theme-dark .sam-opt:hover {
  background: var(--hover) !important;
  color: var(--brand-deep) !important;
}
html.theme-dark .sam-opt.sam-link {
  color: var(--brand) !important;
}
html.theme-dark .sam-hint {
  color: var(--muted) !important;
}
html.theme-dark .sam-hint strong {
  color: var(--ink) !important;
}
html.theme-dark .status-opt,
html.theme-dark .tb-more-menu button,
html.theme-dark .mh-pm-item {
  color: var(--ink) !important;
}
html.theme-dark .status-opt:hover,
html.theme-dark .tb-more-menu button:hover,
html.theme-dark .mh-pm-item.is-active,
html.theme-dark .status-opt.is-active {
  background: var(--hover) !important;
  color: var(--brand-deep) !important;
}
html.theme-dark .radio-widget {
  background: var(--brand-soft);
  border-color: var(--line);
  color: var(--ink);
}
html.theme-dark .messages { background: var(--chat-bg); color: var(--ink); }
html.theme-dark .msg-line.msg-chat:hover { background: var(--msg-hover); }
html.theme-dark .msg-sys { color: var(--muted); }
html.theme-dark .msg-body { color: var(--ink) !important; }
html.theme-dark .msg-status { color: var(--muted); }
html.theme-dark .msg-topic-meta { color: var(--muted); }
html.theme-dark .msg-pm-ping { background: #3a2f12; color: #f5e6a8; }
html.theme-dark .channel-tabs { background: var(--panel-2); }
html.theme-dark .channel-tab { background: var(--panel); color: var(--ink); }
html.theme-dark .pane-head { color: var(--ink); border-color: var(--line); }
html.theme-dark .right-rail { background: var(--panel); border-color: var(--line); }
html.theme-dark .topbar-side { border-left-color: var(--line); }
html.theme-dark .nick-avatar { border-color: var(--panel); }
html.theme-dark .msg-av-ring .nick-avatar { border-color: var(--panel) !important; }
html.theme-dark .story-bar { background: var(--panel); border-color: var(--line); }
html.theme-dark .story-add-menu { background: var(--panel); }
html.theme-dark .buffers-pane { background: var(--panel-2); }
html.theme-dark .app.pm-mode .buffers-pane { background: var(--panel); }
html.theme-dark .watermark { color: rgba(255,255,255,.06); }
html.theme-dark .topbar-main,
html.theme-dark .app .topbar {
  background: linear-gradient(180deg, var(--topbar-a) 0%, var(--topbar-b) 100%);
  border-bottom-color: var(--topbar-line);
}
html.theme-dark .tb-oper {
  background: linear-gradient(180deg, #3a1c1c, #2a1414);
  border-color: #e57373;
  color: #ffcdd2;
}
html.theme-dark .tb-oper:hover {
  background: #452020;
}
html.theme-dark .oper-tab.is-active {
  color: #ff8a80;
  background: rgba(229, 115, 115, .15);
  border-color: rgba(229, 115, 115, .35);
}
html.theme-dark .oper-act:hover {
  border-color: #e57373;
  color: #ffcdd2;
  background: rgba(229, 115, 115, .12);
}
html.theme-dark .oper-sub {
  background: var(--panel-2);
}
html.theme-dark .nick-ctx {
  background: var(--panel);
  border-color: var(--line);
}
html.theme-dark .nick-ctx button { color: var(--ink); }
html.theme-dark .nick-ctx button:hover {
  background: var(--hover);
  color: var(--brand);
}
html.theme-dark .rail-oper,
html.theme-dark .rail-oper .rail-ico {
  color: #ef9a9a;
}
