/* ==========================================================================
   Gemini Robotum — tasarım sistemi
   Koyu (varsayılan) ve açık tema; tüm renkler değişkenlerden gelir.
   ========================================================================== */
:root {
  --bg: #0a0e15;
  --bg-2: #0d121b;
  --surface: #121925;
  --surface-2: #171f2d;
  --surface-3: #1d2738;
  --border: #222c3d;
  --border-2: #2c384d;
  --text: #e7ebf3;
  --text-2: #a3adbf;
  --text-3: #6f7a8e;
  --accent: #4c82ff;
  --accent-2: #6d98ff;
  --accent-soft: rgba(76, 130, 255, 0.14);
  --up: #18c787;
  --up-soft: rgba(24, 199, 135, 0.13);
  --down: #f0475a;
  --down-soft: rgba(240, 71, 90, 0.13);
  --warn: #f5a524;
  --warn-soft: rgba(245, 165, 36, 0.14);
  --real: #f59e0b;
  --virtual: #4c82ff;
  --gold: #d4a94e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.25);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sidebar: 232px;
  --topbar: 60px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f5f9;
  --bg-2: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #edf1f7;
  --border: #e2e7ef;
  --border-2: #d3dae6;
  --text: #0f1729;
  --text-2: #4a566b;
  --text-3: #7b8699;
  --accent: #2f66e8;
  --accent-2: #2457d1;
  --accent-soft: rgba(47, 102, 232, 0.1);
  --up: #0c9b63;
  --up-soft: rgba(12, 155, 99, 0.1);
  --down: #d92f45;
  --down-soft: rgba(217, 47, 69, 0.09);
  --warn: #c77c02;
  --warn-soft: rgba(199, 124, 2, 0.1);
  --real: #d97706;
  --shadow: 0 1px 2px rgba(15, 23, 41, 0.06), 0 6px 18px rgba(15, 23, 41, 0.06);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent-soft); }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.warn-t { color: var(--warn); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 8px; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.big { font-size: 22px; font-weight: 650; }
.huge { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.sep { height: 1px; background: var(--border); margin: 12px 0; }
.scroll-x { overflow-x: auto; }
.svg-ico { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------- Uygulama iskeleti ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 14px 10px; gap: 4px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 16px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #4c82ff 0%, #7b5cff 55%, #18c787 120%); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 4px 14px rgba(76, 130, 255, 0.35);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text-2);
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left; font-weight: 520; position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--text); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-badge { margin-left: auto; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--text-2); font-family: var(--mono); }
.nav-badge.live { background: var(--up-soft); color: var(--up); }
.sidebar-foot { margin-top: auto; padding: 10px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); display: flex; flex-direction: column; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.page-title { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.content { padding: 18px 20px 40px; width: 100%; max-width: 1680px; margin: 0 auto; }

.real-banner {
  display: none; align-items: center; justify-content: center; gap: 10px; padding: 6px 16px; font-size: 12.5px; font-weight: 600;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.18), rgba(245, 158, 11, 0.08)); color: var(--real); border-bottom: 1px solid rgba(245, 158, 11, 0.35);
}
body.mode-real .real-banner { display: flex; }

