/* =============================================================================
   style.css — kabuk ve sayfa stilleri
   Bileşen sözlüğü components.css'tedir; burada sadece kabuk ve
   sayfaya özel yerleşimler bulunur. Bölümler /* ===== PAGE: x ===== */
   yorumlarıyla ayrılmıştır.
   ============================================================================= */

/* ===== SHELL: üst çubuk (masaüstü) ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 243, 236, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand__mark { width: 22px; height: 22px; background: var(--ink); border-radius: 3px; }
.brand__text { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.topnav::-webkit-scrollbar { display: none; }
.topnav__item {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  padding: 8px 13px;
  border-radius: var(--r-btn);
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}
.topnav__item:hover { background: var(--hover); color: var(--ink); }
.topnav__item--on { background: var(--ink); color: var(--paper); }
.topnav__item--on:hover { background: var(--ink); color: var(--paper); }

.topbar__end { display: flex; align-items: center; gap: 10px; flex: none; }

.market-badge {
  display: none;              /* .only-wide >= 1200px'te açar */
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  white-space: nowrap;
}
.market-badge__label {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-2);
  letter-spacing: .02em;
}

.tenant-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}
.tenant-pill:hover { border-color: var(--ink); }

.tenant-menu { width: 250px; border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 12px 30px rgba(25, 24, 19, .10); }
.tenant-menu__head { padding: 8px 10px 6px; }
.tenant-menu__item {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.tenant-menu__item:hover { background: var(--paper); }
.tenant-menu__mark { font-family: var(--font-num); font-size: 11px; color: var(--ink-3); }

.ask-btn {
  border: 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.ask-btn:hover { color: var(--paper); }
.ask-btn__key { font-family: var(--font-num); font-size: 10.5px; opacity: .6; }

/* ===== SHELL: mobil başlık ===== */
.mobile-header.only-mobile { display: flex; }
@media (min-width: 992px) { .mobile-header.only-mobile { display: none; } }

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(246, 243, 236, .94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.mobile-header__mark { width: 20px; height: 20px; background: var(--ink); border-radius: 3px; flex: none; }
.mobile-header__body { flex: 1; min-width: 0; }
.mobile-header__title { font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.2; }
.mobile-header__meta {
  font-family: var(--font-num);
  font-size: 10.5px;
  color: var(--ink-2);
  letter-spacing: .02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mobile-header__ask {
  border: 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  min-height: 40px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 500;
  flex: none;
}
.mobile-header__ask:hover { color: var(--paper); }

/* ===== SHELL: alt tab bar (mobil) ===== */
.tabbar.only-mobile { display: grid; }
@media (min-width: 992px) { .tabbar.only-mobile { display: none; } }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.tabbar__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 2px;
  min-height: 48px;
  font-size: 11px;
  font-weight: 500;
  color: #8A8578;
  border: 0;
  background: transparent;
}
.tabbar__item:hover { color: var(--ink); }
.tabbar__item--on { color: var(--ink); font-weight: 600; }
.tabbar__mark { width: 22px; height: 3px; border-radius: 2px; background: transparent; }
.tabbar__item--on .tabbar__mark { background: var(--ink); }
.tabbar__add {
  width: 46px;
  height: 34px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
}
.tabbar__item--add { color: var(--ink); font-weight: 600; font-size: 10.5px; }
.tabbar__item--add:hover .tabbar__add { opacity: .9; }

/* ===== SHELL: asistan ===== */
.assistant-fab.only-mobile { display: block; }
@media (min-width: 992px) { .assistant-fab.only-mobile { display: none; } }

.assistant-fab {
  position: fixed;
  right: 18px;
  bottom: 88px;
  z-index: 45;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--r-pill);
  min-height: 44px;
  padding: 0 18px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 10px 26px rgba(25, 24, 19, .22);
}
.assistant-fab:hover { color: var(--paper); }

.assistant-panel {
  width: min(440px, 100%);
  background: var(--paper);
  border-left: 1px solid var(--line);
}
.assistant-panel__head {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.assistant-panel__title { font-size: 15px; font-weight: 600; }
.assistant-panel__model { font-family: var(--font-num); font-size: 10.5px; color: var(--ink-3); }
.assistant-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.assistant-panel__foot {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.assistant-close {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  border-radius: var(--r-btn);
  font-size: 18px;
  line-height: 1;
}
.assistant-close:hover { background: var(--hover); }

.typing span {
  display: inline-block;
  width: 5px; height: 5px;
  border-radius: 999px;
  background: var(--ink-3);
  animation: blink 1s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

/* ===== PAGE: ozet ===== */
.hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
}
.hero__usd { font-size: clamp(17px, 4vw, 22px); color: var(--ink-2); letter-spacing: -.01em; line-height: 1.4; }
.hero__change {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-pill);
  padding: 6px 12px;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  font-weight: 500;
}
.hero__change--gain { background: var(--gain-bg); color: var(--gain); }
.hero__change--loss { background: var(--loss-bg); color: var(--loss); }
.hero__change--flat { background: var(--surface-2); color: var(--ink-3); }
.hero__spark { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.hero__spark svg { width: 100%; height: 120px; display: block; }
.hero__axis {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-num);
  font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: .06em;
  margin-top: 8px;
  gap: 8px;
}

.pnl-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.pnl-split__item { padding-left: 12px; }
.pnl-split__item--open { border-left: 2px solid var(--ink); }
.pnl-split__item--closed { border-left: 2px solid var(--ink-3); }
.pnl-split__label { font-size: 13px; color: var(--ink-2); margin-bottom: 4px; }
.pnl-split__sub { font-family: var(--font-num); font-size: 12px; color: var(--ink-2); margin-top: 2px; }

.alloc-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.alloc-list__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13.5px;
}

/* ===== PAGE: portfoy ===== */
.holding-spark svg { width: 100%; height: 64px; display: block; margin-bottom: 14px; }
.holding-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 575px) {
  .ledger__row { flex-wrap: wrap; }
  .ledger__end, .ledger__pnl { text-align: right; }
  .ledger__pnl { min-width: 0; }
}

/* ===== PAGE: form ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  align-items: start;
}
.form-side { position: sticky; top: 76px; }
@media (max-width: 991px) {
  .form-side { position: static; }
}
.type-row { display: flex; gap: 8px; }
.type-row .btn { flex: 1; min-width: 92px; }
.side-row { display: flex; gap: 8px; }
.side-row .btn { flex: 1; }
.qty-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.qty-grid .field + .field { margin-top: 0; }

.search-results {
  position: relative;
  margin-top: 6px;
}
.search-results .card { position: absolute; left: 0; right: 0; z-index: 20; }
.search-results__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-2);
  background: transparent;
  text-align: left;
}
.search-results__row:last-child { border-bottom: 0; }
.search-results__row:hover,
.search-results__row[aria-selected="true"] { background: var(--surface-2); }
.search-results__market { font-family: var(--font-num); font-size: 11.5px; color: var(--ink-3); flex: none; }

.summary-card__line { font-family: var(--font-num); font-size: 12.5px; opacity: .75; }
.summary-card__divider { border-top: 1px solid rgba(246, 243, 236, .18); margin: 14px 0; }
.summary-card__note { font-size: 12px; opacity: .6; margin-top: 10px; line-height: 1.5; }
.summary-card__warn { color: var(--gold-line); }

/* ===== PAGE: history ===== */
.history-filters { margin-bottom: 14px; }
.history-highlight { background: var(--gold-bg); }
.pagination-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;
}

