:root {
  --bg: #0b0e13;
  --panel: #12161d;
  --line: #222834;
  --text: #d7dce4;
  --muted: #8a93a3;
  --buy: #22c55e;
  --sell: #ef4444;
  --liqL: #f472b6;
  --liqS: #38bdf8;
  --accent: #f5d830;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--muted);
}

/* ───── Üst çubuk ───── */
.top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.2px;
}

.brand span {
  color: var(--accent);
}

select,
input[type='number'] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 8px;
  font: inherit;
}

input[type='number'] {
  width: 96px;
}

.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.seg button {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 5px 10px;
  font: inherit;
  cursor: pointer;
}

.seg button.on {
  background: var(--line);
  color: var(--text);
}

.price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.price #last {
  font-size: 18px;
  font-weight: 700;
}

.price small {
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
}

.ctl,
.chk {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.status i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #aa8800;
}

.status i.ok {
  background: var(--buy);
}

.status i.bad {
  background: var(--sell);
}

/* ───── Ana alan ───── */
main {
  flex: 1;
  display: flex;
  min-height: 0;
}

.chartwrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

#heat,
#chart,
#overlay {
  position: absolute;
  inset: 0;
}

#heat {
  z-index: 1;
}

#chart {
  z-index: 2;
}

#overlay {
  z-index: 3;
  pointer-events: none;
}

.tip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  background: rgba(18, 22, 29, 0.92);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.legend {
  position: absolute;
  z-index: 4;
  left: 10px;
  top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.legend b {
  font-weight: 400;
}

.crow {
  display: grid;
  grid-template-columns: 44px 1fr 56px 64px;
  gap: 6px;
  padding: 3px 4px;
  font-variant-numeric: tabular-nums;
}

.crow .s {
  color: var(--muted);
}

.crow .dist {
  color: var(--muted);
  text-align: right;
}

.crow .u {
  text-align: right;
  font-weight: 600;
}

.crow.short .u,
.crow.short .p {
  color: var(--liqS);
}

.crow.long .u,
.crow.long .p {
  color: var(--liqL);
}

.legend span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.sw {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.sw.heatbar {
  width: 28px;
  border-radius: 2px;
  background: linear-gradient(90deg, #2a1660, #2f4f9f, #1fa3a8, #7fd35a, #f5d830);
}

.sw.buy {
  background: var(--buy);
}

.sw.sell {
  background: var(--sell);
}

.sw.liqL {
  background: var(--liqL);
  transform: rotate(45deg);
  border-radius: 1px;
}

.sw.liqS {
  background: var(--liqS);
  transform: rotate(45deg);
  border-radius: 1px;
}

/* ───── Yan panel ───── */
.side {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  border-left: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
}

.card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.card.grow {
  flex: 1;
}

.card h3 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--muted);
}

.list {
  overflow-y: auto;
  min-height: 0;
  font-variant-numeric: tabular-nums;
}

.row {
  display: grid;
  grid-template-columns: 62px 1fr 1fr;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 4px;
}

.row:nth-child(odd) {
  background: rgba(255, 255, 255, 0.025);
}

.row .t {
  color: var(--muted);
}

.row .u {
  text-align: right;
  font-weight: 600;
}

.row.buy .u,
.row.buy .p {
  color: var(--buy);
}

.row.sell .u,
.row.sell .p {
  color: var(--sell);
}

.row.liqL .u,
.row.liqL .p {
  color: var(--liqL);
}

.row.liqS .u,
.row.liqS .p {
  color: var(--liqS);
}

.empty {
  color: var(--muted);
  padding: 6px 4px;
}

.frow {
  display: grid;
  grid-template-columns: 34px 1fr 64px;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
  font-variant-numeric: tabular-nums;
}

.frow .lbl {
  color: var(--muted);
}

.fbar {
  position: relative;
  height: 14px;
  border-radius: 3px;
  background: var(--sell);
  overflow: hidden;
}

.fbar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--buy);
}

.fbar span {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  font-size: 10px;
  line-height: 14px;
  color: #fff;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

.frow .d {
  text-align: right;
  font-weight: 600;
}

/* ───── Giriş ───── */
body.login {
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.loginbox {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 32px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-align: center;
}

.loginbox .brand {
  font-size: 28px;
}

.loginbox p {
  margin: 0;
  color: var(--muted);
}

.loginbox small {
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 8px;
  background: #f0f3f6;
  color: #0b0e13;
  font-weight: 600;
  text-decoration: none;
}

.btn:hover {
  background: #fff;
}

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.user img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.user a {
  color: var(--muted);
}

footer {
  padding: 5px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 900px) {
  main {
    flex-direction: column;
  }

  .chartwrap {
    min-height: 60vh;
  }

  .side {
    width: auto;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .card.grow {
    max-height: 260px;
  }
}
