/* style.css -- terminal-inspired, data-first design */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #0c0f13;
  --panel: #14181f;
  --panel-2: #191e26;
  --line: #262c36;
  --text: #e7e9ec;
  --text-dim: #8a919c;
  --amber: #e0a458;
  --green: #4fbf7a;
  --green-bg: rgba(79, 191, 122, 0.12);
  --red: #e2574c;
  --red-bg: rgba(226, 87, 76, 0.12);
  --wait: #6b7280;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { color: var(--amber); font-size: 22px; }
.brand-title {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 15px;
}
.brand-sub { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.broker-select { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.broker-select label { font-size: 12px; color: var(--text-dim); }

select, input[type="text"], input[type="number"] {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
}

button {
  background: var(--amber);
  color: #1a1305;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
button:hover:not(:disabled) { opacity: 0.85; }
button:disabled { background: var(--line); color: var(--text-dim); cursor: not-allowed; }
button.secondary { background: transparent; border: 1px solid var(--line); color: var(--text); }

.status-pill {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.status-off { color: var(--text-dim); }
.status-on { color: var(--green); border-color: var(--green); }

main { padding: 20px 24px 40px; max-width: 1200px; margin: 0 auto; }

.control-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.refresh-control { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); }
.refresh-control input { width: 70px; }

.auto-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); }
.tag-soon {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  color: var(--amber);
  border: 1px solid var(--amber);
  border-radius: 999px;
  padding: 1px 7px;
}

.last-updated { margin-left: auto; font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--text-dim); }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  margin-bottom: 20px;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: left;
  font-size: 10px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
  white-space: nowrap;
}

tbody td {
  padding: 6px 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.col-narrow-wrap {
  white-space: normal;
  max-width: 70px;
  word-break: break-word;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }

.sym { font-weight: 600; color: var(--text); font-family: 'Inter', sans-serif; font-size: 12px; }
.remove-stock {
  margin-left: 6px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 10px;
  opacity: 0.6;
}
.remove-stock:hover { color: var(--red); opacity: 1; }
.qty-input, .amount-input {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--radius);
  padding: 4px 6px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
}
.qty-input { width: 55px !important; }
.amount-input { width: 78px !important; }
.auto-checkbox { width: 15px; height: 15px; cursor: pointer; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge-wait { background: rgba(255,255,255,0.06); color: var(--wait); }
.badge-buy { background: var(--green-bg); color: var(--green); }
.badge-sell { background: var(--red-bg); color: var(--red); }
.badge-hold-bull { background: rgba(79, 191, 122, 0.06); color: #7fd99a; }
.badge-hold-bear { background: rgba(226, 87, 76, 0.06); color: #d98f88; }

tr.row-buy { background: var(--green-bg); }
tr.row-sell { background: var(--red-bg); }

.log-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.log-header {
  padding: 10px 16px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--line);
}
#logBox {
  height: 140px;
  overflow-y: auto;
  padding: 10px 16px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-dim);
}
#logBox div { padding: 2px 0; }

.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  width: 380px;
  max-width: 90vw;
}
.modal-card h3 { margin-top: 0; font-family: 'IBM Plex Mono', monospace; }
.modal-card p { font-size: 13px; color: var(--text-dim); }
.modal-card input { width: 100%; margin: 6px 0 12px; }
.modal-actions { display: flex; gap: 10px; margin-top: 8px; }

.two-col-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}
.two-col-item {
  flex: 1 1 0;
  min-width: 0;
  margin-bottom: 0;
}

.two-col-item table { min-width: 480px; }

@media (max-width: 900px) {
  .two-col-row { flex-direction: column; }
}

@media (max-width: 600px) {
  thead th, tbody td { padding: 5px 6px; font-size: 10px; }
  .two-col-item table { min-width: 0; }
  .col-vol { display: none; }
  .brand-title { font-size: 13px; }
  .brand-sub { font-size: 10px; }
  main { padding: 12px 10px 30px; }
  .topbar { padding: 10px 14px; }
}
