:root {
  --bg: #f5f6f9;
  --card: #ffffff;
  --card-2: #f7f8fb;
  --border: #e3e6ec;
  --text: #11131a;
  --text-dim: #545d6b;
  --text-faint: #7c8493;
  --blue-light: #5bc0eb;
  --blue-dark: #1b4f8c;
  --teal: #1b5fa8;
  --teal-dim: #1b5fa815;
  --teal-hover: #164d89;
  /* Logodan örneklenmiş lacivert (beyaz üzerinde 9.59:1 kontrast) */
  --logo-navy: #0a4487;
  --red: #e5484d;
  --red-dim: #e5484d17;
  --green: #16a34a;
  --green-dim: #16a34a17;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 2px 8px rgba(16, 24, 40, 0.05);
  --shadow-hover: 0 10px 28px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.06);
  --ease: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --ticker-h: üstteki sabit fiyat şeridinin yüksekliği. Şerit position:fixed
   olduğu için gövde, kenar çubuğu ve mobil üst çubuk bu kadar aşağı itiliyor. */
:root { --ticker-h: 34px; }
body { display: flex; min-height: 100vh; padding-top: var(--ticker-h); }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Açılış ekranı — oturum başına bir kez, ~3sn */
.app-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  background: var(--bg);
  transition: opacity 0.5s ease;
}
.app-splash.hide { opacity: 0; pointer-events: none; }

.app-version {
  margin-top: 10px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  text-align: center;
  letter-spacing: 0.02em;
}
.app-splash img { width: min(260px, 62vw); height: auto; }
.app-splash .splash-footer {
  position: absolute;
  bottom: 32px;
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* Sidebar */

.sidebar {
  width: 268px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 14px;
  position: sticky;
  top: var(--ticker-h);
  height: calc(100vh - var(--ticker-h));
}

.brand {
  padding: 2px 10px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  display: block;
  height: 42px;
  width: auto;
  max-width: 100%;
  flex-shrink: 0;
  margin-left: auto; /* logo sağda */
}

/* Logo yazı tipine (geometrik sans) en yakın ücretsiz eşleşme: Montserrat */
.brand-wordmark {
  font-family: "Montserrat", var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.01em;
  color: var(--logo-navy);
  line-height: 1.25;
  order: -1;   /* yazı solda */
  min-width: 0;
}

/* geriye dönük — eski markup kalırsa bozulmasın */
.brand-mark { display: flex; align-items: center; }
.brand-mark img, .brand-mark svg { display: block; height: 24px; width: auto; }
.brand span { color: var(--teal); }

.nav { display: flex; flex-direction: column; gap: 2px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text-dim);
  font-weight: 500;
  transition: background .15s var(--ease), color .15s var(--ease);
}

.nav a svg { flex-shrink: 0; opacity: 0.8; transition: opacity .15s var(--ease); }

.nav a:hover { background: var(--card-2); color: var(--text); }
.nav a.active { background: var(--teal-dim); color: var(--teal); font-weight: 600; }
.nav a.active svg { opacity: 1; }

.nav-group-label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px 3px;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
}

.nav-group-label svg { opacity: 0.8; flex-shrink: 0; }

.nav-sub { display: flex; flex-direction: column; gap: 2px; padding-left: 22px; margin-bottom: 4px; }

.nav-sub a {
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
  border-left: 2px solid var(--border);
  margin-left: 4px;
  padding-left: 12px;
}

.nav-sub a:hover { background: var(--card-2); color: var(--text); }
.nav-sub a.active { color: var(--teal); font-weight: 600; border-left-color: var(--teal); background: var(--teal-dim); }

.sidebar-bottom {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.mode-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0 8px 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mode-badge.paper { background: var(--card-2); color: var(--text-faint); border: 1px solid var(--border); }
.mode-badge.live { background: #e5484d17; color: var(--red); border: 1px solid #e5484d40; animation: mode-badge-pulse 2s ease-in-out infinite; }

@keyframes mode-badge-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .6; }
}

.run-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 8px;
  font-weight: 500;
}

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.dot.on { background: var(--teal); box-shadow: 0 0 0 3px var(--teal-dim); }
.dot.off { background: var(--text-faint); }

