* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #101418; --panel: #1a2129; --line: #2a333e;
  --text: #e6edf3; --dim: #8b98a5;
  --green: #4cc38a; --red: #f06a6a; --blue: #6cb2f5; --amber: #e8c268;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.4 -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}
.hidden { display: none !important; }

/* login */
#login { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
#loginForm { display: flex; flex-direction: column; gap: 12px; width: min(320px, 86vw); }
#loginForm h1 { text-align: center; font-size: 22px; margin-bottom: 8px; }
#loginForm input {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; color: var(--text); font-size: 16px;
}
#loginForm button {
  background: var(--green); border: 0; border-radius: 10px; padding: 12px;
  font-size: 16px; font-weight: 600; color: #08130d;
}
#loginErr { color: var(--red); text-align: center; min-height: 1.2em; }

/* app çerçevesi — sol sekme rayı + sağda içerik */
#appRoot { min-height: 100vh; }
#tabs {
  position: fixed; top: 0; bottom: 0; left: 0; width: 76px; z-index: 4;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--panel); border-right: 1px solid var(--line);
  padding: calc(8px + env(safe-area-inset-top)) 4px 8px calc(4px + env(safe-area-inset-left));
}
#tabs button {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: none; border: 0; border-radius: 10px; color: var(--dim);
  padding: 9px 2px; font-size: 10.5px; font-weight: 600;
}
#tabs button .ico { font-size: 18px; }
#tabs button.active { color: var(--green); background: #22303c; }
#profilBtn { margin-bottom: 6px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--green); display: flex; align-items: center;
  justify-content: center; font-weight: 800; font-size: 17px;
  background: #22303c; color: var(--blue); overflow: hidden;
}
.avatar.buyuk { width: 84px; height: 84px; font-size: 34px; }
.ayarblok {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 14px; max-width: 460px;
}
.ayarblok h3 { font-size: 14px; color: var(--dim); margin-bottom: 10px; }
.ayarblok input[type=password], .ayarblok input[type=text] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 15px; width: 100%;
  margin-bottom: 8px;
}
.ayarblok .satir { display: flex; align-items: center; gap: 14px; }
.ayarblok label { display: block; font-size: 12px; margin: 6px 0 4px; }
.ayarblok input[type=number] {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 15px; width: 100%;
  margin-bottom: 4px;
}
.parabox { position: relative; }
.parabox input { padding-right: 92px; }
.kursec {
  position: absolute; right: 6px; top: 5px;
  background: #22303c; border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; font-size: 14px; padding: 5px 4px;
}
.ekrow { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.ekrow .ekad {
  flex: 1; min-width: 90px; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; color: var(--text); font-size: 15px;
}
.ekrow .del { margin-top: 8px; }
.btn-yesil {
  background: var(--green); color: #08130d; border: 0; border-radius: 8px;
  padding: 8px 14px; font-weight: 700; font-size: 13px; margin-top: 10px;
}
.msj { min-height: 1.2em; font-size: 13px; margin-top: 4px; }
#view {
  margin-left: 76px; overflow-x: hidden; min-height: 100vh;
  padding: 12px 10px calc(12px + env(safe-area-inset-bottom));
  /* not: margin animasyonu yok — tablo ölçümü ilk karede doğru olsun */
}

/* Bilanço/Dış Borç: menü kenara saklanır, tablo tam genişlik alır */
#tabs { transition: transform 0.22s ease; }
body.daralt #tabs { transform: translateX(-105%); }
body.daralt #view { margin-left: 0; }
body.daralt.menuacik #tabs {
  transform: translateX(0);
  box-shadow: 10px 0 34px rgba(0, 0, 0, 0.55);
  z-index: 15; /* karartmanın üstünde kalsın, sekmeler tıklanabilsin */
}
#menuKulp {
  display: none; position: fixed; left: 0; top: 50%;
  transform: translateY(-50%); z-index: 14;
  background: var(--panel); border: 1px solid var(--line); border-left: 0;
  border-radius: 0 10px 10px 0; color: var(--green);
  padding: 16px 5px; font-size: 13px;
}
body.daralt #menuKulp { display: block; }
body.daralt.menuacik #menuKulp { display: none; }
#menuArka { display: none; position: fixed; inset: 0; z-index: 6; background: rgba(0, 0, 0, 0.45); }
body.daralt.menuacik #menuArka { display: block; }

