/* Brusk34 paneli — iOS uygulamasıyla aynı tasarım dili (ios/Brusk34/Theme/DesignSystem.swift):
   koyu, yumuşak, az ve pastel renk. Marka sarısı yalnızca ana eylemlerde. */

:root {
  --bg: #0B0F14;
  --card: #161B22;
  --card2: #1F252D;
  --hover: #1B2129;
  --sep: rgba(255, 255, 255, .08);

  --text: #F2F4F7;
  --secondary: #98A2AE;
  --tertiary: #5F6B78;

  --accent: #F2C94C;
  --on-accent: #1C1600;

  --green: #3DD68C;
  --red: #FF6B6B;
  --blue: #5EA2FF;
  --orange: #FFA94D;
  --pink: #F783AC;
  --purple: #A78BFA;
  --teal: #38D9C6;
  /* sticker() adları → yumuşak palet */
  --yellow: var(--accent);
  --muted: var(--tertiary);

  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { flex-shrink: 0; display: block; }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* ── Renk yardımcıları (tinted: açık zemin + renkli yazı) ── */
.fill-yellow { --tint: var(--accent); }
.fill-green { --tint: var(--green); }
.fill-red { --tint: var(--red); }
.fill-blue { --tint: var(--blue); }
.fill-pink { --tint: var(--pink); }
.fill-orange { --tint: var(--orange); }
.fill-muted { --tint: var(--tertiary); }

/* ── Yüzey ─────────────────────────────────────────────── */

.card { background: var(--card); border-radius: var(--radius); }
.card.pad { padding: 18px; }
.card.inset { background: var(--card2); }
/* Renkli kart: çok hafif renk tonu, yazı normal */
.card[class*="fill-"] { background: color-mix(in srgb, var(--tint) 9%, var(--card)); }

.divider { height: 1px; background: var(--sep); border: 0; margin: 0; }

/* ── Yerleşim ──────────────────────────────────────────── */

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  background: #0E1319;
  border-right: 1px solid var(--sep);
  padding: 22px 14px;
  display: flex; flex-direction: column; gap: 22px;
}
.brand { display: flex; align-items: baseline; gap: 6px; padding: 0 8px; }
.brand b { font-weight: 800; font-size: 24px; letter-spacing: -0.4px; }
.brand span { font-weight: 300; font-size: 24px; color: var(--accent); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 10px;
  font-weight: 500; color: var(--secondary);
  transition: background .15s, color .15s;
}
.nav a:hover { color: var(--text); background: var(--hover); }
.nav a.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 600; }
.side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; }
.side .me .who { min-width: 0; flex: 1; }
.side .me .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { min-width: 0; padding: 30px 36px 60px; max-width: 1180px; width: 100%; }
.topbar { display: none; }

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .titles { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.page-head h1 { font-weight: 700; font-size: 32px; letter-spacing: -0.5px; line-height: 1.1; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; font-size: 15px; margin-bottom: 10px; }
.crumb:hover { opacity: .8; }

.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.grid.side-right { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

.section-title {
  display: flex; align-items: center; gap: 8px;
  margin: 26px 16px 8px;
  font-weight: 400; font-size: 13px; letter-spacing: .3px; text-transform: uppercase; color: var(--secondary);
}
.section-title.first { margin-top: 0; }

/* ── Yazı ──────────────────────────────────────────────── */

.label { font-weight: 500; font-size: 13px; color: var(--secondary); padding-left: 4px; }
.ink-label { font-weight: 500; font-size: 14px; color: var(--secondary); }
.muted { color: var(--secondary); }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.h2 { font-weight: 700; font-size: 24px; letter-spacing: -.3px; }
.h3 { font-weight: 600; font-size: 18px; }
.big-money { font-family: var(--rounded); font-weight: 600; font-size: 34px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.money { font-family: var(--rounded); font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.zero { color: var(--secondary); }
.code { font-size: 12px; font-weight: 600; color: var(--tertiary); letter-spacing: .3px; }

/* ── Çember / etiket ──────────────────────────────────── */

:where(.badge) { --tint: var(--blue); }
.badge {
  width: 40px; height: 40px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: color-mix(in srgb, var(--tint) 16%, transparent);
  color: var(--tint); font-family: var(--rounded); font-weight: 600; font-size: 15px;
}
.badge.sm { width: 32px; height: 32px; font-size: 12px; }
.badge.lg { width: 56px; height: 56px; font-size: 20px; }
.badge.dark { --tint: var(--accent); }

:where(.tag) { --tint: var(--accent); }
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  background: color-mix(in srgb, var(--tint) 15%, transparent);
  color: var(--tint); font-weight: 600; font-size: 12px; white-space: nowrap;
}

/* ── Buton ─────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 42px; padding: 0 16px;
  background: var(--accent); color: var(--on-accent);
  border: 0; border-radius: 12px;
  font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap;
  transition: transform .1s, opacity .15s, filter .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); opacity: .85; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { height: 50px; padding: 0 20px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn.square { width: 42px; padding: 0; }
.btn.sm.square { width: 34px; }
.btn.secondary { background: var(--card2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--secondary); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
/* Tinted butonlar (Giriş/Çıkış/Sil gibi) */
.btn.green { --tint: var(--green); }
.btn.red { --tint: var(--red); }
.btn.blue { --tint: var(--blue); }
.btn.pink { --tint: var(--pink); }
.btn.green, .btn.red, .btn.blue, .btn.pink { background: color-mix(in srgb, var(--tint) 16%, transparent); color: var(--tint); }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; font-weight: 500; color: var(--accent); }

/* ── Form ──────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; padding: 0 14px;
  background: var(--card2); color: var(--text);
  border: 1.5px solid transparent; border-radius: 12px;
  font-size: 15px; outline: none; transition: border-color .15s;
}
.textarea { padding: 12px 14px; min-height: 84px; resize: vertical; line-height: 1.4; }
.input::placeholder, .textarea::placeholder { color: var(--tertiary); }
.input:focus, .select:focus, .textarea:focus { border-color: color-mix(in srgb, var(--accent) 70%, transparent); }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--secondary) 50%), linear-gradient(135deg, var(--secondary) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.input-icon { position: relative; display: block; }
.input-icon .ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--secondary); pointer-events: none; }
.input-icon .input { padding-left: 40px; }
.input-icon:focus-within .ic { color: var(--accent); }
input[type="date"].input, input[type="datetime-local"].input { padding-right: 10px; }
input[type="file"].input { padding: 11px 12px; min-height: 0; }

:where(.amount) { --tint: var(--green); }
.amount {
  display: flex; align-items: baseline; gap: 10px;
  padding: 12px 16px; border-radius: 14px;
  background: var(--card2); border: 1.5px solid transparent; transition: border-color .15s;
}
.amount:focus-within { border-color: color-mix(in srgb, var(--tint) 60%, transparent); }
.amount.cikis { --tint: var(--red); }
.amount input {
  flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent;
  font-family: var(--rounded); font-size: 32px; font-weight: 600; color: var(--tint); font-variant-numeric: tabular-nums;
}
.amount input::placeholder { color: var(--tertiary); }

/* Giriş / Çıkış seçimi */
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice label {
  display: flex; align-items: center; justify-content: center; gap: 6px; height: 46px;
  background: var(--card2); color: var(--secondary);
  border: 1.5px solid transparent; border-radius: 12px;
  font-weight: 600; cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.choice input:checked + label.c-giris { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); border-color: color-mix(in srgb, var(--green) 55%, transparent); }
.choice input:checked + label.c-cikis { background: color-mix(in srgb, var(--red) 16%, transparent); color: var(--red); border-color: color-mix(in srgb, var(--red) 55%, transparent); }
.choice input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Çipler */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; height: 32px; padding: 0 14px;
  background: var(--card2); color: var(--text);
  border: 1.2px solid transparent; border-radius: 999px;
  font-weight: 500; font-size: 14px; cursor: pointer; transition: background .15s;
}
.chip:hover { background: var(--hover); }
.chip.on, label.chip:has(input:checked) { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
label.chip input { position: absolute; opacity: 0; pointer-events: none; }

/* Bölümlü seçici (iOS segmented control) */
.seg { display: inline-flex; gap: 2px; padding: 2px; background: var(--card2); border-radius: 9px; }
.seg a { padding: 6px 18px; border-radius: 7px; font-weight: 500; font-size: 13px; color: var(--secondary); }
.seg a.on { background: #3A414B; color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* Anahtar (iOS toggle) */
.switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #39393D; border-radius: 999px; transition: background .2s; }
.switch span::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,.3); transition: transform .2s;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .45; }

/* Onay kutusu (yuvarlak, iOS seçim işareti gibi) */
.box { position: relative; width: 24px; height: 24px; flex-shrink: 0; }
.box input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.box span { position: absolute; inset: 0; border: 1.5px solid var(--tertiary); border-radius: 50%; display: grid; place-items: center; transition: background .15s, border-color .15s; }
.box input:checked + span { background: var(--green); border-color: var(--green); }
.box input:checked + span::after { content: ""; width: 6px; height: 11px; border: solid #0B0F14; border-width: 0 2.5px 2.5px 0; transform: translate(0, -1px) rotate(45deg); }
.box input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Liste satırları ──────────────────────────────────── */

.list { display: flex; flex-direction: column; gap: 10px; }
.item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--card); border-radius: 14px;
  transition: background .15s, transform .1s;
}
a.item:hover { background: var(--hover); }
a.item:active { transform: scale(.99); }
.item .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item .title { font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .end { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.item .chev, .r .chev { display: flex; color: var(--tertiary); }

.rows > * + * { border-top: 1px solid var(--sep); }
.r { display: flex; align-items: center; gap: 12px; padding: 11px 16px; }
.r .body { flex: 1; min-width: 0; }
.r .title { font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .meta { font-size: 13px; color: var(--secondary); display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
button.r { width: 100%; background: none; border: 0; text-align: left; cursor: pointer; }
button.r:hover, a.r:hover { background: rgba(255,255,255,.04); }
.group-head { padding: 12px 16px 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--secondary); }
.card.rows { overflow: hidden; }

.empty { text-align: center; padding: 48px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--secondary); }
.empty h3 { font-weight: 600; font-size: 17px; color: var(--text); }

/* Tablo (erişim, bakım) */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 400; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--secondary); padding: 10px 16px; }
.table td { padding: 10px 16px; border-top: 1px solid var(--sep); }
.table .c { text-align: center; width: 76px; }
.table .c .box { margin: 0 auto; }