.run-buttons { display: flex; gap: 6px; padding: 4px 8px 0; }

/* Main */

.main {
  flex: 1;
  padding: 32px 40px 64px;
  max-width: 1120px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
}

.page-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0 0 28px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 20px 22px;
  overflow-x: auto;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}

/* Icon stat cards (3Commas "Overall stats" pattern) */

.stat-grid, .hero-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.stat-card, .hero-stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease);
}

.stat-card:hover, .hero-stat-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #d8dce3;
  transform: translateY(-2px);
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--teal-dim);
  color: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-icon.neg { background: var(--red-dim); color: var(--red); }
.stat-icon.pos { background: var(--green-dim); color: var(--green); }

.stat-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 5px;
}

.stat-value, .hero-stat-value {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* İkincil açıklama metni. Uzun süre yalnızca `.field .hint` olarak tanımlıydı,
   bu yüzden form alanı dışındaki `class="hint"` öğeleri (bot bilgileri, büyük
   sayıların altındaki alt satırlar, backtest özetleri) hiç stil almıyor, 14px
   normal metin olarak görünüyordu.
   DİKKAT — konum kasıtlı: bu kural .pos/.neg'den ÖNCE durmalı. backtest.html
   `class="hint pos"` kullanıyor; aynı özgüllükte sonra gelen kural kazandığı
   için buradan sonraya taşınırsa yeşil/kırmızı PnL renkleri ezilir. */
.hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
}

.pos { color: var(--green); }
.neg { color: var(--red); }
.stat-value.amber, .hero-stat-value.amber { color: var(--teal); }

.hero-stat-sub {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-top: 2px;
}
.hero-stat-sub.pos { color: var(--green); }
.hero-stat-sub.neg { color: var(--red); }
.hero-stat-sub.amber { color: var(--teal); }

.section-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 28px 0 10px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 28px 0 10px;
}

.section-title-row .section-title { margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--card-2);
}

th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  color: var(--text);
}

/* Tablolarda monospace sayılar için: metin sütunları gövde fontunda kalsın.
   Sayı hücrelerine ayrıca font-family: var(--font-mono) veriliyor. */
#projection-table td { font-family: var(--font-body); }

/* select hiçbir kural almıyordu ve tarayıcının varsayılan arayüz fontuna
   (Arial) düşüyordu — sayfadaki tek yabancı yazı tipi oydu. */
select {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text);
}

tr:last-child td { border-bottom: none; }
tr.pending td { color: var(--text-faint); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-body);
}

.badge.filled, .badge.sold, .badge.completed { background: var(--teal-dim); color: var(--teal); }
.badge.pending { background: #eef0f3; color: var(--text-faint); }
.badge.kept { background: #eef0f3; color: var(--text-dim); }
.badge.pos { background: var(--green-dim); color: var(--green); }
.badge.neg { background: var(--red-dim); color: var(--red); }

/* Dashboard bot durum şeridi */
.bot-banner-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bot-banner-pair { font-size: 16px; font-weight: 700; font-family: var(--font-mono); }
.bot-banner-duration { margin-top: 8px; }
.bot-banner-duration-label {
  font-size: 11px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 3px;
}
.bot-banner-duration-value {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* Bakiye dağılımı (donut) — ortalanmış */
.donut-wrap { display: flex; flex-direction: column; align-items: center; }
.donut-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 4px; }
.donut-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.donut-legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

.empty-state {
  color: var(--text-faint);
  font-size: 13px;
  padding: 22px 4px;
  text-align: center;
}

.events-panel {
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px;
}

.event-row {
  display: flex;
  gap: 10px;
  font-size: 12.5px;
  padding: 7px 10px;
  border-radius: 7px;
}

.event-row:hover { background: var(--card-2); }

.event-time {
  font-family: var(--font-mono);
  color: var(--text-faint);
  flex-shrink: 0;
  width: 92px;
  font-size: 11px;
  line-height: 1.5;
}

.event-msg { color: var(--text-dim); white-space: pre-line; word-break: break-word; min-width: 0; }

/* Aç/kapa anahtarı */
.switch-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 11px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch-row .switch-label { font-size: 13.5px; color: var(--text); }
.switch-row .switch-label small { display: block; color: var(--text-faint); font-size: 11.5px; margin-top: 2px; }
.switch {
  position: relative; flex-shrink: 0; width: 44px; height: 24px;
  background: var(--border); border-radius: 999px; cursor: pointer;
  transition: background 0.15s ease;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform 0.15s ease;
}
.switch.on { background: var(--teal); }
.switch.on::after { transform: translateX(20px); }
.switch.disabled { opacity: 0.4; pointer-events: none; }

/* Buttons */

button, .btn {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 10px 18px;
  min-height: 40px;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease), color .15s var(--ease), box-shadow .15s var(--ease), transform .1s var(--ease);
}

button:hover { border-color: var(--text-faint); background: var(--card-2); }
button:active { transform: scale(.97); }

button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  box-shadow: 0 1px 2px rgba(27, 95, 168, .15), 0 4px 12px rgba(27, 95, 168, .18);
}