/* özet / dashboard */
.kurserit {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.kurkalem {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; color: var(--dim);
}
.kurkalem b { color: var(--text); font-variant-numeric: tabular-nums; }
.dashgrid { display: flex; flex-direction: column; gap: 12px; }
.dash {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; max-width: 420px;
}
.dash h3 { font-size: 15px; margin-bottom: 8px; }
.dash.kucuk { max-width: 340px; padding: 10px 12px; }
.dash.kucuk h3 { font-size: 13px; margin-bottom: 5px; }
.dash.kucuk .legend { font-size: 11.5px; gap: 4px; }
.dash.kucuk .mid { font-size: 11px; }
.dash.kucuk .midlbl { font-size: 7px; }
.dash .donutrow { display: flex; align-items: center; gap: 16px; }
.dash svg { flex-shrink: 0; }
.dash .mid { font-size: 15px; font-weight: 700; fill: var(--text); }
.dash .midlbl { font-size: 9px; fill: var(--dim); }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.legend span { white-space: nowrap; }
.legend .dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 7px; vertical-align: 1px;
}
.legend b { font-variant-numeric: tabular-nums; }

h2 { font-size: 17px; margin: 4px 2px 10px; padding-right: 64px; }
h3.bolum {
  font-size: 14px; color: var(--dim); margin: 4px 2px 8px;
  display: flex; align-items: center; gap: 10px;
}
.mini {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 4px 9px; font-size: 12px;
}
#logoutBtn {
  position: fixed; top: 8px; right: 10px; z-index: 5;
  background: var(--red); border: 0; color: #fff; font-weight: 700;
  border-radius: 8px; padding: 5px 10px; font-size: 12px;
}
#bellBtn {
  position: fixed; top: 8px; right: 76px; z-index: 5;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 9px; font-size: 14px;
}
.rozet {
  position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px;
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 800; display: flex;
  align-items: center; justify-content: center; padding: 0 4px;
}
#bellBtn { position: fixed; }
#bellBtn .rozet { top: -5px; right: -5px; }