/* ===== PAGE: perf ===== */
.bench-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.bench-chart { height: 300px; }
@media (max-width: 575px) { .bench-chart { height: 230px; } }
.bench-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.whatif__row { display: flex; align-items: center; gap: 12px; }
.asset-grid { overflow-x: auto; }
.asset-grid table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.asset-grid th, .asset-grid td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  font-size: 13px;
  text-align: right;
}
.asset-grid th:first-child, .asset-grid td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  background: var(--surface);
}
.asset-grid th { font-family: var(--font-num); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); font-weight: 400; }
.asset-grid td.best { background: var(--gold-bg); }

/* ===== PAGE: markets ===== */
.markets-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.markets-filters .field { flex: 1; min-width: 200px; }
.markets-filters .field + .field { margin-top: 0; }

/* ===== PAGE: settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.settings-avatar {
  width: 40px; height: 40px;
  background: var(--ink);
  border-radius: 8px;
  flex: none;
}
.settings-row__title { font-size: 14px; font-weight: 500; }
.settings-row__desc { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.settings-row__value { font-family: var(--font-num); font-size: 12px; color: var(--ink-3); flex: none; }

/* ===== PAGE: auth ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--paper);
}
.auth-card { width: 100%; max-width: 440px; }

/* ===== PAGE: data-import / account-reset ===== */
.import-types { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.import-types .btn { flex: 1; min-width: 110px; }
.reset-confirm { display: flex; align-items: flex-start; gap: 10px; margin: 14px 0; }

/* ===== SHELL: panel akış guard'ı ===== */
/* Bootstrap CSS gelmediyse bile panel akışa girip sayfayı bozmasın.
   Yalnızca AÇIKKEN (`.show`) yerleşim uygulanır; kapalıyken theme.css'teki
   `.offcanvas:not(.show){display:none}` geçerlidir. */
.offcanvas.assistant-panel.show {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1045;
  display: flex;
  flex-direction: column;
}

/* ===== PAGE: chat (asistan tam sayfa) ===== */
.assistant-page {
  display: grid;
  gap: 16px;
  max-width: 1020px;
  margin: 0 auto;
  align-items: start;
}
@media (min-width: 992px) {
  .assistant-page { grid-template-columns: 240px 1fr; }
}
.assistant-page__main { display: flex; flex-direction: column; }
.assistant-page__body {
  flex: 1;
  min-height: 340px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ===== SHELL: onay bekleyen kayıtlar (K5) =====
   Defter mantığı: bekleyen kayıt henüz DEFTERE GEÇMEMİŞTİR. Bu yüzden
   sayfanın beyaz kağıdında (--surface) değil, kağıt zemininde (--paper)
   durur ve rakamları mürekkep siyahı yerine --ink-2 ile yazılır — kurşun
   kalem. Onaylanınca satır mürekkebe döner (.unposted__state--applied).

   Sol kenardaki altın çizgi, sistemde zaten "dikkat, hata değil" anlamını
   taşıyan --gold tokenıdır (bkz. .proposal__warn). YENİ RENK EKLENMEDİ.
   Rozet, ikon, gölge, giriş animasyonu da yok: şeridin orada olması
   sinyalin kendisidir. */
.unposted {
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-card);
  background: var(--paper);
  margin-bottom: 20px;
}
.unposted__head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 14px 16px 12px;
}
.unposted__title { font-size: 14.5px; font-weight: 600; }
.unposted__note { margin: 0; font-size: 12.5px; color: var(--ink-2); }