/* mod anahtarı */
.mode-switch { display: inline-flex; padding: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.mode-switch button {
  border: 0; background: none; padding: 6px 12px; border-radius: 7px; font-weight: 650; font-size: 12.5px; color: var(--text-2); cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.mode-switch button.on.v { background: var(--virtual); color: #fff; }
.mode-switch button.on.r { background: var(--real); color: #1b1203; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: 0 0 auto; }
.dot.ok { background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.dot.err { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.dot.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.health-dots { display: flex; gap: 12px; font-size: 12px; color: var(--text-2); }
.health-dots span { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------------- Kartlar ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; }
.card-t { font-weight: 650; font-size: 14px; letter-spacing: -0.005em; }
.card-sub { font-size: 12px; color: var(--text-3); }
.card-b { padding: 4px 16px 16px; }
.card-b.flush { padding: 0; }
.grid { display: grid; gap: 14px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi-l { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi-v { font-size: 22px; font-weight: 680; letter-spacing: -0.02em; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-s { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Düğmeler ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.05s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 11.5px; border-radius: var(--radius-xs); }
.btn.lg { height: 44px; padding: 0 18px; font-size: 14.5px; }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-2); }
.btn.buy { background: var(--up); border-color: var(--up); color: #fff; }
.btn.buy:hover { filter: brightness(1.07); }
.btn.sell { background: var(--down); border-color: var(--down); color: #fff; }
.btn.sell:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { background: transparent; color: var(--down); border-color: color-mix(in srgb, var(--down) 45%, transparent); }
.btn.danger:hover { background: var(--down-soft); }
.btn.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.icon-btn { width: 32px; height: 32px; padding: 0; }

/* ---------------- Rozetler ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 99px; font-size: 11.5px; font-weight: 650; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.up { background: var(--up-soft); color: var(--up); }
.badge.down { background: var(--down-soft); color: var(--down); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.real { background: rgba(245, 158, 11, 0.16); color: var(--real); }
.badge.outline { background: transparent; border: 1px solid var(--border-2); }

/* ---------------- Form ---------------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 12px; color: var(--text-2); font-weight: 560; display: flex; align-items: center; gap: 6px; }
.input, select.input, textarea.input {
  height: 36px; padding: 0 11px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text); outline: none; width: 100%; min-width: 0;
  transition: border-color 0.12s, box-shadow 0.12s;
}
textarea.input { height: auto; min-height: 80px; padding: 9px 11px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.num { text-align: right; }
.input-group { display: flex; align-items: stretch; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--surface-2); overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input-group .input { border: 0; box-shadow: none !important; background: transparent; }
.input-group .addon { display: flex; align-items: center; padding: 0 10px; font-size: 12px; color: var(--text-3); white-space: nowrap; border-left: 1px solid var(--border); }
.input-group .addon.l { border-left: 0; border-right: 1px solid var(--border); }
.help { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.switch { position: relative; width: 38px; height: 22px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--border-2); cursor: pointer; transition: 0.15s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-2); transition: 0.15s; }
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: #fff; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); }
.seg.full { display: flex; }
.seg.full button { flex: 1; }
.seg.buy-sell button.on.b { background: var(--up); color: #fff; }
.seg.buy-sell button.on.s { background: var(--down); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--border-2); background: var(--surface-2); font-size: 12px; font-weight: 560; cursor: pointer; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------------- Tablolar ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--text-3); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: none; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .r { text-align: right; }
.table td.wrap { white-space: normal; min-width: 200px; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.sym { font-weight: 650; }
.sym small { color: var(--text-3); font-weight: 500; margin-left: 4px; }

/* ---------------- Bildirim ve modal ---------------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast {
  background: var(--surface); border: 1px solid var(--border-2); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 11px 14px; box-shadow: var(--shadow);
  font-size: 13px; animation: slideIn 0.18s ease-out; cursor: pointer;
}
.toast.success { border-left-color: var(--up); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--down); }
.toast b { display: block; margin-bottom: 2px; }
@keyframes slideIn { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-bg { position: fixed; inset: 0; background: rgba(5, 8, 14, 0.62); z-index: 90; display: grid; place-items: center; padding: 16px; animation: fade 0.12s; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5); }
.modal.wide { width: min(860px, 100%); }
.modal-h { padding: 16px 18px 6px; font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.modal-b { padding: 8px 18px 16px; }
.modal-f { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }
.alert { display: flex; gap: 10px; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface-2); font-size: 13px; line-height: 1.45; }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: var(--warn-soft); }
.alert.err { border-color: color-mix(in srgb, var(--down) 40%, transparent); background: var(--down-soft); }
.alert.ok { border-color: color-mix(in srgb, var(--up) 40%, transparent); background: var(--up-soft); }
.alert.info { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }

/* ---------------- İşlem ekranı ---------------- */
.trade-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr) 330px; gap: 14px; align-items: start; }
.mkt-list { height: calc(100vh - var(--topbar) - 60px); min-height: 520px; display: flex; flex-direction: column; }
.mkt-rows { overflow-y: auto; flex: 1; }
.mkt-row { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 6px; padding: 7px 12px; cursor: pointer; border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent); font-size: 12.5px; }
.mkt-row:hover { background: var(--surface-2); }
.mkt-row.sel { background: var(--accent-soft); }
.mkt-row .star { color: var(--text-3); cursor: pointer; font-size: 13px; line-height: 1; }
.mkt-row .star.on { color: var(--gold); }
.mkt-row .p { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mkt-row .c { font-size: 11px; font-family: var(--mono); text-align: right; }
.flash-up { animation: flashUp 0.6s; }
.flash-down { animation: flashDown 0.6s; }
@keyframes flashUp { from { background: var(--up-soft); } to { background: transparent; } }
@keyframes flashDown { from { background: var(--down-soft); } to { background: transparent; } }
.sym-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 16px; }
.sym-head .px { font-size: 24px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; }
.stat-mini { display: flex; flex-direction: column; font-size: 11px; color: var(--text-3); }
.stat-mini b { font-size: 12.5px; color: var(--text); font-family: var(--mono); font-weight: 600; }
.chart-box { height: 470px; position: relative; }
.chart-box.small { height: 260px; }
.chart-legend { position: absolute; left: 12px; top: 8px; z-index: 5; font-size: 11.5px; color: var(--text-2); font-family: var(--mono); pointer-events: none; display: flex; gap: 10px; flex-wrap: wrap; }
.book { font-family: var(--mono); font-size: 12px; }
.book-row { display: grid; grid-template-columns: 1fr 1fr 1fr; padding: 2px 12px; position: relative; }
.book-row .bar { position: absolute; top: 1px; bottom: 1px; right: 0; opacity: 0.16; }
.book-row.a .bar { background: var(--down); }
.book-row.b .bar { background: var(--up); }
.book-row span { position: relative; text-align: right; }
.book-row span:first-child { text-align: left; }
.book-mid { padding: 6px 12px; font-weight: 700; font-size: 14px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.order-panel .card-b { display: flex; flex-direction: column; gap: 12px; }
.summary-box { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; display: flex; flex-direction: column; gap: 5px; }
.summary-box .row { justify-content: space-between; }
.pct-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pct-row button { height: 26px; font-size: 11.5px; border-radius: 6px; border: 1px solid var(--border-2); background: var(--surface-2); color: var(--text-2); cursor: pointer; font-weight: 600; }
.pct-row button:hover { border-color: var(--accent); color: var(--text); }

/* pozisyon kartları */
.pos-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.pos-card.long { border-left: 3px solid var(--up); }
.pos-card.short { border-left: 3px solid var(--down); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px 14px; }
.pos-grid div { display: flex; flex-direction: column; font-size: 11.5px; color: var(--text-3); min-width: 0; }
.pos-grid b { font-size: 13px; color: var(--text); font-family: var(--mono); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pnl-big { font-size: 20px; font-weight: 700; font-family: var(--mono); }
.prog { height: 6px; border-radius: 99px; background: var(--surface-3); position: relative; overflow: hidden; }
.prog i { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 99px; background: var(--accent); }

/* ---------------- Yapay zekâ sohbeti ---------------- */
.ai-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar) - 58px); min-height: 520px; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: min(760px, 92%); display: flex; flex-direction: column; gap: 4px; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg .bubble { padding: 10px 14px; border-radius: 14px; line-height: 1.55; font-size: 13.5px; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.user .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.msg.assistant .bubble { background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.err .bubble { border-color: color-mix(in srgb, var(--down) 40%, transparent); background: var(--down-soft); }
.msg .meta { font-size: 11px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 4px 0 8px; padding-left: 20px; }
.bubble li { margin: 2px 0; }
.bubble code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }
.bubble pre { background: var(--bg); border: 1px solid var(--border); padding: 10px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.bubble table { border-collapse: collapse; margin: 6px 0; font-size: 12.5px; display: block; overflow-x: auto; }
.bubble th, .bubble td { border: 1px solid var(--border-2); padding: 4px 8px; text-align: left; }
.bubble h3, .bubble h4 { margin: 6px 0 6px; font-size: 14px; }
.pending-card { border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; max-width: min(760px, 92%); }
.chat-input { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-input textarea { min-height: 48px; max-height: 200px; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; } .typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.drop-hint { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* ---------------- Ayarlar ---------------- */
.settings-wrap { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 14px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar) + 16px); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.set-section { padding: 16px; }
.set-section + .set-section { border-top: 1px solid var(--border); }
.set-section h4 { margin: 0 0 12px; font-size: 13px; color: var(--text-2); font-weight: 650; text-transform: uppercase; letter-spacing: 0.04em; }
.set-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.set-field { display: flex; flex-direction: column; gap: 6px; }
.set-field.bool { flex-direction: row; align-items: flex-start; gap: 10px; }
.set-field.bool .txt { display: flex; flex-direction: column; gap: 3px; }
.set-field.full { grid-column: 1 / -1; }
.saved-flash { animation: savedFlash 0.9s; }
@keyframes savedFlash { from { box-shadow: 0 0 0 3px var(--up-soft); border-color: var(--up); } }

/* ---------------- Kayıtlar ---------------- */
.logs { font-family: var(--mono); font-size: 12px; max-height: calc(100vh - 220px); overflow-y: auto; }
.log-row { display: grid; grid-template-columns: 74px 52px 96px 1fr; gap: 10px; padding: 4px 14px; border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent); }
.log-row .lv-warn { color: var(--warn); } .log-row .lv-error { color: var(--down); } .log-row .lv-info { color: var(--accent); }
.log-row .msg-t { white-space: pre-wrap; word-break: break-word; }

/* ---------------- Rehber ---------------- */
.steps { display: flex; flex-direction: column; gap: 10px; counter-reset: step; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.step.done .step-n { background: var(--up); color: #fff; }
.step h4 { margin: 3px 0 6px; font-size: 14px; }
.step ol, .step ul { margin: 6px 0; padding-left: 20px; color: var(--text-2); font-size: 13px; }
.step li { margin: 3px 0; }
kbd { font-family: var(--mono); font-size: 11.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border-2); background: var(--surface-2); }

/* ---------------- Mobil alt menü ---------------- */
.tabbar { display: none; }
.more-sheet { display: none; }

@media (max-width: 1400px) {
  .trade-grid { grid-template-columns: 250px minmax(0, 1fr) 310px; }
  .g-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .trade-grid { grid-template-columns: minmax(0, 1fr) 320px; }
  .trade-grid .mkt-list { grid-column: 1 / -1; height: 320px; min-height: 0; order: 3; }
  .ai-wrap { grid-template-columns: 1fr; }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 1023px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .content { padding: 12px 12px 90px; }
  .health-dots .lbl-t { display: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 62px;
    background: var(--bg-2); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button { border: 0; background: none; color: var(--text-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10.5px; font-weight: 600; cursor: pointer; }
  .tabbar button.active { color: var(--accent); }
  .more-sheet.open { display: block; position: fixed; left: 8px; right: 8px; bottom: 70px; z-index: 45; background: var(--surface); border: 1px solid var(--border-2); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; }
  .settings-wrap { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .settings-nav .nav-item { width: auto; }
  .g-4, .g-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: 1fr; }
  .chart-box { height: 360px; }
}
@media (max-width: 760px) {
  .trade-grid { grid-template-columns: 1fr; }
  .g-2 { grid-template-columns: 1fr; }
  .page-title { display: none; }
  .mode-switch button { padding: 6px 9px; }
  .kpi-v { font-size: 19px; }
  .chat { height: calc(100vh - var(--topbar) - 150px); }
  .topbar .hide-sm { display: none !important; }
  .log-row { grid-template-columns: 64px 1fr; }
  .log-row .c3, .log-row .c2 { display: none; }
}
