* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  min-height: 100vh;
  padding: 24px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #21262d;
}
h1 { font-size: 1.6rem; color: #58a6ff; }
.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #f85149;
  transition: background 0.3s;
}
.dot.connected { background: #3fb950; }
.dot.agent-only { background: #d29922; }
.status-text { font-size: 0.9rem; color: #8b949e; }
button {
  padding: 10px 24px;
  border: 1px solid #30363d;
  border-radius: 6px;
  background: #21262d;
  color: #c9d1d9;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
button:hover { background: #30363d; border-color: #58a6ff; }
button.connect { border-color: #3fb950; color: #3fb950; }
button.disconnect { border-color: #f85149; color: #f85149; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
.error-msg {
  background: #3d1114;
  border: 1px solid #f85149;
  border-radius: 6px;
  padding: 12px 16px;
  margin-bottom: 16px;
  color: #f85149;
  display: none;
  position: relative;
}
.error-msg .error-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: none;
  border: none;
  color: #f85149;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.error-msg .error-close:hover { color: #ff7b72; }

/* Collapsible panels */
.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}
.collapsible-header .collapse-icon {
  font-size: 0.7rem;
  color: #8b949e;
  transition: transform 0.2s;
}
.collapsible-header .collapse-icon.collapsed { transform: rotate(-90deg); }
.collapsible-body { overflow: hidden; }
.collapsible-body.collapsed { display: none; }
.last-update {
  text-align: right;
  font-size: 0.8rem;
  color: #484f58;
  margin-bottom: 12px;
}
.user-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
}
.user-bar img {
  width: 32px; height: 32px;
  border-radius: 50%;
}
.user-bar .user-name { font-weight: 600; }
.user-bar .user-email { font-size: 0.85rem; color: #8b949e; }
.user-bar .spacer { flex: 1; }
.user-bar .logout-btn {
  padding: 6px 16px;
  font-size: 0.8rem;
}
.agent-secret-bar {
  padding: 12px 16px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}
.agent-secret-bar code {
  background: #0d1117;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  user-select: all;
}
.accounts-container { display: flex; flex-direction: column; gap: 24px; }
.account-card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  overflow: hidden;
}
.account-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #1c2128;
  border-bottom: 1px solid #21262d;
}
.account-name { font-size: 1.1rem; font-weight: 600; color: #58a6ff; }
.account-badge {
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 12px;
  background: #1f6feb33;
  color: #58a6ff;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: #21262d;
  border-bottom: 1px solid #21262d;
}
.summary-card {
  background: #161b22;
  padding: 14px 20px;
}
.summary-label {
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.summary-value {
  font-size: 1.15rem;
  font-weight: 600;
  color: #e6edf3;
}
.summary-currency {
  font-size: 0.75rem;
  color: #484f58;
  margin-left: 4px;
}
.detail-section { padding: 16px 20px; }
.detail-section h3 {
  font-size: 0.85rem;
  color: #8b949e;
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
}
.detail-section h3:hover { color: #c9d1d9; }
.detail-section h3::before { content: '\25B6 '; font-size: 0.7rem; }
.detail-section h3.open::before { content: '\25BC '; }
.detail-table {
  width: 100%;
  border-collapse: collapse;
  display: none;
}
.detail-table.open { display: table; }
.detail-table th {
  text-align: left;
  font-size: 0.75rem;
  color: #8b949e;
  padding: 6px 12px;
  border-bottom: 1px solid #21262d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.detail-table td {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid #21262d08;
}
.detail-table tr:hover { background: #1c2128; }
.positive { color: #3fb950; }
.negative { color: #f85149; }
.portfolio-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  display: none;
}
.portfolio-table.open { display: table; }
.portfolio-table th {
  text-align: left;
  font-size: 0.75rem;
  color: #8b949e;
  padding: 8px 12px;
  border-bottom: 1px solid #21262d;
  text-transform: uppercase;
}
.portfolio-table td {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid #21262d08;
}
.portfolio-table tr:hover { background: #1c2128; }
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: #484f58;
}
.empty-state p { font-size: 1.1rem; margin-bottom: 8px; }
.empty-state small { font-size: 0.85rem; }
.loading { opacity: 0.6; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.connecting { animation: pulse 1.5s infinite; }

/* Order panel */
.order-panel {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 24px;
}
.order-panel h2 {
  font-size: 1rem;
  color: #58a6ff;
  margin-bottom: 16px;
}
.order-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}
.order-form label {
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.order-form input, .order-form select {
  width: 100%;
  padding: 8px 12px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  font-size: 0.9rem;
}
.order-form input:focus, .order-form select:focus {
  outline: none;
  border-color: #58a6ff;
}
.order-submit {
  padding: 8px 24px;
  background: #238636;
  border: 1px solid #2ea043;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
}
.order-submit:hover { background: #2ea043; }
.order-log {
  margin-top: 12px;
  max-height: 150px;
  overflow-y: auto;
  font-size: 0.8rem;
  color: #8b949e;
}
.order-log div { padding: 4px 0; border-bottom: 1px solid #21262d; }

/* ---- Opening Range Breakout panel ---- */
.orb-input-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  align-items: end;
  margin-top: 12px;
  margin-bottom: 12px;
}
.orb-input-row label {
  font-size: 0.75rem;
  color: #8b949e;
  text-transform: uppercase;
  display: block;
  margin-bottom: 4px;
}
.orb-input-row input {
  width: 100%;
  padding: 8px 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  color: #c9d1d9;
  font-size: 0.9rem;
}
.orb-input-row input:focus { outline: none; border-color: #58a6ff; }
.orb-add-btn {
  padding: 8px 20px;
  background: #1f6feb;
  border: 1px solid #388bfd;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
  width: 100%;
}
.orb-add-btn:hover { background: #388bfd; }

.orb-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.orb-bulk-btn {
  padding: 7px 20px;
  border-radius: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid transparent;
}
.orb-bulk-buy { background: #1a4d2e; border-color: #2ea043; color: #3fb950; }
.orb-bulk-buy:hover { background: #2ea043; color: #fff; }
.orb-bulk-cancel { background: #0d2435; border-color: #1f6feb; color: #58a6ff; }
.orb-bulk-cancel:hover { background: #1f6feb; color: #fff; }
.orb-bulk-delete { background: #3d1114; border-color: #da3633; color: #f85149; }
.orb-bulk-delete:hover { background: #da3633; color: #fff; }

.orb-table-wrap {
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid #21262d;
}
.orb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  white-space: nowrap;
}
.orb-table th {
  text-align: left;
  padding: 8px 10px;
  background: #1c2128;
  color: #8b949e;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #30363d;
  font-weight: 600;
}
.orb-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #21262d08;
  color: #c9d1d9;
  vertical-align: middle;
}
.orb-table tr:hover td { background: #1c2128; }
.orb-table input[type="checkbox"] {
  accent-color: #3fb950;
  cursor: pointer;
  width: 14px;
  height: 14px;
  vertical-align: middle;
  margin-right: 4px;
}
.orb-cell-input {
  width: 60px;
  padding: 3px 6px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 3px;
  color: #c9d1d9;
  font-size: 0.8rem;
}
.orb-cell-input:focus { outline: none; border-color: #58a6ff; }

/* ORB row action buttons */
.orb-btn {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.orb-btn-buy    { background: #1a4d2e; border-color: #2ea043; color: #3fb950; }
.orb-btn-buy:hover { background: #2ea043; color: #fff; }
.orb-btn-add    { background: #1a4d2e; border-color: #2ea043; color: #3fb950; }
.orb-btn-add:hover { background: #2ea043; color: #fff; }
.orb-btn-market { background: #0d2435; border-color: #1f6feb; color: #58a6ff; }
.orb-btn-market:hover { background: #1f6feb; color: #fff; }
.orb-btn-lmt    { background: #0d2435; border-color: #1f6feb; color: #58a6ff; }
.orb-btn-lmt:hover { background: #1f6feb; color: #fff; }
.orb-btn-short  { background: #3d0f1f; border-color: #da3633; color: #f85149; }
.orb-btn-short:hover { background: #da3633; color: #fff; }
.orb-btn-cancel { background: #21262d; border-color: #30363d; color: #8b949e; }
.orb-btn-cancel:hover { background: #30363d; color: #c9d1d9; }
.orb-btn-delete { background: #3d1114; border-color: #da3633; color: #f85149; }
.orb-btn-delete:hover { background: #da3633; color: #fff; }