.unposted__item { border-top: 1px solid var(--line); padding: 14px 16px; }
.unposted__name { font-size: 13.5px; font-weight: 600; }
.unposted__when {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 10px;
}
.unposted__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}
.unposted__label { color: var(--ink-2); }
/* Kurşun kalem: onaylanana kadar rakamlar tam mürekkep DEĞİL.
   #6F6A5E / #F6F3EC = 4.86:1 — WCAG AA geçer (§3.A.10). */
.unposted__value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  color: var(--ink-2);
  text-align: right;
}
/* Uyarı METNİ tam mürekkeple yazılır, altınla değil: #A97A20 kendi zemininde
   3.54:1 kalıyor ve AA'yı geçmiyor. Para uyarısının okunaklılığı pazarlık
   konusu değil — alarmı zemin ve çerçeve taşır, bilgiyi metin. */
.unposted__warn {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--ink);
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
  border-radius: var(--r-tag);
  padding: 7px 10px;
}
.unposted__foot { display: flex; gap: 8px; margin-top: 12px; }
.unposted__foot .btn { flex: 1; }

/* Onaylandı: satır mürekkebe döner ve kısa süre sonra deftere geçer. */
.unposted__state {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-2);
}
.unposted__state--applied { color: var(--gain); }
.unposted__item--applied .unposted__value { color: var(--ink); }

@media (min-width: 992px) {
  .unposted__head { padding: 16px 20px 13px; }
  .unposted__item { padding: 16px 20px; }
  /* Masaüstünde düğmeler satırı kaplamasın; karar butonu kadar yer tutsun. */
  .unposted__foot .btn { flex: 0 0 auto; min-width: 132px; }
  /* Bir defter kaydı 1100px'e yayılmaz: etiket solda rakam sağda kalırken
     araları açılır ve göz ikisini eşleştiremez. Şerit, sayfanın tam genişlikli
     kartlarıyla yarışmayan tek bir sütun olarak durur. */
  .unposted { max-width: 640px; }
}

/* ===== SHELL: asistan mesajları ===== */
.assistant-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.assistant-chips .pill { background: var(--surface-2); }
.assistant-quota { margin-top: 8px; }

.msg { max-width: 100%; }
.msg--user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-radius: 14px 14px 4px 14px;
  padding: 10px 14px;
  font-size: 14px;
  max-width: 85%;
}
.msg--assistant {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;    /* markdown render EDİLMEZ */
}
.msg__tool {
  font-family: var(--font-num);
  font-size: 10.5px;
  color: var(--ink-3);
  margin-bottom: 4px;
}

/* ===== SHELL: öneri kartı (K5) ===== */
.proposal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.proposal__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
}
/* Öneri MCP'den geldiyse kaynağı görünür (§5.1) */
.proposal__origin {
  font-family: var(--font-num);
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.proposal__body { padding: 12px 14px; }
.proposal__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 3px 0;
}
.proposal__label { color: var(--ink-2); }
.proposal__value { font-family: var(--font-num); text-align: right; }
/* Aynı gerekçe (yukarı): altın metin kağıt üstünde 3.45:1. */
.proposal__warn {
  font-size: 12.5px;
  color: var(--ink);
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
  border-radius: var(--r-tag);
  padding: 7px 10px;
  margin-top: 8px;
}
.proposal__foot {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-2);
}
.proposal__foot .btn { flex: 1; min-height: 42px; }
.proposal__state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--line-2);
  font-size: 13px;
}
.proposal__state--applied { color: var(--gain); }
.proposal__state--rejected { color: var(--ink-3); }
.proposal__state--expired { color: var(--ink-3); }

/* ===== PAGE: settings — MCP anahtarları ===== */
.token-key {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 12px 14px;
  font-size: 12.5px;
  word-break: break-all;
}
.token-config {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-btn);
  padding: 12px 14px;
  font-size: 11.5px;
  overflow-x: auto;
  margin: 0;
  white-space: pre;
}
.token-row__meta { font-family: var(--font-num); font-size: 11.5px; color: var(--ink-3); }