button.primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); box-shadow: 0 4px 14px rgba(27, 95, 168, .28); }

button.danger { color: var(--red); border-color: var(--red-dim); }
button.danger:hover { border-color: var(--red); background: var(--red-dim); }

button:disabled { opacity: .4; cursor: default; transform: none !important; }

/* Forms */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px 20px;
  margin-bottom: 20px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-height: 40px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease);
}

.field input:focus {
  outline: none;
  border-color: var(--teal);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--teal-dim);
}

.field .hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 4px;
}

.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 4px; }

.form-msg { font-size: 12.5px; font-weight: 600; }
.form-msg.error { color: var(--red); }
.form-msg.ok { color: var(--teal); }

.tg-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.tg-status-text { font-size: 13px; color: var(--text-dim); }
.tg-status-text b { color: var(--text); font-weight: 700; }

.close-choice {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Filter bar (Closed Trades page) */

.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar select {
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 8px 12px;
}

/* Collapsible sections (Edit DCA Bot layout) */

.edit-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}

.edit-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  margin-bottom: 14px;
  overflow: hidden;
}

.edit-section summary {
  padding: 15px 20px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.edit-section summary::-webkit-details-marker { display: none; }

.edit-section summary::before {
  content: '▸';
  color: var(--text-faint);
  font-size: 11px;
  transition: transform .15s;
}

.edit-section[open] summary::before { transform: rotate(90deg); }

.edit-section summary:hover { background: var(--card-2); }

.edit-section-body {
  padding: 4px 20px 20px;
  border-top: 1px solid var(--border);
}

.summary-panel {
  position: sticky;
  top: 26px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12.5px;
}

.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: var(--text-dim); }
.summary-row .value { font-family: var(--font-mono); font-weight: 700; color: var(--text); }

@media (max-width: 900px) {
  .edit-layout { grid-template-columns: 1fr; }
  .summary-panel { position: static; }
}

/* Portfolio chart */

.chart-wrap { width: 100%; overflow-x: auto; }
.chart-wrap svg { display: block; width: 100%; height: auto; }

