*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  min-height: 100vh;
}

header {
  background: #1a1d27;
  border-bottom: 1px solid #2d3148;
  padding: 1.25rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.5px; }

#summary { display: flex; gap: 2rem; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: flex-end; }
.stat .label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: #64748b; }
.stat .value { font-size: 1.1rem; font-weight: 600; }
.market-label { font-size: 0.75rem !important; color: #94a3b8; }

main {
  max-width: 960px;
  margin: 2rem auto;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: #1a1d27;
  border: 1px solid #2d3148;
  border-radius: 12px;
  padding: 1.5rem;
}

.card h2 { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; color: #94a3b8; }

/* Bot card */
.bot-card { border-color: #3730a3; }

.bot-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.bot-header h2 { margin-bottom: 0.25rem; }

.bot-strategy { font-size: 0.78rem; color: #64748b; margin-top: 0.25rem; }

.bot-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
}

.bot-status-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #94a3b8;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-on { background: #22c55e; box-shadow: 0 0 6px #22c55e; animation: pulse 2s infinite; }
.dot-off { background: #475569; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.bot-meta {
  display: flex;
  gap: 1.5rem;
  font-size: 0.78rem;
  color: #64748b;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.bot-log {
  background: #0a0c13;
  border: 1px solid #1e2235;
  border-radius: 8px;
  padding: 0.75rem;
  max-height: 220px;
  overflow-y: auto;
  font-size: 0.78rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.log-line { display: flex; gap: 0.6rem; align-items: baseline; }
.log-time { color: #475569; flex-shrink: 0; }
.log-info { color: #94a3b8; }
.log-warn { color: #f59e0b; }
.log-error { color: #ef4444; }

/* Inputs & Buttons */
.search-row, .order-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }

input[type="text"], input[type="number"] {
  flex: 1;
  min-width: 140px;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 8px;
  color: #e2e8f0;
  padding: 0.6rem 0.9rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: #6366f1; }

button {
  padding: 0.6rem 1.1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, background 0.15s;
}
button:hover { opacity: 0.85; }
button:not(.buy-btn):not(.sell-btn):not(.reset-btn):not(.stop-btn) { background: #6366f1; color: #fff; }

.buy-btn  { background: #22c55e; color: #fff; }
.sell-btn { background: #ef4444; color: #fff; }
.stop-btn { background: #7f1d1d; color: #fca5a5; border: 1px solid #ef4444; }

/* Quote box */
.quote-box {
  margin-top: 1rem;
  background: #0f1117;
  border: 1px solid #2d3148;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.quote-info { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.price { font-size: 1.5rem; font-weight: 700; }
.change { font-size: 0.9rem; }
.positive { color: #22c55e; }
.negative { color: #ef4444; }

.msg { padding: 0.6rem 0.9rem; border-radius: 8px; font-size: 0.875rem; font-weight: 500; }
.msg.success { background: #14532d; color: #86efac; }
.msg.error   { background: #450a0a; color: #fca5a5; }
.hidden { display: none !important; }
.empty { color: #475569; font-size: 0.9rem; }

/* Holdings table */
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th {
  text-align: left;
  color: #64748b;
  font-weight: 500;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid #2d3148;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td { padding: 0.6rem 0.5rem; border-bottom: 1px solid #1e2235; }
tr:last-child td { border-bottom: none; }
td.positive { color: #22c55e; }
td.negative { color: #ef4444; }

/* Transactions */
.tx-list { display: flex; flex-direction: column; gap: 0.5rem; }
.tx-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: #0f1117;
  border-radius: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.tx-badge { font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; text-transform: uppercase; }
.tx-badge.BUY  { background: #14532d; color: #86efac; }
.tx-badge.SELL { background: #450a0a; color: #fca5a5; }
.tx-pnl.positive { color: #22c55e; }
.tx-pnl.negative { color: #ef4444; }
.tx-reason { font-size: 0.75rem; color: #6366f1; background: #1e1b4b; padding: 0.1rem 0.4rem; border-radius: 4px; }

/* Recommendations */
.rec-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: #0f1117;
  border-radius: 8px;
  font-size: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}
.rec-title { color: #94a3b8; flex: 1; min-width: 200px; }
.rec-source { font-size: 0.75rem; color: #6366f1; background: #1e1b4b; padding: 0.1rem 0.4rem; border-radius: 4px; }
.tx-badge.HOLD { background: #1e3a5f; color: #7dd3fc; }

/* Danger zone */
.danger-zone { text-align: center; border-color: #450a0a; }
.reset-btn { background: transparent; border: 1px solid #ef4444; color: #ef4444; }
.reset-btn:hover { background: #ef4444; color: #fff; opacity: 1; }
