/* =========================================================
   Şirket Sohbet — kurumsal arayüz
   Renkler: lacivert yan şerit, mavi vurgu, nötr gri yüzeyler
   ========================================================= */
:root {
  --navy: #0f1c33;
  --navy-2: #172746;
  --brand: #1f5fbf;
  --brand-dark: #194c99;
  --brand-soft: #e6eefb;
  --ink: #172033;
  --muted: #5d6a7c;
  --line: #dde3ea;
  --bg: #e8ecf1;
  --panel: #ffffff;
  --soft: #f3f5f8;
  --chat-bg: #eef1f5;
  --mine: #dbe8fb;
  --mine-line: #c6d9f5;
  --theirs: #ffffff;
  --online: #1f9d63;
  --danger: #c2362b;
  --danger-soft: #fbeceb;
  --warn: #a8590a;
  --warn-soft: #fdf1e3;
  --ok-soft: #e4f5ec;
  --shadow: 0 1px 2px rgba(15, 28, 51, .06), 0 8px 24px rgba(15, 28, 51, .08);
  --radius: 10px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; min-height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: 15px; line-height: 1.45;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 20px; margin-top: 10px; font-size: 14px; }

/* ---------- butonlar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 8px; background: var(--brand); color: #fff;
  padding: 9px 16px; font-weight: 600; font-size: 14px; line-height: 1.2;
}
.btn:hover { background: var(--brand-dark); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.ghost { background: var(--panel); color: var(--ink); border-color: var(--line); font-weight: 500; }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger:hover { background: #a22b21; }
.btn.ghost.danger { background: var(--panel); color: var(--danger); border-color: #efc4c0; }
.btn.ghost.danger:hover { background: var(--danger-soft); }
.btn.small { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn.wide { width: 100%; margin-top: 18px; padding: 12px; font-size: 15px; }
.btn svg { flex: none; }

.field {
  width: 100%; padding: 10px 12px; border: 1px solid #c9d2dc; border-radius: 8px;
  background: var(--panel); color: var(--ink);
}
.field:focus { border-color: var(--brand); outline: 2px solid rgba(31, 95, 191, .25); outline-offset: 0; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }

/* ---------- giriş ---------- */
.login { height: 100vh; height: 100dvh; min-height: 0; display: grid; grid-template-columns: minmax(340px, 5fr) minmax(360px, 6fr); }
.login-brand {
  background: var(--navy); color: #e8eef9; padding: 40px 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
  background-image: linear-gradient(160deg, var(--navy-2) 0%, var(--navy) 62%);
}
.brand-row { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff;
  display: grid; place-items: center; flex: none;
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: .1px; }
.brand-copy h1 { margin: 0 0 12px; font-size: 30px; line-height: 1.18; font-weight: 650; max-width: 16em; }
.brand-copy p { margin: 0 0 24px; color: #b6c3da; max-width: 30em; font-size: 16px; }
.brand-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 32em; }
.brand-points li { position: relative; padding-left: 26px; color: #d3dcee; font-size: 14.5px; }
.brand-points li::before {
  content: ""; position: absolute; left: 0; top: 3px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid #5f8fe0; background: radial-gradient(circle, #5f8fe0 40%, transparent 42%);
}
.brand-foot { color: #8393b1; font-size: 13px; }
.login-panel { display: grid; place-items: center; padding: 28px; background: var(--bg); }
.login-card {
  width: 100%; max-width: 390px; background: var(--panel); padding: 34px 32px 28px;
  border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.login-card h2 { margin: 0 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card .hint { margin: 16px 0 0; font-size: 13px; color: var(--muted); text-align: center; }
.passwrap { position: relative; }
.passwrap .field { padding-right: 76px; }
.passtoggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  color: var(--brand); font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 6px;
}
.passtoggle:hover { background: var(--brand-soft); }

/* ---------- uygulama çatısı ---------- */
.app { height: 100vh; height: 100dvh; min-height: 0; max-width: 1560px; margin: 0 auto; display: flex; background: var(--panel); box-shadow: var(--shadow); }

.rail {
  width: 68px; flex: none; background: var(--navy); display: flex; flex-direction: column;
  align-items: center; gap: 6px; padding: 14px 0;
}
.rail-logo { width: 40px; height: 40px; border-radius: 11px; background: var(--brand); color: #fff; display: grid; place-items: center; margin-bottom: 14px; }
.rail-spacer { flex: 1; }
.rail-btn {
  position: relative; width: 44px; height: 44px; border: 0; border-radius: 12px; background: transparent;
  color: #9fb0cc; display: grid; place-items: center;
}
.rail-btn:hover { background: rgba(255, 255, 255, .09); color: #fff; }
.rail-btn.active { background: rgba(255, 255, 255, .15); color: #fff; }
.rail-btn:focus-visible { outline-color: #8ab4f8; }
.rail-badge {
  position: absolute; top: 5px; right: 5px; min-width: 10px; height: 10px; border-radius: 6px;
  background: #ef5b4f; border: 2px solid var(--navy); box-sizing: content-box;
}
.rail-badge.num {
  min-width: 17px; height: 17px; padding: 0 4px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 17px; text-align: center; top: 2px; right: 0; border-color: var(--navy);
}

aside { width: 328px; flex: none; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; background: var(--panel); }
.side-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 16px 16px 8px; }
.me-chip { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 100%; }
.me-id { min-width: 0; flex: 1; }
.me-id b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.me-id small { display: block; color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.searchwrap { padding: 8px 14px 10px; }
#search { background: var(--soft); border-color: transparent; }
#search:focus { background: var(--panel); }
#list { overflow-y: auto; flex: 1; padding-bottom: 8px; }
.listnote { padding: 22px 18px; color: var(--muted); font-size: 14px; }
.conv {
  display: flex; gap: 12px; align-items: center; padding: 10px 14px; width: calc(100% - 16px); margin: 1px 8px;
  background: none; border: 0; border-radius: 10px; text-align: left; color: inherit;
}
.conv:hover { background: var(--soft); }
.conv.sel { background: var(--brand-soft); }
.meta { flex: 1; min-width: 0; }
.row1, .row2 { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.row1 b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row1 time { font-size: 12px; color: var(--muted); flex: none; }
.prev { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { background: var(--brand); color: #fff; border-radius: 10px; min-width: 20px; padding: 1px 6px; font-size: 12px; font-weight: 600; text-align: center; flex: none; }

/* avatar */
.av {
  width: 42px; height: 42px; border-radius: 50%; flex: none; position: relative;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 16px;
}
.av.sm { width: 38px; height: 38px; font-size: 15px; }
.av.lg { width: 56px; height: 56px; font-size: 22px; }
.av .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; background: var(--online); border: 2px solid var(--panel); }

/* ---------- sohbet alanı ---------- */
main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--chat-bg); position: relative; }
.connbar { display: none; background: var(--warn); color: #fff; text-align: center; padding: 6px; font-size: 13px; }
.connbar.on { display: block; }
.placeholder { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.ph-inner { max-width: 340px; }
.ph-icon { width: 68px; height: 68px; border-radius: 20px; background: var(--panel); color: var(--brand); display: grid; place-items: center; margin: 0 auto 16px; box-shadow: var(--shadow); }
.placeholder h2 { color: var(--ink); margin: 0 0 6px; font-size: 19px; }
.placeholder p { margin: 0; }
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; position: relative; }
.head { padding: 10px 18px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.head-id { min-width: 0; }
.head b { display: block; font-size: 15.5px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.head small { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.back { display: none; border: 0; background: none; padding: 6px; margin-left: -8px; border-radius: 8px; }
.back:hover { background: var(--soft); }
#msgs { flex: 1; overflow-y: auto; padding: 18px 6%; display: flex; flex-direction: column; gap: 4px; }
.day { align-self: center; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 2px 12px; border-radius: 12px; margin: 12px 0 8px; }
.empty { margin: auto; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 10px 18px; border-radius: 10px; }

.b {
  max-width: min(580px, 82%); padding: 8px 12px 6px; border-radius: 14px; background: var(--theirs);
  border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4;
}
.b.mine { align-self: flex-end; background: var(--mine); border-color: var(--mine-line); border-bottom-right-radius: 4px; }
.b.theirs { align-self: flex-start; border-bottom-left-radius: 4px; }
.b time { float: right; margin: 7px 0 0 14px; font-size: 11px; color: var(--muted); }

/* dosya ve görsel */
.fcard { display: flex; align-items: center; gap: 12px; min-width: 250px; white-space: normal; padding: 2px 0 4px; }
.ficon {
  width: 42px; height: 50px; border-radius: 7px; background: #5d6a7c; color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; flex: none; position: relative;
}
.ficon.t-pdf { background: #c2362b; } .ficon.t-doc { background: #2b579a; } .ficon.t-xls { background: #1e7145; }
.ficon.t-ppt { background: #c2461c; } .ficon.t-zip { background: #7a5c1e; } .ficon.t-img { background: #6a4fc7; } .ficon.t-txt { background: #4b5563; }
.finfo { flex: 1; min-width: 0; }
.fname { font-weight: 600; overflow-wrap: anywhere; }
.fsize { font-size: 12.5px; color: var(--muted); }
.fbtns { display: flex; flex-direction: column; gap: 5px; align-items: stretch; flex: none; }
.imgbox { display: block; max-width: 300px; min-height: 80px; border-radius: 10px; overflow: hidden; background: rgba(0, 0, 0, .06); cursor: zoom-in; border: 0; padding: 0; }
.imgbox img { display: block; max-width: 100%; max-height: 320px; }
.imgcap { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 12.5px; color: var(--muted); margin-top: 6px; white-space: normal; }

/* çark */
.wheelb { white-space: normal; }
.wheel { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.wt { font-weight: 600; font-size: 13px; align-self: flex-start; }
.wres { min-height: 22px; font-weight: 700; color: var(--brand); text-align: center; }

/* yazma alanı */
.composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--panel); border-top: 1px solid var(--line); }
#text { flex: 1; resize: none; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 20px; line-height: 1.3; background: var(--soft); }
#text:focus { background: var(--panel); border-color: var(--brand); outline: none; }
.icon { border: 0; background: none; color: var(--muted); border-radius: 50%; width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
.icon:hover { background: var(--soft); color: var(--brand); }
.send { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; flex: none; }
.send:hover { background: var(--brand-dark); }
.upbar { padding: 8px 16px; background: var(--warn-soft); border-top: 1px solid var(--line); font-size: 13px; }
.track { height: 5px; background: rgba(0, 0, 0, .1); border-radius: 3px; margin-top: 5px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--brand); }
.dropveil { display: none; position: absolute; inset: 0; background: rgba(15, 28, 51, .82); color: #fff; font-size: 19px; font-weight: 600; place-items: center; text-align: center; z-index: 5; pointer-events: none; }
.dropveil > div { border: 2px dashed rgba(255, 255, 255, .6); border-radius: 16px; padding: 40px 48px; }
.chat.drop .dropveil { display: grid; }

/* ---------- diyaloglar ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(500px, 94vw); max-height: 90vh; background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(15, 28, 51, .35); overflow: hidden; }
dialog[open] { display: flex; flex-direction: column; }
dialog.wide { width: min(960px, 96vw); }
dialog::backdrop { background: rgba(15, 28, 51, .55); }
dialog form { padding: 22px 22px 18px; overflow-y: auto; }
dialog h2 { margin: 0 0 6px; font-size: 18px; }
dialog p { margin: 6px 0; }
dialog ul { margin: 8px 0; padding-left: 20px; overflow-wrap: anywhere; }
dialog textarea.field { min-height: 120px; resize: vertical; }
.derr { color: var(--danger); min-height: 18px; margin-top: 8px; font-size: 14px; }
.drow { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.chk { display: flex; gap: 8px; align-items: center; margin-top: 14px; color: var(--ink); font-size: 14px; font-weight: 400; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.wprev { display: block; margin: 12px auto 0; }

.dhead { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px 14px; border-bottom: 1px solid var(--line); }
.dhead h2 { margin: 0; font-size: 19px; }
.dhead p { margin: 2px 0 0; color: var(--muted); font-size: 13.5px; }
.xbtn { border: 0; background: none; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; flex: none; }
.xbtn:hover { background: var(--soft); color: var(--ink); }
.dbody { padding: 18px 24px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.dfoot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; background: var(--soft); }
.dfoot .grow { flex: 1; color: var(--muted); font-size: 13.5px; min-width: 160px; }

/* durum çipleri */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 10px; background: var(--soft); color: var(--muted); white-space: nowrap; }
.chip.ok { background: var(--ok-soft); color: #14774a; }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--brand-soft); color: var(--brand-dark); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip .pt { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* yönetim paneli */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--panel); }
.stat b { display: block; font-size: 24px; line-height: 1.1; font-weight: 650; }
.stat span { font-size: 13px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tab { border: 0; background: none; white-space: nowrap; padding: 9px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--brand); border-bottom-color: var(--brand); }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar .field { max-width: 280px; }
.toolbar .sp { flex: 1; }
.rows { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rowh, .urow, .lrow { display: grid; align-items: center; gap: 12px; padding: 10px 14px; }
.rowh { background: var(--soft); font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
.urow, .lrow { border-bottom: 1px solid var(--line); }
.urow:last-child, .lrow:last-child { border-bottom: 0; }
.urow:hover, .lrow:hover { background: var(--soft); }
.ucols { grid-template-columns: minmax(180px, 2.2fr) 1.2fr 1.6fr 96px; }
.lcols { grid-template-columns: 1.4fr 1.4fr 1.2fr 1.6fr; }
.gcols { grid-template-columns: minmax(180px, 2.2fr) 1.2fr 1fr 96px; }
.fcols { grid-template-columns: 1.4fr 1.4fr 1.6fr; }
.uname { display: flex; align-items: center; gap: 12px; min-width: 0; }
.uname .t { min-width: 0; }
.uname b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uname .chips { display: flex; gap: 5px; margin-top: 2px; flex-wrap: wrap; }
.sub { color: var(--muted); font-size: 12.5px; }
.cell-r { text-align: right; }
.nodata { padding: 26px; text-align: center; color: var(--muted); }

.umeta { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0 6px; font-size: 14px; }
.umeta dt { color: var(--muted); }
.umeta dd { margin: 0; }
.acts { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.act { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.act:last-child { border-bottom: 0; }
.act b { display: block; font-size: 14px; }
.act span { color: var(--muted); font-size: 13px; }
.act.risk b { color: var(--danger); }
.uhead { display: flex; gap: 14px; align-items: center; }
.uhead h2 { margin: 0; }

/* PDF birleştirme */
.drop {
  display: grid; place-items: center; gap: 4px; width: 100%; border: 2px dashed #b7c3d4; border-radius: 12px;
  background: var(--soft); padding: 22px 16px; text-align: center; color: var(--muted);
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }
.drop b { color: var(--ink); font-size: 15px; }
.drop svg { color: var(--brand); }
.items { margin: 14px 0 0; padding: 0; list-style: none; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.item { display: grid; grid-template-columns: 28px 36px 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.item:last-child { border-bottom: 0; }
.item .n { font-weight: 650; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.item .ficon { width: 32px; height: 38px; font-size: 10px; }
.item .nm { min-width: 0; }
.item .nm b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.item.bad { background: var(--danger-soft); }
.item.bad .sub { color: var(--danger); }
.ibtns { display: flex; gap: 2px; }
.ibtn { border: 0; background: none; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.ibtn:hover:not(:disabled) { background: var(--soft); color: var(--ink); }
.ibtn:disabled { opacity: .3; cursor: default; }
.ibtn.rm:hover:not(:disabled) { background: var(--danger-soft); color: var(--danger); }
.outname { display: flex; gap: 10px; align-items: center; margin-top: 16px; }
.outname label { margin: 0; white-space: nowrap; }
.outname .field { max-width: 300px; }

#lightbox { width: auto; max-width: 96vw; background: #0d1422; color: #fff; }
#lightbox img { display: block; max-width: 94vw; max-height: 80vh; margin: 0 auto; }
.lbbar { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 14px; }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: 90vw;
  background: #1c2536; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px;
  opacity: 0; pointer-events: none; z-index: 100; box-shadow: var(--shadow);
}
#toast.show { opacity: 1; }
#toast.bad { background: var(--danger); }

/* ---------- küçük ekranlar ---------- */
@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .login-brand { padding: 22px 24px; gap: 14px; }
  .brand-copy h1 { font-size: 22px; margin-bottom: 8px; }
  .brand-copy p { font-size: 14.5px; margin-bottom: 0; }
  .brand-points, .brand-foot { display: none; }
  .login-panel { padding: 20px; align-items: start; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; flex-direction: column; max-width: none; }
  .rail { order: 2; width: 100%; flex-direction: row; justify-content: space-around; padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 0; }
  .rail-logo, .rail-spacer { display: none; }
  .rail-btn { width: 52px; height: 44px; }
  aside { width: 100%; border-right: 0; flex: 1 1 0; min-height: 0; }
  main { display: none; width: 100%; height: 100%; flex: 1 1 0; min-height: 0; }
  .app.chat-open aside, .app.chat-open .rail { display: none; }
  .app.chat-open main { display: flex; }
  .back { display: block; }
  #msgs { min-height: 0; padding: 12px 10px; -webkit-overflow-scrolling: touch; }
  .b { max-width: 90%; }
  .side-head { flex-wrap: wrap; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .side-head .me-chip { flex: 1 1 100%; }
  .side-head .btn { min-height: 40px; }
  .btn, .icon, .send, .back, .xbtn, .ibtn, .blx { touch-action: manipulation; }
  .btn.small { min-height: 40px; }
  .icon, .send, .back { width: 44px; height: 44px; min-width: 44px; }
  .composer { gap: 4px; padding-left: 8px; padding-right: 8px; }
  #text { min-height: 44px; font-size: 16px; }
  input, textarea, select { font-size: 16px; }
  .conv { min-height: 62px; }
  #list { min-height: 0; -webkit-overflow-scrolling: touch; }
  dialog, dialog.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; border-radius: 0; }
  dialog:not(.wide):not([open="false"]) { height: auto; max-height: 92dvh; border-radius: 14px 14px 0 0; margin-bottom: 0; width: 100vw; }
  .rowh { display: none; }
  .ucols, .lcols, .gcols { grid-template-columns: 1fr auto; }
  .ucols .c-status, .ucols .c-login { grid-column: 1 / -1; }
  .gcols > :nth-child(2), .gcols > :nth-child(3) { grid-column: 1 / -1; }
  .fcols { grid-template-columns: 1fr; }
  .lcols > * { grid-column: 1 / -1; }
  .blrow { flex-wrap: wrap; }
  .blrow .field { max-width: none; }
  .dhead, .dbody, .dfoot { padding-left: 16px; padding-right: 16px; }
  .item { grid-template-columns: 24px 32px 1fr; }
  .item .ibtns { grid-column: 1 / -1; justify-content: flex-end; }
  .outname { flex-direction: column; align-items: stretch; }
  .outname .field { max-width: none; }
}

/* ---------- koyu tema ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e6ecf5; --muted: #9aa9bf; --line: #2b384d; --bg: #0b111d; --panel: #141d2d; --soft: #1b2639;
    --chat-bg: #0f1726; --mine: #1f3f73; --mine-line: #2a4f8d; --theirs: #1c2739; --brand: #4c8dea; --brand-dark: #6aa1f0;
    --brand-soft: #1d2f50; --navy: #0a1224; --navy-2: #101b33; --danger: #ef6a5e; --danger-soft: #3a1f21;
    --warn-soft: #3a2c15; --ok-soft: #14352a; --warn: #f0a24f;
  }
  .btn { color: #07101f; }
  .btn.danger { color: #fff; }
  .btn:hover { background: #7aaaf2; }
  .btn.ghost { color: var(--ink); } .btn.ghost:hover { background: var(--soft); }
  .btn.danger:hover { background: #d9564b; }
  .field { border-color: #34435c; }
  .chip.ok { color: #5fd29a; } .chip.info { color: #a9c8f6; }
  .wres { color: #8fb9f5; }
  .send { color: #07101f; } .send:hover { background: #7aaaf2; }
  .badge, .rail-badge.num { color: #07101f; }
  .login-brand .logo-mark, .rail-logo { background: #3b78d8; color: #fff; }
  .upbar { color: var(--ink); }
  .drop { border-color: #3a4a66; }
  .imgbox { background: rgba(255, 255, 255, .06); }
}
@media (prefers-reduced-motion: no-preference) {
  .conv, .btn, .rail-btn, .ibtn { transition: background .12s, color .12s; }
  #toast { transition: opacity .2s; }
  dialog[open] { animation: pop .14s ease-out; }
  @keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* ---------- gruplar ---------- */
.side-head .btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
.head-id { flex: 1; min-width: 0; }
.head-id small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gav svg { color: #fff; }
.av.xs { width: 28px; height: 28px; font-size: 12px; }
.sysmsg {
  align-self: center; max-width: 92%; text-align: center; font-size: 12.5px; color: var(--muted);
  background: var(--soft); border: 1px solid var(--line); padding: 3px 12px; border-radius: 12px; margin: 6px 0;
  overflow-wrap: anywhere;
}
.sender { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.seclabel { font-size: 12.5px; font-weight: 650; color: var(--muted); margin: 0 0 8px; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.mrow:last-child { border-bottom: 0; }
.mrow:hover { background: var(--soft); }

.picker { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--panel); }
.plist { max-height: 240px; overflow-y: auto; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; }
.prow {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 7px 10px; font-weight: 500; font-size: 14px;
  cursor: pointer; border-bottom: 1px solid var(--line);
}
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--soft); }
.prow input { width: 17px; height: 17px; flex: none; }
.pcount { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- kara liste (yonetim) ---------- */
.note { margin: 0 0 12px; }
.blcard { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; background: var(--panel); display: grid; gap: 8px; }
.blcard p { margin: 0 0 6px; }
.blrow { display: flex; gap: 8px; align-items: center; }
.blrow .field { flex: 1; max-width: 420px; }
.bltest { min-height: 24px; }
.blcount { margin-bottom: 8px; }
.blchips { display: flex; flex-wrap: wrap; gap: 6px; }
.blchip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 11px; border-radius: 14px;
  background: var(--soft); border: 1px solid var(--line); font-size: 13px;
}
.blx { border: 0; background: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); padding: 0; }
.blx:hover { background: var(--danger-soft); color: var(--danger); }

/* ---------- mobil düzeltmeleri: dokunma alanları, çentik/durum çubuğu, klavye ---------- */
button, a, label, summary, .conv, .tab, .rail-btn, .passtoggle, .drop, .imgbox, .xbtn, .ibtn, .icon, .send, .back {
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
@media (max-width: 900px) {
  .login-brand { padding-top: calc(22px + env(safe-area-inset-top, 0px)); }
}
@media (max-width: 760px) {
  body { overscroll-behavior-y: none; }
  .app { height: var(--app-h, 100dvh); }
  /* sohbet üst çubuğu durum çubuğunun/çentiğin altında kalıp Geri düğmesini tıklanamaz yapıyordu */
  .head { padding: calc(8px + env(safe-area-inset-top, 0px)) 10px 8px 12px; gap: 8px; }
  .back { margin-left: 0; display: grid; place-items: center; }
  .dhead { padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
  .dfoot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  dialog form { padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px)); }
  .xbtn { width: 44px; height: 44px; }
  .ibtn { width: 40px; height: 40px; }
  .passwrap .field { padding-right: 88px; }
  .passtoggle { padding: 12px; right: 2px; min-height: 44px; }
  .tab { min-height: 44px; }
  .btn { min-height: 44px; }
  .btn.small, .side-head .btn { min-height: 40px; }
  #msgs, #list, .dbody, dialog form { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
}

/* ---------------- Dosya merkezi ---------------- */
.fc-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.fc-top .field { flex: 1; min-width: 160px; }
.fc-quota { margin: 0 0 14px; }
.fc-quota .qbar { height: 6px; border-radius: 4px; background: var(--soft); overflow: hidden; }
.fc-quota .qbar i { display: block; height: 100%; background: var(--brand); }
.fc-quota small { color: var(--muted); font-size: 12.5px; }
.fc-folders { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.fc-folders button { border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 16px; padding: 4px 12px; font-size: 13px; font-weight: 600; }
.fc-folders button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-dark); border-color: var(--brand); }
.fc-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.fc-row:last-child { border-bottom: 0; }
.fc-ext { flex: none; width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--brand-soft); color: var(--brand-dark); }
.fc-ext.pdf { background: var(--danger-soft); color: var(--danger); }
.fc-info { flex: 1; min-width: 0; }
.fc-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14.5px; }
.fc-info small { color: var(--muted); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fc-acts { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.fc-sec { margin: 18px 0 6px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.fc-note { background: var(--warn-soft); color: var(--warn); padding: 8px 12px; border-radius: 8px; font-size: 13.5px; margin-bottom: 12px; }
.fc-linkbox { display: flex; gap: 6px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.fc-linkbox input { flex: 1; min-width: 0; }
@media (max-width: 640px) { .fc-row { flex-wrap: wrap; } .fc-acts { width: 100%; justify-content: flex-start; } }

/* Herkese acik paylasim sayfasi */
.pubbody { display: grid; place-items: center; min-height: 100vh; margin: 0; padding: 20px; background: var(--bg, #f3f5f9); }
.pubcard { width: min(440px, 100%); background: var(--panel, #fff); color: var(--ink, #111); border: 1px solid var(--line, #dde3ee); border-radius: 14px; padding: 28px 26px; box-shadow: 0 10px 40px rgba(15, 28, 51, .12); }
.pubcard h2 { margin: 0 0 8px; font-size: 20px; overflow-wrap: anywhere; }
.pubcard .btn { display: block; text-align: center; text-decoration: none; margin-top: 16px; }
.pubcard form label { display: block; margin: 14px 0 6px; font-weight: 600; }
.pubfoot { display: block; margin-top: 20px; text-align: center; color: var(--muted, #667); font-size: 12px; }

/* =========================================================
   Tasarım cilası: daha yumuşak yüzeyler, net odak, akıcı geçişler
   (renkler değişkenlerden gelir; koyu tema otomatik uyar)
   ========================================================= */
:root {
  --ring: 0 0 0 3px color-mix(in srgb, var(--brand) 28%, transparent);
  --shadow-lg: 0 24px 70px rgba(10, 18, 36, .32);
}
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }
* { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent; }
body { letter-spacing: .005em; text-rendering: optimizeLegibility; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 8px; }

.btn { transition: background .15s, box-shadow .15s, transform .08s, border-color .15s; box-shadow: 0 1px 2px rgba(15, 28, 51, .12); }
.btn:hover { box-shadow: 0 3px 10px rgba(31, 95, 191, .28); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.ghost { box-shadow: none; }
.btn.ghost:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); box-shadow: none; }
.field { border-radius: 9px; transition: border-color .15s, box-shadow .15s, background .15s; }
.field:focus { border-color: var(--brand); box-shadow: var(--ring); outline: none; }
select.field { appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%238a97a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }

/* sol şerit */
.rail { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-2) 100%); box-shadow: 2px 0 14px rgba(10, 18, 36, .18); }
.rail-btn { border-radius: 12px; transition: background .15s, transform .1s, color .15s; position: relative; }
.rail-btn:hover { background: rgba(255, 255, 255, .1); transform: translateY(-1px); }
.rail-btn.active::before { content: ""; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: #fff; }
.rail-logo { box-shadow: 0 6px 16px rgba(31, 95, 191, .45); }

/* liste ve başlık */
.conv { transition: background .12s; }
.conv.sel { box-shadow: inset 3px 0 0 var(--brand); }
.head { box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(15, 28, 51, .04); }
.composer { box-shadow: 0 -1px 0 var(--line); }
.composer textarea { border-radius: 20px; transition: box-shadow .15s, border-color .15s; }
.composer textarea:focus { box-shadow: var(--ring); border-color: var(--brand); outline: none; }
.send { box-shadow: 0 4px 12px rgba(31, 95, 191, .35); transition: transform .1s, box-shadow .15s; }
.send:hover { transform: scale(1.06); }

/* pencereler */
dialog { box-shadow: var(--shadow-lg); border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
dialog[open] { animation: dlg-in .18s ease-out; }
dialog::backdrop { backdrop-filter: blur(3px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }
.dhead { background: linear-gradient(180deg, var(--panel), var(--soft)); }
.tabs { gap: 2px; }
.tab { border-radius: 8px 8px 0 0; transition: color .15s, background .15s; }
.tab:hover { background: var(--soft); }
.chip { letter-spacing: .01em; }
.toolbar, .fc-top { row-gap: 8px; }
.login-card { box-shadow: var(--shadow-lg); border-radius: 16px; }
.drop { border-radius: 14px; transition: border-color .15s, background .15s, transform .1s; }
.drop:hover { transform: translateY(-1px); }
.fc-row { border-radius: 10px; padding: 11px 10px; transition: background .12s; }
.fc-row:hover { background: var(--soft); }
.fc-ext { border-radius: 10px; }
.fc-folders button { transition: background .12s, border-color .12s; }
.fc-folders button:hover { border-color: var(--brand); }

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

/* ---------------- Dahili hat rehberi ---------------- */
.dir-unit { margin: 0 0 18px; }
.dir-unit h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dir-count { background: var(--brand-soft); color: var(--brand-dark); border-radius: 10px; padding: 0 8px; font-size: 12px; line-height: 18px; }
.dir-row { display: flex; align-items: center; gap: 14px; padding: 10px 12px; margin-bottom: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; transition: border-color .12s, box-shadow .12s, transform .1s; }
.dir-row:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 4px 14px rgba(15, 28, 51, .07); }
.dir-ext { flex: none; min-width: 64px; border: 0; border-radius: 10px; padding: 8px 10px; background: var(--brand-soft); color: var(--brand-dark); font-weight: 800; font-size: 17px; font-variant-numeric: tabular-nums; letter-spacing: .02em; transition: background .12s, color .12s, transform .08s; }
.dir-ext:hover { background: var(--brand); color: #fff; }
.dir-ext:active { transform: scale(.96); }
.dir-info { flex: 1; min-width: 0; }
.dir-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dir-info small { color: var(--muted); font-size: 12.5px; }
.dir-phone { flex: none; color: var(--brand); font-weight: 600; font-size: 13.5px; text-decoration: none; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); }
.dir-phone:hover { background: var(--brand-soft); }
.dir-del { flex: none; color: var(--danger); }
@media (max-width: 640px) { .dir-phone { display: none; } .dir-ext { min-width: 56px; font-size: 16px; } }


/* =========================================================
   Taşma ve üst üste binme güvenliği
   Kural: metin taşıyan her esnek kutu küçülebilir (min-width: 0),
   tek satırlık başlıklar üç nokta ile kısalır, serbest metin kırılır.
   ========================================================= */
.conv, .meta, .row1, .row2, .head, .head-id, .me-chip, .me-id, .uname, .t, .finfo, .fc-info, .dir-info, .nm, .mrow, .act, .prow, .item, .blrow { min-width: 0; }
.row1 b, .row1 time, .row2 .prev { min-width: 0; }
.row2 > :first-child { min-width: 0; flex: 1; }
.b, .sysmsg, .fname, .imgcap span, .act span, .sub, .dhead h2, .dhead p, .pubcard p { overflow-wrap: anywhere; }
.b time, .row1 time, .badge, .chip, .rail-badge { font-variant-numeric: tabular-nums; }
.dhead > div:first-child { min-width: 0; }
.act > div:first-child { min-width: 0; flex: 1; }
.fbtns .btn, .imgcap .btn { white-space: nowrap; }
.imgcap span { min-width: 0; flex: 1; }
.fcard { min-width: min(250px, 100%); }
.row1 { margin-bottom: 1px; }
.prev { line-height: 1.35; }


/* ---------------- Bağlantı ve davet ---------------- */
.cn-note { padding: 10px 14px; border-radius: 10px; font-size: 13.5px; line-height: 1.45; margin-bottom: 16px; }
.cn-note.ok { background: var(--ok-soft); color: #14774a; }
.cn-note.warn { background: var(--warn-soft); color: var(--warn); }
.cn-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.cn-qr { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; line-height: 0; }
.cn-qr canvas { display: block; width: 188px; height: 188px; image-rendering: pixelated; }
.cn-side { min-width: 0; display: grid; gap: 10px; }
.cn-label { font-size: 12.5px; font-weight: 650; color: var(--muted); }
.cn-url { font-size: 17px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.cn-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.cn-gap { margin-top: 20px; }
.cn-steps { margin: 0; padding-left: 22px; display: grid; gap: 6px; font-size: 14px; color: var(--ink); }
.cn-lan { min-width: 0; flex: 1; }
.cn-lan b { display: block; overflow-wrap: anywhere; }
.cn-lan small { display: block; margin-top: 2px; }
.cn-here { margin-top: 18px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; overflow-wrap: anywhere; }
.cn-here b { color: var(--ink); font-weight: 600; }
.login-card .hint.tip { margin-top: 8px; }
@media (min-width: 761px) { #conndlg { width: min(680px, 94vw); } }
@media (max-width: 560px) {
  .cn-card { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .cn-side { justify-items: center; width: 100%; }
  .cn-acts { justify-content: center; }
}

/* ---------------- Mobil yönetim paneli: kompakt satırlar ---------------- */
.b { box-shadow: 0 1px 1px rgba(15, 28, 51, .05); }
@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
  .stat { padding: 9px 10px; }
  .stat b { font-size: 20px; }
  .stat span { font-size: 12px; line-height: 1.25; display: block; }
  .urow.ucols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); row-gap: 6px; padding: 12px 14px; }
  .urow.ucols > :nth-child(1) { grid-column: 1; grid-row: 1; }
  .urow.ucols > :nth-child(4) { grid-column: 2; grid-row: 1; justify-self: end; }
  .urow.ucols .c-status { grid-column: 1; grid-row: 2; }
  .urow.ucols .c-login { grid-column: 2; grid-row: 2; text-align: right; min-width: 0; overflow-wrap: anywhere; }
}