/* ── Bildirim ─────────────────────────────────────────── */

.flash { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
:where(.flash div) { --tint: var(--blue); }
.flash div {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--tint) 14%, var(--card)); color: var(--text); font-weight: 500;
}
.flash div > .ic { color: var(--tint); }
.flash .success { --tint: var(--green); }
.flash .error { --tint: var(--red); }
.flash button { margin-left: auto; background: none; border: 0; cursor: pointer; color: var(--secondary); }
.flash.floating { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 5; width: min(420px, calc(100% - 32px)); }

/* ── Pencere ─────────────────────────────────────────── */

dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 40px);
  padding: 0; color: var(--text); background: var(--bg);
  border: 1px solid var(--sep); border-radius: 22px; box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
dialog .d-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 4px; }
dialog .d-head h2 { flex: 1; font-weight: 700; font-size: 22px; letter-spacing: -.3px; }
dialog .d-body { padding: 12px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
dialog .d-foot { padding: 12px 20px 20px; display: flex; gap: 10px; }
dialog .d-foot .btn { flex: 1; }

/* ── Sayfalama ────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; }

/* ── Giriş sayfası ───────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login .box-wrap { width: min(400px, 100%); display: flex; flex-direction: column; gap: 24px; align-items: stretch; }
.login .logo { text-align: center; line-height: 1; }
.login .logo b { display: block; font-weight: 800; font-size: 52px; letter-spacing: -1.2px; }
.login .logo span { display: block; font-weight: 200; font-size: 58px; color: var(--accent); margin-top: -4px; }

/* ── Yardımcılar ─────────────────────────────────────── */
.pad-sm { padding: 12px 14px; }
.mt { margin-top: 10px; }
.mt-lg { margin-top: 20px; }
.mb { margin-bottom: 14px; }
.money.lg { font-size: 20px; font-weight: 600; }
.money.small { font-size: 13px; }
.big-money.xl { font-size: 42px; margin: 4px 0; }
.balances { margin-top: 10px; gap: 10px; }
.totals { margin-top: 8px; }
.total { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.toolbar { margin-bottom: 14px; gap: 10px; }
.filter { width: min(340px, 100%); }
.select.narrow { width: auto; min-width: 200px; }
.align-start { align-items: start; }
.sticky { position: sticky; top: 20px; }
.sticky-save { position: sticky; bottom: 16px; }
.dim { opacity: .5; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--tint); }
.tags { gap: 6px; margin-top: 2px; }
.grid > *, .stack > * { min-width: 0; }
.big-money { overflow-wrap: anywhere; }

/* Rol seçimi */
.role { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; cursor: pointer; background: var(--card2); border-radius: 12px; border: 1.5px solid transparent; }
.role input { margin-top: 3px; accent-color: var(--accent); width: 17px; height: 17px; }
.role span { display: flex; flex-direction: column; gap: 2px; }
.role small { color: var(--secondary); }
.role:has(input:checked) { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 10%, var(--card2)); }
.role-card { width: 100%; height: 100%; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  background: var(--card); color: var(--text); border: 1.5px solid transparent; border-radius: 14px; transition: background .15s; }
.role-card:hover { background: var(--hover); }
.role-card b { font-weight: 600; font-size: 15px; }
.role-card small { color: var(--secondary); font-size: 13px; }
.role-card.on { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 9%, var(--card)); }
.role-card.on .ic { color: var(--accent); }