/* özet mesaj özeti + ayraç */
.ayrac { border: 0; border-top: 1px solid var(--line); margin: 16px 0 12px; }
.msgozet {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; max-width: 420px;
}
.msgozet .satirlar { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.msgozet .m { font-size: 13px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msgozet .m b { color: var(--text); }
.msgozet h3 { font-size: 14px; display: flex; align-items: center; gap: 8px; position: relative; }
.msgozet .rozet { position: static; }

/* bildirimler */
.bildirim {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; max-width: 460px; font-size: 14px;
}
.bildirim .zaman { font-size: 11px; color: var(--dim); margin-top: 4px; }
.bildirim .butonlar { display: flex; gap: 8px; margin-top: 10px; }
.btn-kirmizi {
  background: var(--red); color: #fff; border: 0; border-radius: 8px;
  padding: 7px 14px; font-weight: 700; font-size: 13px;
}

/* sohbet */
.convkart {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; margin-bottom: 8px; max-width: 460px;
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.convkart .bilgi { flex: 1; min-width: 0; }
.convkart .ad { font-weight: 700; font-size: 14.5px; }
.convkart .son { font-size: 12.5px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convkart .rozet { position: static; }
.sohbet {
  display: flex; flex-direction: column; max-width: 520px;
  height: calc(100vh - 150px);          /* eski tarayıcılar için pay bırak */
  height: calc(100dvh - 88px);          /* adres çubuğunu hesaba katan gerçek yükseklik */
}
.sohbet-baslik { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sohbet-baslik button { background: none; border: 0; color: var(--green); font-size: 20px; padding: 2px 8px; }
.sohbet-baslik h3 { font-size: 16px; }
#msgListe {
  flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  padding: 8px 2px;
}
.balon {
  max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 14px;
  background: var(--panel); border: 1px solid var(--line); align-self: flex-start;
  word-break: break-word; position: relative;
}
.balon .msil {
  position: absolute; left: -26px; top: 6px;
  background: none; border: 0; color: var(--dim); font-size: 12px; padding: 2px 6px;
}
.balon.ben { align-self: flex-end; background: #1c3a2d; border-color: #2c5943; }
.balon .kimden { font-size: 10.5px; color: var(--amber); font-weight: 700; margin-bottom: 2px; }
.balon a { color: var(--blue); }
.balon .mimg {
  display: block; max-width: 100%; max-height: 280px;
  border-radius: 10px; margin: 2px 0 4px;
}
.balon .saat { font-size: 9.5px; color: var(--dim); margin-top: 3px; text-align: right; }
.sohbet-alt { display: flex; gap: 6px; padding-top: 8px; align-items: center; }
.sohbet-alt input[type=text] {
  /* kutu OTOMATIK daralır: kalan alanı alır, butonları asla dışarı itmez */
  flex: 1 1 0; min-width: 0; width: 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 10px 12px; color: var(--text); font-size: 15px;
}
.sohbet-alt button {
  flex-shrink: 0;
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 8px 11px; font-size: 16px;
}
.sohbet-alt .gonder { background: var(--green); border: 0; color: #08130d; font-weight: 800; }
.bar { display: flex; gap: 8px; margin-bottom: 10px; }
.bar button, .bar select {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 14px;
}
.bar .btn-yesil { background: var(--green); border: 0; color: #08130d; font-weight: 700; }

/* tablolar */
.tblwrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { border-collapse: collapse; min-width: 100%; }
th, td {
  border-bottom: 1px solid var(--line); padding: 0; white-space: nowrap;
  border-right: 1px solid #1e2630; /* silik sütun ayrımı */
}
th:last-child, td:last-child { border-right: 0; }
th {
  background: var(--panel); color: var(--dim); font-size: 12px; text-align: right;
  padding: 9px 6px; position: sticky; top: 0;
}
th:first-child, td:first-child {
  position: sticky; left: 0; background: var(--panel); z-index: 2; text-align: left;
}
th.adcol, td.adcol {
  position: sticky; left: 0; background: var(--panel); z-index: 2; text-align: left;
  width: 84px; min-width: 84px; max-width: 84px; white-space: normal;
}
th.odercol, td.odercol {
  position: sticky; left: 84px; background: var(--panel); z-index: 2;
  text-align: center; width: 44px; min-width: 44px; max-width: 44px;
}
.biltable { table-layout: fixed; }
/* ay kolonlarında TEK kural: başlık + veri + toplam hepsi ORTALI */
.biltable td input { min-width: 0; text-align: center; }
.biltable td.ro { text-align: center; }
.adek { display: flex; align-items: flex-start; gap: 1px; padding: 4px 2px; }
.adyaz {
  flex: 1; min-width: 0; font-weight: 600; font-size: 12.5px; line-height: 1.2;
  word-break: normal; overflow-wrap: normal; overflow: hidden;
  outline: none; padding: 3px 2px; min-height: 1.2em;
}
.adyaz:focus { outline: 2px solid var(--blue); border-radius: 4px; background: #0d1116; }
.adyaz:empty::before { content: 'gider adı'; color: var(--dim); font-weight: 400; }
td.adcol { font-size: 12.5px; font-weight: 600; padding: 6px 4px; }
/* karar: rakam kolonlarında her şey SAĞA hizalı (başlık + veri + toplam) */
td input {
  background: transparent; border: 0; color: var(--text);
  padding: 9px 6px; font-size: 14px; width: 100%; min-width: 92px;
  text-align: right; display: block;
}
td input:focus { outline: 2px solid var(--blue); border-radius: 4px; background: #0d1116; }
td.ro { padding: 9px 6px; text-align: right; font-variant-numeric: tabular-nums; }
td .rowhead { display: flex; align-items: center; gap: 3px; padding-right: 4px; }
td .rowhead input { width: 76px; text-align: left; font-weight: 600; padding: 9px 4px; }
.mini-chip { padding: 3px 8px; font-size: 12px; font-weight: 800; }
/* kim öder anahtarı: sol mavi = 1. kullanıcı, sağ sarı = 2. kullanıcı */
.pswitch {
  width: 34px; height: 20px; border-radius: 999px; position: relative;
  border: 1px solid var(--line); background: #0c1015; padding: 0;
}
.pswitch .topuz {
  position: absolute; top: 2px; width: 14px; height: 14px; border-radius: 50%;
  transition: left 0.15s ease, background 0.15s ease;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; color: #0b0e12;
}
.pswitch.sol .topuz { left: 2px; background: var(--blue); }
.pswitch.sag .topuz { left: 16px; background: var(--amber); }
.pswitch.bekliyor .topuz { background: var(--panel); font-size: 9px; }
.pswitch.bekliyor { border-color: var(--amber); }
.aycol { scroll-snap-align: start; }
th.aycol { text-align: center; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
  font-size: 11.5px; font-weight: 700; background: none;
}
.chip.p1 { color: var(--blue); border-color: var(--blue); }
.chip.p2 { color: var(--amber); border-color: var(--amber); }
.del { background: none; border: 0; color: var(--dim); font-size: 13px; padding: 3px 2px; }
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red); font-weight: 600; }
.dim { color: var(--dim); }
.totrow td { background: #151b22; font-weight: 600; }

/* yeni gider pop-up'ı */
.overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, 0.65);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.popkart {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 16px; width: min(360px, 92vw); max-height: 88vh; overflow-y: auto;
}
.popkart h3 { font-size: 16px; margin-bottom: 10px; }
.popkart label { display: block; font-size: 12px; margin: 8px 0 4px; }
.popkart input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 15px; width: 100%;
}
.turlar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.turchip {
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  border-radius: 999px; padding: 7px 12px; font-size: 13px;
}
.turchip.secili { border-color: var(--green); color: var(--green); font-weight: 700; }
.bankgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.bankakutu {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 4px; display: flex; flex-direction: column; align-items: center;
  gap: 4px; color: var(--dim); font-size: 10.5px;
}
.bankakutu img { width: 28px; height: 28px; border-radius: 6px; object-fit: contain; }
.bankakutu .ico-buyuk { font-size: 24px; line-height: 28px; }
.bankakutu.secili { border-color: var(--green); color: var(--green); font-weight: 700; }
.poprow { display: flex; gap: 8px; margin-top: 14px; align-items: center; }
/* taksit çarkı */
.cark {
  position: relative; height: 64px; overflow-y: auto;
  scroll-snap-type: y mandatory; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px;
  -webkit-overflow-scrolling: touch;
}
.cark::-webkit-scrollbar { display: none; }
.cark-bosluk { height: 12px; }
.cark-item {
  height: 40px; display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center; color: var(--dim); font-size: 17px;
  font-variant-numeric: tabular-nums; will-change: transform, opacity;
}
.cark-item.aktif { color: var(--green); font-weight: 800; font-size: 20px; }
.cark-sar { position: relative; }
.cark-vurgu {
  position: absolute; top: 12px; left: 0; right: 0; height: 40px;
  border-top: 1px solid #3a4a5c; border-bottom: 1px solid #3a4a5c;
  pointer-events: none; border-radius: 2px;
}
.bankgrid { margin: 4px 0 6px; }

/* PC'de telefon çerçevesi — normal telefon boyu (393×852), telde nasılsa öyle */
@media (min-width: 700px) {
  body {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; background: #05080b;
  }
  #login, #appRoot {
    position: relative; width: 393px; height: min(852px, 94vh);
    min-height: 0; overflow: hidden; background: var(--bg);
    border: 2px solid #2a333e; border-radius: 28px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  }
  #login { min-height: 0; }
  #tabs { position: absolute; }
  #logoutBtn { position: absolute; }
  #menuKulp { position: absolute; }
  #menuArka { position: absolute; }
  #view { height: 100%; overflow-y: auto; min-height: 0; }
  .sohbet { height: calc(100% - 4px); }
}

/* enver */
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 14px; margin-bottom: 12px; display: flex; gap: 24px;
}
.card .big { font-size: 20px; font-weight: 700; color: var(--amber); }
.card .lbl { font-size: 12px; color: var(--dim); }
