:root {
  --grid-bg: #0f1419;
  --grid-card: #1a2332;
  --grid-border: #2d3a4f;
  --grid-accent: #3b82f6;
  --grid-green: #22c55e;
  --grid-red: #ef4444;
  --grid-amber: #f59e0b;
}

body {
  background: linear-gradient(160deg, #0b1220 0%, #111827 45%, #0f172a 100%);
  color: #e5e7eb;
  min-height: 100vh;
}

.navbar-brand {
  font-weight: 700;
  letter-spacing: 0.02em;
}

.card {
  background: var(--grid-card);
  border: 1px solid var(--grid-border);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--grid-border);
  font-weight: 600;
}

.form-control,
.form-select {
  background: #0b1220;
  border-color: var(--grid-border);
  color: #e5e7eb;
}

.form-control:focus,
.form-select:focus {
  background: #0b1220;
  border-color: var(--grid-accent);
  color: #e5e7eb;
  box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.2);
}

.form-label {
  color: #9ca3af;
  font-size: 0.875rem;
}

.mode-card {
  cursor: pointer;
  border: 1px solid var(--grid-border);
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.15s ease;
  height: 100%;
  background: #111827;
}

.mode-card:hover {
  border-color: #4b5563;
}

.mode-card.active {
  border-color: var(--grid-accent);
  box-shadow: inset 0 0 0 1px var(--grid-accent);
  background: rgba(59, 130, 246, 0.08);
}

.mode-card .mode-n {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
}

.mode-card .range-bounds {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  word-break: break-all;
}

.mode-card .range-fills {
  color: #86efac;
  font-weight: 600;
}

.mode-card .range-fills strong {
  color: #bbf7d0;
}

.mode-card .range-capital {
  color: #fbbf24;
  font-weight: 600;
}

.mode-card .range-capital strong {
  color: #fde68a;
}

.mode-card .range-capital-hint {
  display: block;
  margin-top: 0.15rem;
  color: #9ca3af;
  font-weight: 400;
  font-size: 0.75rem;
}

#movingGridPreview strong {
  color: #e5e7eb;
}

.moving-grid-panel {
  border-top: 1px solid var(--grid-border);
  padding-top: 1rem;
}

.moving-grid-title {
  font-weight: 600;
  color: #e5e7eb;
}

.moving-grid-desc {
  color: #9ca3af;
  font-size: 0.875rem;
  line-height: 1.45;
}

.moving-grid-help {
  color: #9ca3af;
  font-size: 0.8rem;
  line-height: 1.55;
}

.moving-grid-help strong {
  color: #e5e7eb;
}

.trigger-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.trigger-preset-btn {
  appearance: none;
  border: 1px solid var(--grid-border);
  background: #0b1220;
  color: #e5e7eb;
  border-radius: 10px;
  padding: 0.55rem 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.trigger-preset-btn:hover {
  border-color: #6b7280;
  background: #111827;
}

.trigger-preset-btn.active {
  border-color: #f8fafc;
  background: #111827;
  box-shadow: inset 0 0 0 1px #f8fafc;
  color: #fff;
}

.moving-grid-panel .form-check-input {
  width: 2.5rem;
  height: 1.35rem;
  cursor: pointer;
}

.moving-grid-panel .form-check-input:checked {
  background-color: #f97316;
  border-color: #f97316;
}

.moving-grid-panel.is-enabled .moving-grid-title {
  color: #fff;
}

.form-check-input:checked {
  background-color: var(--grid-accent);
  border-color: var(--grid-accent);
}

.moving-grid-panel .form-check-input:checked {
  background-color: #f97316;
  border-color: #f97316;
}

#triggerCustomWrap .input-group-text {
  background: #0b1220;
  border-color: var(--grid-border);
  color: #9ca3af;
}

.stat-box {
  background: #111827;
  border: 1px solid var(--grid-border);
  border-radius: 10px;
  padding: 0.85rem 1rem;
}

.stat-box .label {
  color: #9ca3af;
  font-size: 0.8rem;
}

.stat-box .value {
  font-size: 1.15rem;
  font-weight: 600;
}

.text-profit {
  color: var(--grid-green) !important;
}

.text-loss {
  color: var(--grid-red) !important;
}

#chart {
  height: 380px;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #0b1220;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  color: #9ca3af;
}

.chart-legend .legend-item::before {
  content: '';
  display: inline-block;
  width: 0.65rem;
  height: 0.15rem;
  margin-right: 0.35rem;
  vertical-align: middle;
  border-radius: 1px;
}

.chart-legend .legend-buy::before {
  background: #22c55e;
}

.chart-legend .legend-sell::before {
  background: #ef4444;
}

.chart-legend .legend-edge::before {
  background: #f59e0b;
  height: 0.2rem;
}

.chart-legend .legend-now::before {
  background: #c4b5fd;
  border-bottom: 1px dashed #c4b5fd;
  height: 0;
  width: 0.75rem;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: #e5e7eb;
  --bs-table-border-color: var(--grid-border);
  --bs-table-striped-bg: rgba(255, 255, 255, 0.02);
  --bs-table-hover-bg: rgba(59, 130, 246, 0.08);
}

.badge-status-running {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
}

.badge-status-paused,
.badge-status-stopped {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.alert-soft {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
}

.alert-warn {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fde68a;
}

.btn-primary {
  background: var(--grid-accent);
  border-color: var(--grid-accent);
}

.btn-outline-light {
  border-color: #4b5563;
  color: #e5e7eb;
}

.btn-outline-light:hover {
  background: #1f2937;
  border-color: #6b7280;
  color: #fff;
}

.trade-buy {
  color: var(--grid-green);
}

.trade-sell {
  color: var(--grid-red);
}

.footer-note {
  color: #6b7280;
  font-size: 0.85rem;
}

.symbol-combobox {
  position: relative;
  min-width: 0;
}

.symbol-combobox .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.input-group > .symbol-combobox + .fill-range-dropdown > .btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.fill-range-dropdown {
  flex: 0 0 auto;
}

.fill-range-dropdown > .btn {
  min-width: 11.5rem;
  white-space: nowrap;
}

.fill-range-menu {
  --bs-dropdown-bg: #0b1220;
  --bs-dropdown-border-color: var(--grid-border);
  --bs-dropdown-link-color: #e5e7eb;
  --bs-dropdown-link-hover-bg: rgba(59, 130, 246, 0.15);
  --bs-dropdown-link-hover-color: #fff;
  --bs-dropdown-link-active-bg: rgba(59, 130, 246, 0.25);
  --bs-dropdown-link-active-color: #fff;
  max-height: 280px;
  overflow-y: auto;
  min-width: 12rem;
}

.symbol-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 240px;
  overflow-y: auto;
  background: #0b1220;
  border: 1px solid var(--grid-border);
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}

.symbol-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 0;
  background: transparent;
  color: #e5e7eb;
  text-align: left;
  cursor: pointer;
}

.symbol-dropdown-item:hover,
.symbol-dropdown-item.active {
  background: rgba(59, 130, 246, 0.15);
}

.symbol-dropdown-item .symbol-label {
  font-weight: 600;
}

.symbol-dropdown-item .symbol-code {
  color: #9ca3af;
  font-size: 0.8rem;
}

.symbol-dropdown-empty {
  padding: 0.75rem 0.85rem;
  color: #9ca3af;
  font-size: 0.875rem;
}