/* Şifre kuralları */
.rules { display: flex; gap: 14px; flex-wrap: wrap; }
.rules span { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--secondary); }
.rules span .ic { padding: 2px; border: 1.5px solid var(--tertiary); border-radius: 50%; color: transparent; width: 18px; height: 18px; }
.rules span.ok { color: var(--green); }
.rules span.ok .ic { background: var(--green); border-color: var(--green); color: #0B0F14; }

.dekont-img { max-width: 100%; max-height: 260px; border-radius: 12px; background: var(--card2); }
.btn[data-busy].busy { opacity: .6; pointer-events: none; }

/* ── Mobil ───────────────────────────────────────────── */

@media (max-width: 960px) {
  .grid.side-right { grid-template-columns: 1fr; }
  .grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side {
    position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 30;
    transform: translateX(-105%); transition: transform .22s; box-shadow: 12px 0 40px rgba(0,0,0,.5);
  }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 20; }
  .topbar {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px;
    position: sticky; top: 0; z-index: 10; background: rgba(11,15,20,.85); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--sep);
  }
  .topbar .brand b, .topbar .brand span { font-size: 20px; }
  .main { padding: 16px 16px 50px; }
  .page-head h1 { font-size: 28px; }
  .page-head .titles { flex-basis: calc(100% - 80px); }
  .page-head .actions { flex-basis: 100%; }
  .grid.two, .grid.three { grid-template-columns: 1fr; }
  .grid.side-right > .sticky { position: static; order: -1; }
  .big-money { font-size: 30px; }
  .big-money.xl { font-size: 36px; }
  .select.narrow { min-width: 0; flex: 1; }
  .filter { width: 100%; }
  .table th, .table td { padding: 10px; }
  .table .c { width: 54px; }
  dialog { max-height: calc(100dvh - 24px); }
  .hide-sm { display: none !important; }
}