/* OKX tarzı PnL % grafiği */
.pnl-chart { width: 100%; }
.pnl-chart-inner { padding: 4px 0 6px; }
.pnl-axis {
  position: absolute; top: 10px; bottom: 24px; left: 4px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  pointer-events: none;
}
.pnl-xlabels {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
  margin-top: 2px;
}
.pnl-tip {
  position: absolute; top: 6px; z-index: 5;
  background: var(--card-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 12px; min-width: 168px; pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.pnl-tip-row { display: flex; justify-content: space-between; gap: 14px; line-height: 1.7; }
.pnl-tip-row span { color: var(--text-faint); }
.pnl-tip-row b { font-family: var(--font-mono); }

.pnl-current-label { font-size: 12px; color: var(--text-faint); margin-bottom: 4px; }
.pnl-current-value { font-family: var(--font-mono); font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.pnl-xaxis {
  position: relative; height: 16px; margin-top: 4px;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint);
}
.pnl-xaxis span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.pnl-xaxis span:first-child { transform: translateX(0); }
.pnl-xaxis span:last-child { transform: translateX(-100%); }

/* Backtest işlem tablosu sayfalama çubuğu */
.bt-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.bt-pageinfo {
  font-size: 12.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.big-number {
  font-family: var(--font-mono);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.big-number.pos { color: var(--green); }
.big-number.neg { color: var(--red); }
.big-number.amber { color: var(--teal); }

/* Copy feedback */

button.copied { background: var(--teal-dim); border-color: var(--teal); color: var(--teal); }

.nav-preview-list { display: flex; flex-direction: column; gap: 0; }
.nav-preview-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.nav-preview-row:last-child { border-bottom: none; }

/* Edit DCA Bot layout extras */

.pill-tabs { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; width: fit-content; }
.pill-tabs button { border: none; border-radius: 0; background: var(--card); color: var(--text-dim); padding: 9px 16px; font-size: 12.5px; font-weight: 600; cursor: default; }
.pill-tabs button.active { background: var(--teal); color: #fff; }
.pill-tabs button.disabled-tab { color: var(--text-faint); cursor: not-allowed; background: var(--card-2); }
.pill-tabs button + button { border-left: 1px solid var(--border); }

/* Dönem seçici (dashboard / portfolyo / kapanan) */
.period-tabs { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; width: fit-content; }
.period-tabs button { border: none; border-radius: 0; background: var(--card); color: var(--text-dim); padding: 7px 13px; font-size: 12px; font-weight: 600; cursor: pointer; }
.period-tabs button.active { background: var(--teal); color: #fff; }
.period-tabs button + button { border-left: 1px solid var(--border); }
.period-tabs button:hover:not(.active) { background: var(--card-2); }

.field-group { border-left: 3px solid var(--teal); padding-left: 16px; margin-bottom: 22px; }
.field-group.disabled { border-left-color: var(--border); }
.field-group.disabled .field-group-title { color: var(--text-faint); }
.field-group.disabled .field label { color: var(--text-faint); }

.field-group-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-soon {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--text-faint);
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 2px 8px;
}

.static-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-2);
  font-size: 13px;
  color: var(--text-dim);
  width: 100%;
}

.toggle-visual {
  width: 34px;
  height: 19px;
  border-radius: 100px;
  background: var(--border);
  position: relative;
  flex-shrink: 0;
  display: inline-block;
}

.toggle-visual::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #fff;
}

.toggle-visual.on { background: var(--teal); }
.toggle-visual.on::after { left: 17px; }

.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f5a62317;
  border: 1px solid #f5a62340;
  color: #8a5a10;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
}

input.readonly-field {
  background: var(--card-2) !important;
  color: var(--text-faint) !important;
}

.unsupported-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  font-size: 13px;
  color: var(--text-faint);
}

/* Mobile topbar + off-canvas sidebar */

.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 60;
  align-items: center;
  gap: 12px;
  padding: 16px 16px;       /* 12 → 16: header biraz büyüdü */
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

/* Not: .mobile-topbar img özgüllüğü .topbar-logo'dan yüksek — ikisi de aynı
   yükseklikte tutulmalı, yoksa .topbar-logo'nun değeri hiç uygulanmaz. */
.mobile-topbar img {
  height: 36px; display: block; width: auto;
  flex-shrink: 0;
  order: 1;          /* DOM'da yazıdan önce geliyor — sona al */
  margin-left: auto; /* logo sağ kenarda */
}
.topbar-logo { height: 42px; width: auto; display: block; }

/* Topbarda tek satır; dar telefonlarda taşarsa kısalsın, logoyu sıkıştırmasın */
.mobile-topbar .brand-wordmark {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  order: 0; /* hamburger'dan sonra, logodan önce */
}

.mobile-topbar .brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.mobile-topbar .brand-title span { color: var(--teal); }

.hamburger-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  color: var(--text);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.45);
  z-index: 90;
}

