/* AUTO ALGO BOT dashboard — light theme matching the client reference */
:root {
  --bg: #eef1f6;
  --card: #ffffff;
  --border: #e5e9f0;
  --text: #16233b;
  --muted: #7a8699;
  --blue: #1a6ef5;
  --green: #16a34a;
  --green-bg: #e7f7ee;
  --red: #e11d48;
  --red-bg: #fdecef;
  --amber: #b45309;
  --amber-bg: #fdf3e0;
  --blue-bg: #e8f0fe;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(22, 35, 59, .06), 0 8px 24px rgba(22, 35, 59, .05);
  font-size: 15px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  background: var(--bg); color: var(--text); padding: 14px 16px 28px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 22px;
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 20px; margin-bottom: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; margin-right: 8px; }
.logo { font-size: 30px; }
.brand h1 { font-size: 20px; letter-spacing: .4px; }
.brand p { font-size: 12px; color: var(--muted); }
.top-cell { display: flex; flex-direction: column; gap: 3px; padding: 0 18px; border-left: 1px solid var(--border); }
.top-cell .label { font-size: 12px; color: var(--muted); }
.top-cell .value { font-weight: 600; display: flex; align-items: center; gap: 7px; }
.pnl.pos { color: var(--green); }
.pnl.neg { color: var(--red); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa4b2; display: inline-block; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); }
.mode-badge {
  margin-left: auto; font-size: 12px; font-weight: 700; letter-spacing: .8px;
  padding: 5px 12px; border-radius: 999px; background: var(--amber-bg); color: var(--amber);
}
.mode-badge.paper { background: var(--blue-bg); color: var(--blue); }

/* ---------- buttons ---------- */
.btn {
  border: 0; border-radius: 10px; padding: 12px 22px; font-size: 14px; font-weight: 700;
  letter-spacing: .5px; cursor: pointer; transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-start { background: var(--green); color: #fff; }
.btn-stop { background: var(--red); color: #fff; }
.btn-gear { background: var(--card); border: 1px solid var(--border); font-size: 17px; padding: 11px 15px; }
.btn-save { background: var(--blue); color: #fff; width: 100%; margin-top: 10px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--muted); }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px;
}
.card h2, .panel h2 {
  font-size: 13.5px; letter-spacing: .6px; display: flex; align-items: center; gap: 9px;
  margin-bottom: 15px;
}
.card-ico { font-style: normal; }
.card-ico.blue { color: var(--blue); }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px;
  font-size: 14px; background: #fafbfd; color: var(--text);
}
.field.row { display: flex; align-items: center; justify-content: space-between; }
.field.row label { margin: 0; }

.switch { position: relative; width: 46px; height: 26px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0; border-radius: 999px; background: #cdd5e1; transition: .2s;
}
.slider::before {
  content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.kv { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.kv:last-child, .kv.status-row { border-bottom: 0; }
.kv > span:first-child { color: var(--muted); font-size: 13.5px; }
.num { font-weight: 700; font-variant-numeric: tabular-nums; }
.green { color: var(--green); } .red { color: var(--red); } .blue { color: var(--blue); }
.chip { background: #f2f4f8; border: 1px solid var(--border); padding: 4px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; }

.badge {
  font-size: 11.5px; font-weight: 700; letter-spacing: .6px; padding: 5px 12px; border-radius: 7px;
}
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.blue-badge { background: var(--blue-bg); color: var(--blue); }
.side-badge { display: inline-block; margin-bottom: 10px; font-size: 13px; }
.empty { color: var(--muted); font-size: 14px; padding: 26px 0; text-align: center; }

/* ---------- panels ---------- */
.panel {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 20px; margin-top: 16px;
}
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.link { font-size: 12.5px; font-weight: 700; color: var(--text); text-decoration: none; border: 1px solid var(--border); padding: 7px 13px; border-radius: 9px; }
.link:hover { background: #f5f7fa; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 10px 8px; border-bottom: 1px solid var(--border); }
td { padding: 12px 8px; font-size: 14px; border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
td.buy { color: var(--green); font-weight: 700; }
td.sell { color: var(--red); font-weight: 700; }
td.pos { color: var(--green); font-weight: 700; }
td.neg { color: var(--red); font-weight: 700; }
.empty-row td { text-align: center; color: var(--muted); padding: 22px; }

/* ---------- live log ---------- */
.logstrip { display: flex; gap: 0; overflow-x: auto; padding: 6px 0 2px; }
.logitem {
  min-width: 190px; padding: 4px 18px; border-left: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 5px; flex-shrink: 0;
}
.logitem:first-child { border-left: 0; padding-left: 2px; }
.logitem .t { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.logitem .m { font-size: 12.5px; display: flex; align-items: flex-start; gap: 7px; }
.logdot { width: 8px; height: 8px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
.logdot.INFO { background: var(--blue); }
.logdot.WARN { background: #f59e0b; }
.logdot.ERROR { background: var(--red); }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(22, 35, 59, .45);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--card); border-radius: var(--radius); padding: 24px 26px;
  width: min(620px, 94vw); max-height: 90vh; overflow-y: auto;
}
.modal h2 { font-size: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.modal-actions .btn-save { width: auto; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .topbar { gap: 12px; }
  .top-cell { border-left: 0; padding: 0; }
}