/* Gruplu listede satır içeriği (eski .item yapısıyla aynı alt sınıflar) */
.r .body { display: flex; flex-direction: column; gap: 1px; }
.r .sub { font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r .end { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.r .title { font-weight: 400; }
.totals { gap: 4px; }
.totals .big-money { font-size: 30px; }

/* ── Mesajlar (uygulamadaki sohbetle aynı dil: mavi balon, durum noktaları) ── */

.nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center; background: var(--accent); color: var(--on-accent);
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
}
body.no-scroll { overflow: hidden; }
/* Sohbet ekranı tam ekran yüksekliğinde: sayfa kendisi kaymasın (alt boşluk üstle eşit) */
.main:has(> .chat) { padding-bottom: 30px; max-width: 1400px; }

.chat {
  --mine: #2F6FE4;
  display: grid; grid-template-columns: 320px minmax(0, 1fr);
  height: calc(100dvh - 60px); min-height: 480px;
  background: var(--card); border-radius: var(--radius); overflow: hidden;
}
.chat-list { display: flex; flex-direction: column; border-right: 1px solid var(--sep); min-height: 0; }
.chat-list-head { display: flex; align-items: center; gap: 10px; padding: 18px 16px 10px; }
.chat-list-head h1 { flex: 1; font-weight: 700; font-size: 24px; letter-spacing: -.4px; }
.chat-search {
  display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 12px; height: 38px;
  background: var(--card2); border-radius: 10px; color: var(--secondary);
}
.chat-search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; color: var(--text); }
dialog .chat-search { margin: 0; }
.chat-items { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.chat-note { padding: 18px 12px; color: var(--secondary); font-size: 14px; text-align: center; }
.chat-item {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px; border: 0; border-radius: 12px;
  background: none; text-align: left; cursor: pointer;
}
.chat-item:hover { background: var(--hover); }
.chat-item.on { background: var(--card2); }
.chat-item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.chat-item-top, .chat-item-bottom { display: flex; align-items: center; gap: 8px; }
.chat-item-top b { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item.unread .chat-item-top b { font-weight: 700; }
.chat-item-time { font-size: 12px; color: var(--tertiary); white-space: nowrap; }
.chat-item.unread .chat-item-time { color: var(--accent); }
.chat-item-last { flex: 1; min-width: 0; font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700;
}

.chat-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat-placeholder { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--tertiary); }
.chat-open { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--sep); background: var(--card); }
.chat-back { display: none; }
.chat-titles { min-width: 0; display: flex; flex-direction: column; }
.chat-titles b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-titles span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chat-scroll { flex: 1; overflow-y: auto; padding: 10px 18px 14px; overscroll-behavior: contain; }
.chat-more { text-align: center; padding: 8px; }
.chat-msgs { display: flex; flex-direction: column; gap: 3px; }
.chat-day { align-self: center; margin: 12px 0 6px; }
.chat-day span { padding: 4px 10px; border-radius: 999px; background: var(--card); color: var(--secondary); font-size: 12px; font-weight: 600; }