@media (max-width: 860px) {
  body { flex-direction: column; }

  .mobile-topbar { display: flex; top: var(--ticker-h); }

  .sidebar {
    position: fixed;
    top: var(--ticker-h);
    left: 0;
    bottom: 0;
    height: calc(100vh - var(--ticker-h));
    width: 268px;
    max-width: 82vw;
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 100;
    box-shadow: 8px 0 24px rgba(0, 0, 0, .18);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main { padding: 20px 16px 60px; max-width: 100%; }

  .page-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .page-header button, .page-header .btn { align-self: flex-start; }

  .edit-layout { grid-template-columns: 1fr; }
  .summary-panel { position: static; }

  .stat-grid, .hero-stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
  }

  .stat-card, .hero-stat-card { padding: 14px 16px; }
  .card { padding: 16px 18px; }

  .hero-stat-value { font-size: 20px; }
  .stat-value { font-size: 16px; }

  /* Grid 2 sütuna düştüğünde satırda tek başına kalan son kart tüm genişliği
     kaplasın — "433.17 USDC (+13.24%)" gibi uzun değerler 3 satıra bölünmesin. */
  .hero-stat-grid > *:last-child:nth-child(odd),
  .stat-grid > *:last-child:nth-child(odd) { grid-column: 1 / -1; }

  /* Tam genişliğe yayılan hero kartı (Arbitraj PNL): ikon solda, etiket +
     değer sağında — kart gereksiz yere uzamasın. */
  #hero-stat-grid > .hero-stat-card:last-child:nth-child(odd) {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: 14px;
    align-items: center;
  }
  #hero-stat-grid > .hero-stat-card:last-child:nth-child(odd) .stat-icon {
    grid-row: 1 / -1;
    margin-bottom: 0;
  }

  /* Aktif işlem gridinde tam genişliğe yayılan kart (Anlık PNL):
     etiket solda, değer sağda */
  #active-deal-grid > .card:last-child:nth-child(odd) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }
  #active-deal-grid > .card:last-child:nth-child(odd) .stat-label { margin-bottom: 0; }
  #active-deal-grid > .card:last-child:nth-child(odd) .big-number { margin-top: 0 !important; }

  table { font-size: 12px; }
  th, td { padding: 10px 8px; }

  button, .btn { min-height: 44px; }
}

/* ---------- Deal konum çubuğu (Aktif İşlem + Dashboard) ---------- */
/* Deal ilerleme çubuğu: solda bir sonraki SO tetiği, sağda TP/TTP hedefi,
     ortada ortalama maliyet ve anlık fiyat. Aradaki renkli blok = gerçekleşmemiş
     kâr/zararın görsel karşılığı (ortalamanın altındaysa kırmızı, üstündeyse yeşil). */
  .deal-bar { padding: 62px 24px 66px; }
  .deal-bar-rail {
    position: relative;
    height: 12px;
    background: var(--card-2);
    border: 1px solid var(--border);
    border-radius: 999px;
  }
  .deal-bar-seg {
    position: absolute; top: 0; bottom: 0;
    border-radius: 999px;
    background: var(--red);
  }
  .deal-bar-seg.pos { background: var(--green); }
  .deal-bar-cap {
    position: absolute; top: -7px;
    width: 3px; height: 26px; border-radius: 2px;
    transform: translateX(-50%);
  }
  .deal-bar-cap.lo { background: var(--teal); }
  .deal-bar-cap.hi { background: var(--green); }
  .deal-bar-cap.buy { background: var(--text-dim); top: -4px; height: 20px; width: 2px; }
  .deal-bar-lbl {
    position: absolute;
    font-size: 11.5px;
    line-height: 1.35;
    white-space: nowrap;
  }
  .deal-bar-lbl .k { font-weight: 700; }
  .deal-bar-lbl .v { font-family: var(--font-mono); color: var(--text); }
  /* Referanstaki gibi KADEMELİ: uç etiketler (Doldu / TP) dış kademede, hareketli
     olanlar (anlık fiyat / Alış) iç kademede. Her kademede tek etiket olduğu için
     yatayda ne kadar yakınlaşırlarsa yakınlaşsınlar üst üste binemezler. */
  .deal-bar-lbl.tier-1-up { bottom: 20px; }
  .deal-bar-lbl.tier-2-up { bottom: 40px; }
  .deal-bar-lbl.tier-1-dn { top: 20px; }
  .deal-bar-lbl.tier-2-dn { top: 40px; }
  .deal-bar-lbl { transform: translateX(-50%); }
  .deal-bar-lbl.lo .k { color: var(--teal); }
  .deal-bar-lbl.hi .k { color: var(--green); }
  .deal-bar-lbl.buy .k { color: var(--text-dim); }
  @media (max-width: 860px) {
    .deal-bar { padding: 58px 14px 62px; }
    .deal-bar-lbl { font-size: 10.5px; }
  }