.msg { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.msg.cont { margin-top: 0; }
.msg.mine { flex-direction: row-reverse; }
.bubble {
  max-width: min(560px, 78%); display: flex; flex-direction: column; gap: 5px;
  padding: 8px 12px; border-radius: 18px; background: var(--card2); color: var(--text);
}
.msg.mine .bubble { background: var(--mine); color: #fff; }
.bubble.media { padding: 4px; }
.bubble.media .msg-text, .bubble.media .msg-quote, .bubble.media .msg-sender { margin: 0 8px; }
.bubble.media > .msg-text:last-child { margin-bottom: 4px; }
.bubble.bare { background: none !important; padding: 0; }
.msg-sender { font-size: 13px; font-weight: 600; }
.ink-yellow { color: var(--accent); } .ink-green { color: var(--green); } .ink-blue { color: var(--blue); }
.ink-pink { color: var(--pink); } .ink-orange { color: var(--orange); } .ink-red { color: var(--red); }
.msg-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.35; }
.msg-text a { text-decoration: underline; }
.msg-text.deleted { font-style: italic; color: var(--secondary); }
.msg.mine .msg-text.deleted { color: rgba(255,255,255,.7); }
.msg-meta {
  float: right; display: inline-flex; align-items: center; gap: 4px; margin: 6px 0 -3px 10px;
  font-size: 11px; color: var(--secondary); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.msg.mine .msg-meta { color: rgba(255,255,255,.72); }
.bubble > .msg-meta { align-self: flex-end; margin: 0; }
.msg-meta.on-media { position: absolute; right: 8px; bottom: 8px; margin: 0; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.5); color: #fff; }
.msg-dot { width: 9px; height: 9px; border-radius: 50%; background: #9AA0A6; }
.msg.mine .msg-dot, .msg-meta.on-media .msg-dot { box-shadow: 0 0 0 1px rgba(255,255,255,.7); }
.msg-dot.gonderiliyor { background: none; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.7); }
.msg-dot.iletildi { background: var(--orange); }
.msg-dot.okundu, .msg-dot.dinlendi { background: var(--green); }

.msg-quote {
  display: flex; flex-direction: column; gap: 1px; text-align: left; cursor: pointer;
  padding: 6px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: 8px;
  background: var(--card); color: inherit; font-size: 13px;
}
.msg.mine .msg-quote { background: rgba(255,255,255,.15); border-left-color: rgba(255,255,255,.7); }
.msg-quote b { font-size: 12px; color: var(--accent); }
.msg.mine .msg-quote b { color: #fff; }
.msg-quote span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; opacity: .8; }

.msg-img { position: relative; display: block; padding: 0; border: 0; cursor: zoom-in; background: var(--card2); border-radius: 14px; overflow: hidden; }
.msg-img img { display: block; width: 260px; max-width: 100%; height: auto; object-fit: cover; }
.msg-audio-row { display: flex; align-items: center; gap: 10px; }
.msg-audio-row .msg-meta { float: none; margin: 0; }
.msg-audio { display: flex; align-items: center; gap: 10px; width: 220px; max-width: 100%; padding: 2px 0; }
.msg-play {
  width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); cursor: pointer;
}
.msg.mine .msg-play { background: rgba(255,255,255,.2); color: #fff; }
.msg-bar { position: relative; flex: 1; height: 4px; border-radius: 999px; background: var(--tertiary); cursor: pointer; overflow: hidden; }
.msg.mine .msg-bar { background: rgba(255,255,255,.35); }
.msg-audio.heard .msg-bar { background: color-mix(in srgb, var(--green) 75%, transparent); }
.msg-bar-fill { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--accent); }
.msg.mine .msg-bar-fill { background: #fff; }
.msg-dur { font-size: 12px; color: var(--secondary); font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.msg.mine .msg-dur { color: rgba(255,255,255,.75); }

.chat-state { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px 12px; color: var(--secondary); font-size: 14px; }
.chat-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--tertiary); border-top-color: var(--accent); animation: donus .8s linear infinite; }
@keyframes donus { to { transform: rotate(360deg); } }
.msg-file {
  display: flex; align-items: center; gap: 10px; padding: 8px; width: 260px; max-width: 100%;
  border-radius: 12px; background: var(--card); color: inherit;
}
.msg.mine .msg-file { background: rgba(255,255,255,.15); }
.msg-file-ic { width: 38px; height: 42px; display: grid; place-items: center; border-radius: 8px; background: var(--purple); color: #fff; flex-shrink: 0; }
.msg-file-body { min-width: 0; display: flex; flex-direction: column; }
.msg-file-body b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-file-body span { font-size: 12px; opacity: .75; }

.msg-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.msg:hover .msg-actions, .msg:focus-within .msg-actions { opacity: 1; }
.msg-actions button {
  width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 8px;
  background: var(--card); color: var(--secondary); cursor: pointer;
}
.msg-actions button:hover { color: var(--text); background: var(--hover); }
.msg.flash-hit .bubble { animation: hit 1.2s ease; }
@keyframes hit { 0%, 40% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }

.chat-down {
  position: absolute; right: 18px; bottom: 92px; z-index: 2; width: 42px; height: 42px;
  display: grid; place-items: center; border: 1px solid var(--sep); border-radius: 50%;
  background: var(--card2); color: var(--text); cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.chat-down-count {
  position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center; background: var(--mine); color: #fff; font-size: 11px; font-weight: 700;
}

.chat-compose { border-top: 1px solid var(--sep); background: var(--card); }
.chat-strip { display: flex; align-items: center; gap: 10px; padding: 8px 14px 0; }
.chat-strip-text { flex: 1; min-width: 0; display: flex; flex-direction: column; border-left: 3px solid var(--accent); padding-left: 10px; }
.chat-strip-text b { font-size: 13px; color: var(--accent); }
.chat-strip-text span { font-size: 13px; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attach { display: flex; gap: 8px; padding: 10px 14px 0; overflow-x: auto; }
.chat-attach-item { position: relative; flex-shrink: 0; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; background: var(--card2); }
.chat-attach-item.doc { width: 160px; }
.chat-attach-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chat-attach-doc { height: 100%; display: flex; align-items: center; gap: 8px; padding: 0 10px; font-size: 12px; }
.chat-attach-doc span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.chat-attach-item button {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
}
.chat-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; }
.chat-clip { cursor: pointer; }
.chat-form textarea {
  flex: 1; min-width: 0; resize: none; max-height: 160px; overflow-y: hidden; padding: 9px 14px; line-height: 1.35;
  background: var(--card2); border: 1.5px solid transparent; border-radius: 19px; outline: none; color: var(--text);
}
.chat-form textarea:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.chat-send { background: var(--mine); color: #fff; border-radius: 50%; }

.chat-members-btn { margin-left: auto; }
.chat-person .spacer { min-width: 0; }
.chat-people { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.chat-person { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.chat-person:hover { background: var(--hover); }
.chat-person input { width: 18px; height: 18px; accent-color: var(--accent); }

.lightbox { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(0,0,0,.92); }
.lightbox img[data-lb-resim] { max-width: calc(100vw - 140px); max-height: calc(100vh - 150px); object-fit: contain; }
.lightbox button { border: 0; background: rgba(255,255,255,.12); color: #fff; cursor: pointer; display: grid; place-items: center; }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-count { position: absolute; top: 22px; left: 22px; color: #fff; font-weight: 600; font-variant-numeric: tabular-nums; }
.lightbox-thumbs { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); max-width: calc(100vw - 32px); display: flex; gap: 6px; overflow-x: auto; padding: 4px; }
.lightbox-thumbs button { flex-shrink: 0; width: 46px; height: 46px; padding: 0; border-radius: 6px; overflow: hidden; opacity: .5; }
.lightbox-thumbs button.on { opacity: 1; outline: 2px solid #fff; }
.lightbox-thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 820px) {
  .main:has(> .chat) { padding-bottom: 16px; }
  .chat { grid-template-columns: 1fr; height: calc(100dvh - 90px); border-radius: 14px; }
  .chat.has-open .chat-list { display: none; }
  .chat:not(.has-open) .chat-pane { display: none; }
  .chat-back { display: inline-flex; }
  .bubble { max-width: 85%; }
  .msg-actions { opacity: 1; }
  .msg:not(:hover) .msg-actions { display: none; }
  .lightbox img[data-lb-resim] { max-width: 100vw; }
  .lightbox-nav { display: none; }
}