/* [hidden] koruması — ölçülerek bulundu (12 Eyl 2026).
   Tarayıcının [hidden]{display:none} varsayılanı bir SINIF kuralıdır ve
   .warning-banner{display:flex} gibi herhangi bir display kuralı onu ezer.
   Sonuç: el.hidden = true hiçbir işe yaramıyordu — backtest'te boş uyarı bandı
   (37px) ve tek sayfalıkken bile sayfalayıcı (33px) görünüyordu, edit-bot'ta
   gizlenmesi gereken form bölümü açık kalıyordu.
   Bu kural yeni display'li sınıflar eklendikçe aynı hatanın tekrarını önler. */
[hidden] { display: none !important; }

/* Hesap seçici (kenar çubuğu rozeti tıklanabilir) */
.mode-badge.account-switch {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.mode-badge.account-switch:hover { filter: brightness(0.97); }
.account-switch-caret { opacity: .55; font-size: 12px; }

/* Real Account rozeti: çalışıyorsa yeşil, durdurulduysa kırmızı.
   (Eski .mode-badge.live kuralı yalnızca kırmızıydı; artık durum bilgisi
   taşıyor. Nabız animasyonu yalnızca ÇALIŞIRKEN — duran bot yanıp sönmesin.) */
.mode-badge.live-on {
  background: #2ea04317;
  color: var(--green);
  border: 1px solid #2ea04340;
  animation: mode-badge-pulse 2s ease-in-out infinite;
}
.mode-badge.live-off {
  background: #e5484d17;
  color: var(--red);
  border: 1px solid #e5484d40;
}

/* Hesap değiştirme onayı — yanlışlıkla dokunmak hesabı değiştirmesin */
.acc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 28, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.acc-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
  padding: 22px 24px;
  max-width: 420px;
  width: 100%;
}
.acc-modal-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 10px; }
.acc-modal-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; margin: 0 0 18px; }
.acc-modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* Mobil üst çubukta, marka yazısının altındaki küçük hesap etiketi. Yalnızca
   BİLGİ verir — hesabı DEĞİŞTİREN şey kenar çubuğunun dibindeki #mode-badge.
   Kenar çubuğunda YOK: orada rozetin kendisi zaten görünüyor, tekrar olurdu. */
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.mobile-topbar .brand-text { order: 0; overflow: hidden; }

/* Seçici `.brand-text` ile başlıyor: etiket yalnızca o sarmalayıcının içinde
   var, ve kenar çubuğuna geri taşınırsa `.brand span { color: var(--teal) }`
   kuralına spesifiklikte yenilmesin (etiket bir kez maviye dönmüştü). */
.brand-text .brand-account {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Rozetle aynı dil: Real çalışıyorsa yeşil, durdurulduysa kırmızı. */
.brand-text .brand-account.live-on  { color: var(--green); }
.brand-text .brand-account.live-off { color: var(--red); }

/* Paper trading'e özgü ipuçları ve alanlar yalnızca Demo Account'ta görünür.
   Real Account'ta "Paper trading'de…", "Sanal Bakiye" gibi yazılar yanıltıcı.
   Sınıfı edit-bot.html'deki updateStatus() body'ye ekleyip çıkarıyor. */
body.live-mode .paper-only { display: none !important; }

/* --- İşlemi Düzenle sayfası ------------------------------------------------ */
/* Sayfa başlığındaki geri bağlantısı: düğme gibi görünür ama <a> olduğu için
   sağ tıkla yeni sekmede açılabilir. */
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn-link:hover { color: var(--text); border-color: var(--text-faint); }

/* Anahtar/değer listesi. Dar ekranda tek sütuna iner ki değerler kırpılmasın. */
.kv-grid {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 8px 18px;
  align-items: baseline;
}
.kv-k { font-size: 12px; color: var(--text-faint); }
.kv-v { font-size: 14px; font-weight: 600; color: var(--text); }
@media (max-width: 560px) {
  .kv-grid { grid-template-columns: 1fr; gap: 2px 0; }
  .kv-k { margin-top: 8px; }
}

/* İşlemi Düzenle kartı: alanlar doğrudan kartın içinde dikey duruyor (edit-bot'ta
   olduğu gibi .form-grid ızgarasında değil), aralarındaki boşluğu buradan verir. */
.deal-card > .field + .field { margin-top: 20px; }
.deal-card input[type="number"], .deal-card input[type="text"] { max-width: 340px; }
/* Anahtar satırı girdilerle aynı genişlikte dursun; geniş ekranda kartın sağ
   ucuna kaçınca etiketle arasında yarım metre boşluk kalıyordu. */
.deal-card .toggle-row { max-width: 340px; }
.deal-card .warning-banner { margin-top: 12px; }

/* Aç/kapa anahtarı (3Commas'taki "Trailing" düğmesi gibi). Gerçek bir <button>
   role="switch" ile: durum aria-checked'te tutuluyor, CSS de oradan okuyor —
   ayrı bir sınıf senkronize etmeye gerek kalmıyor. */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.switch {
  position: relative;
  flex: none;
  width: 46px;
  height: 26px;
  /* Global `button` kuralı min-height:40px (dar ekranda 44px) veriyor ve anahtarı
     şişiriyordu — burada açıkça sıfırlanıyor. */
  min-height: 0;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card-2);
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .28);
  transition: transform .18s var(--ease);
}
.switch[aria-checked="true"] { background: var(--teal); border-color: var(--teal); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* --- Coin logoları ---------------------------------------------------------- */
.coin-logo {
  display: inline-block;
  vertical-align: middle;
  border-radius: 50%;
  flex: none;
}
/* Logo bulunamayan coin için harf rozeti (kırık resim ikonu yerine). */
.coin-logo-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
/* Logonun eklendiği başlık/hücre satır haline gelsin ki dikey hizalansın. */
.has-coin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --- Üstteki kayan fiyat şeridi ------------------------------------------- */
/* Sayfanın en üstünde sabit; kenar çubuğunun da üstünden geçer ki masaüstünde
   tam genişlikte görünsün (masaüstü yerleşiminde üst çubuk yok). */
.ticker-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--ticker-h);
  z-index: 95;              /* mobil kenar çubuğu (100) üstüne çıkabilsin */
  display: flex;
  align-items: center;
  overflow: hidden;
  background: var(--logo-navy);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  /* Kenarlarda maske YOK: mask-image elemanın ARKA PLANINI da soldurduğu için
     iki uçta şeridin lacivertti kaybolup altındaki açık zemin sızıyordu. */
}
/* Veri gelene kadar boş şerit kaymasın */
.ticker-bar:not(.ready) .ticker-track { animation: none; }

.ticker-track {
  display: flex;
  flex: none;
  width: max-content;
  animation: ticker-scroll 40s linear infinite;
}
/* İki özdeş kopya var; -%50 tam olarak ilk kopyanın sonu, o yüzden dikişsiz. */
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.ticker-bar:hover .ticker-track { animation-play-state: paused; }

.ticker-seq { display: flex; flex: none; }

.tick-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 26px;
  font-size: 12.5px;
  line-height: 1;
  white-space: nowrap;
}
.tick-logo { display: block; border-radius: 50%; background: rgba(255,255,255,.9); padding: 1px; }
.tick-coin  { font-weight: 700; letter-spacing: .04em; }
.tick-price { font-family: var(--font-mono); font-weight: 600; }
.tick-chg        { font-weight: 700; font-size: 11.5px; }
.tick-chg.up     { color: #4ade80; }
.tick-chg.down   { color: #ff8b8f; }   /* --red koyu zeminde okunmuyor, açığı */
.tick-chg.flat   { color: rgba(255, 255, 255, .65); }

/* Hareketi azalt tercihi açıksa kaydırma: fiyatlar yine görünür, sadece durur. */
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
  .ticker-bar { overflow-x: auto; }
}
